Skip to content

Commit

Permalink
Merge pull request #10 from Altair-Bueno/master
Browse files Browse the repository at this point in the history
feat: Support for cross compiling
  • Loading branch information
XiangpengHao authored Dec 5, 2024
2 parents 5016115 + 5175b06 commit 519d3ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rust_part/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ else ()
set(TARGET_DIR "release")
endif ()

# If the user is cross compiling to a different target, update the location of the target directory
# *Note*: Make sure to install the target with rustup, as well as setting the proper environment variables, such as CC, HOST_CC, CARGO_TARGET_<triple>_LINKER, ...
# See https://doc.rust-lang.org/cargo/reference/environment-variables.html#configuration-environment-variables
if (DEFINED ENV{CARGO_BUILD_TARGET})
set(TARGET_DIR "$ENV{CARGO_BUILD_TARGET}/${TARGET_DIR}")
endif()

if(ENABLE_LTO)
set(RUST_FLAGS "-Clinker-plugin-lto" "-Clinker=clang-17" "-Clink-arg=-fuse-ld=lld-17")
endif()
Expand Down

0 comments on commit 519d3ad

Please sign in to comment.