diff --git a/.github/workflows/zephyr-tests.yml b/.github/workflows/zephyr-tests.yml index e2ab370..0ffac3c 100644 --- a/.github/workflows/zephyr-tests.yml +++ b/.github/workflows/zephyr-tests.yml @@ -299,12 +299,17 @@ jobs: with: path: gale - - name: Install Rust + x86_64 target + - name: Install Rust + x86_64 target + rust-src run: | apt-get update -qq && apt-get install -y -qq curl > /dev/null 2>&1 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable . /root/.cargo/env rustup target add x86_64-unknown-none + # rust-src is required by -Zbuild-std=core, which gale's + # x86 build path uses to rebuild `core` from source with + # matching code-model + relocation-model. See the CONFIG_X86 + # block in zephyr/CMakeLists.txt for full rationale. + rustup component add rust-src - name: Initialize west workspace run: | diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index f2aaa6e..deb046b 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -176,6 +176,8 @@ endif() # 2 GB of the 64-bit address space (sign-extended 32-bit immediates). # Zephyr maps the kernel in the lower address space, so we must use # code-model=small (addresses in the lower 2 GB) to match the C code. +set(GALE_CARGO_EXTRA_ARGS "") + if(CONFIG_X86) if(GALE_CARGO_RUSTFLAGS_ENV STREQUAL "") set(GALE_CARGO_RUSTFLAGS_ENV "RUSTFLAGS=-Crelocation-model=static -Ccode-model=small") @@ -183,6 +185,34 @@ if(CONFIG_X86) string(REPLACE "RUSTFLAGS=" "RUSTFLAGS=-Crelocation-model=static -Ccode-model=small " GALE_CARGO_RUSTFLAGS_ENV "${GALE_CARGO_RUSTFLAGS_ENV}") endif() + + # Two compounding issues with the precompiled `core` rustlib for + # x86_64-unknown-none — both root-cause to "core was built with the + # target's defaults, which don't match the flags Zephyr needs": + # + # 1) Its bitcode is tagged code-model=kernel (the target default), but + # we pass -Ccode-model=small to match Zephyr's lower-2 GB kernel + # mapping. Fat LTO can't merge the two: + # warning: linking module flags 'Code Model': + # IDs have conflicting values: 'i32 2' from , and 'i32 1' from gale_ffi... + # error: failed to load bitcode of module "core-...rcgu.o" + # + # 2) Even with lto=false (the release-lto profile we used to switch to + # as a partial fix), the precompiled core's PIC-emitted symbol + # references trigger: + # ld.bfd: discarded output section: `.got.plt' + # ld.bfd: final link failed + # against Zephyr's non-PIC kernel link script. + # + # Proper fix: rebuild core from source with our flags via -Zbuild-std. + # The rebuilt core picks up RUSTFLAGS=-Ccode-model=small -Crelocation- + # model=static (set above), so it's both bitcode-compatible (matches + # gale-ffi's code-model) and PIC-free (no GOT/PLT references). Requires + # the `rust-src` rustup component AND RUSTC_BOOTSTRAP=1 to permit the + # unstable cargo flag on stable rustc. CI installs rust-src in the SMP + # test job; see .github/workflows/zephyr-tests.yml. + set(GALE_CARGO_EXTRA_ARGS "-Zbuild-std=core") + message(STATUS "Gale: x86 — rebuilding core from source via -Zbuild-std (matches code-model + relocation-model)") endif() # -------------------------------------------------------------------------- @@ -205,6 +235,12 @@ set(GALE_CARGO_ENV GALE_MAX_WAITERS=${CONFIG_GALE_MAX_WAITERS} ) +# x86 needs RUSTC_BOOTSTRAP=1 to permit -Zbuild-std on stable rustc. +# See the CONFIG_X86 block above for the full rationale. +if(CONFIG_X86) + list(APPEND GALE_CARGO_ENV "RUSTC_BOOTSTRAP=1") +endif() + # Collect Cargo features from Kconfig — only compile FFI code for enabled modules set(GALE_CARGO_FEATURES "") set(GALE_FEATURE_MAP @@ -376,7 +412,7 @@ else() add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_ENV} ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} ${GALE_CARGO_FEATURE_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS @@ -474,7 +510,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -570,7 +606,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -664,7 +700,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -758,7 +794,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -852,7 +888,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -946,7 +982,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -1040,7 +1076,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -1134,7 +1170,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -1227,7 +1263,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -1320,7 +1356,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -1413,7 +1449,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml @@ -1465,7 +1501,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1505,7 +1541,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1545,7 +1581,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1585,7 +1621,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1625,7 +1661,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1665,7 +1701,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1705,7 +1741,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1745,7 +1781,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1785,7 +1821,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1825,7 +1861,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1865,7 +1901,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1905,7 +1941,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1945,7 +1981,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -1993,7 +2029,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2033,7 +2069,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2088,7 +2124,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2133,7 +2169,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2178,7 +2214,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2222,7 +2258,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2262,7 +2298,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2305,7 +2341,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2349,7 +2385,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2392,7 +2428,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2435,7 +2471,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2479,7 +2515,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2522,7 +2558,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2569,7 +2605,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2615,7 +2651,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2664,7 +2700,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS ${GALE_FFI_DIR}/Cargo.toml ${GALE_FFI_DIR}/src/lib.rs COMMENT "Building Gale FFI static library for ${RUST_TARGET}" @@ -2751,7 +2787,7 @@ if(NOT TARGET gale_ffi_build) add_custom_command( OUTPUT ${GALE_FFI_LIB} COMMAND ${CMAKE_COMMAND} -E env ${GALE_CARGO_ENV} ${GALE_CARGO_RUSTFLAGS_ENV} - cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} + cargo build ${GALE_CARGO_PROFILE_ARGS} ${CARGO_TARGET_ARGS} ${GALE_CARGO_EXTRA_ARGS} ${GALE_CARGO_FEATURE_ARGS} --manifest-path ${GALE_FFI_DIR}/Cargo.toml DEPENDS