Remove cxx and autocxx

Notably this gets rid of the Cargo target directory inside build directories,
in favor of "target/" at workspace root.
This commit is contained in:
Johannes Altmanninger
2024-01-07 21:38:49 +01:00
parent 8a67abfeaa
commit 29bd6eebd0
16 changed files with 29 additions and 970 deletions

View File

@@ -23,8 +23,6 @@ endif()
set(fish_rust_target "fish-rust")
set(fish_autocxx_gen_dir "${CMAKE_BINARY_DIR}/fish-autocxx-gen/")
set(FISH_CRATE_FEATURES)
if(NOT DEFINED CARGO_FLAGS)
# Corrosion doesn't like an empty string as FLAGS. This is basically a no-op alternative.
@@ -43,15 +41,6 @@ corrosion_import_crate(
FLAGS "${CARGO_FLAGS}"
)
# We need the build dir because cxx puts our headers in there.
# Corrosion doesn't expose the build dir, so poke where we shouldn't.
if (Rust_CARGO_TARGET)
set(rust_target_dir "${CMAKE_BINARY_DIR}/cargo/build/${_CORROSION_RUST_CARGO_TARGET}")
else()
set(rust_target_dir "${CMAKE_BINARY_DIR}/cargo/build/${_CORROSION_RUST_CARGO_HOST_TARGET}")
corrosion_set_hostbuild(${fish_rust_target})
endif()
# Temporary hack to propogate CMake flags/options to build.rs. We need to get CMake to evaluate the
# truthiness of the strings if they are set.
set(CMAKE_WITH_GETTEXT "1")
@@ -67,8 +56,6 @@ string(JOIN "," CURSES_LIBRARY_LIST ${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY})
# Tell Cargo where our build directory is so it can find config.h.
corrosion_set_env_vars(${fish_rust_target}
"FISH_BUILD_DIR=${fish_binary_dir}"
"FISH_AUTOCXX_GEN_DIR=${fish_autocxx_gen_dir}"
"FISH_RUST_TARGET_DIR=${rust_target_dir}"
"PREFIX=${CMAKE_INSTALL_PREFIX}"
# Temporary hack to propogate CMake flags/options to build.rs.
"CMAKE_WITH_GETTEXT=${CMAKE_WITH_GETTEXT}"
@@ -79,20 +66,3 @@ corrosion_set_env_vars(${fish_rust_target}
"LOCALEDIR=${CMAKE_INSTALL_FULL_LOCALEDIR}"
"CURSES_LIBRARY_LIST=${CURSES_LIBRARY_LIST}"
)
# this needs an extra fish-rust due to the poor source placement
target_include_directories(${fish_rust_target} INTERFACE
"${rust_target_dir}/cxxbridge/${fish_rust_target}/fish-rust/src/"
"${fish_autocxx_gen_dir}/include/"
)
# Tell fish what extra C++ files to compile.
define_property(
TARGET PROPERTY fish_extra_cpp_files
BRIEF_DOCS "Extra C++ files to compile for fish."
FULL_DOCS "Extra C++ files to compile for fish."
)
set_property(TARGET ${fish_rust_target} PROPERTY fish_extra_cpp_files
"${fish_autocxx_gen_dir}/cxx/gen0.cxx"
)