Skip to content

Commit dd1b577

Browse files
committed
UIC-8953: rust: Trace cargo and allow target triple overide
This change is helpful to trace/debug rust related job. This was useful to build zpc natively on arm64 (aarch64-unknown-linux-gnu). What has been observed on native arm64 build: .../1.71.0-aarch64-unknown-linux-gnu/bin/cargo build \ --manifest-path /.../applications/zpc/components/zpc_rust/Cargo.toml \ --locked \ --target x86_64-unknown-linux-gnu While it was passed a cmake define It was made for core v7 but also applies to zpc v6 Relate-to: https://doc.rust-lang.org/nightly/rustc/platform-support.html Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent ee6ffa0 commit dd1b577

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmake/modules/CargoMeta.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,11 @@ function(rust_is_configured_for_deb CARGO_META_PACKAGE CONFIGURED)
357357
endif()
358358
endfunction()
359359

360-
get_target_triple(CARGO_TARGET_TRIPLE)
360+
# Allow overide from env (the above detection may not be reliable or scale)
361+
if(NOT DEFINED CARGO_TARGET_TRIPLE)
362+
get_target_triple(CARGO_TARGET_TRIPLE)
363+
endif()
364+
361365
set(DIR_OF_CARGO_META
362366
${CMAKE_CURRENT_LIST_DIR}
363367
CACHE INTERNAL "DIR_OF_CARGO_META")
@@ -369,7 +373,9 @@ function(rust_workspace_metadata CARGO_MANIFEST_DIR CARGO_METADATA)
369373
${CARGO_EXECUTABLE} "metadata" "--manifest-path"
370374
"${CARGO_MANIFEST_DIR}/Cargo.toml" "--format-version" "1"
371375
"--filter-platform" "${CARGO_TARGET_TRIPLE}"
372-
OUTPUT_VARIABLE METADATA COMMAND_ERROR_IS_FATAL ANY)
376+
OUTPUT_VARIABLE METADATA COMMAND_ERROR_IS_FATAL ANY
377+
COMMAND_ECHO STDERR
378+
)
373379
set(${CARGO_METADATA}
374380
${METADATA}
375381
PARENT_SCOPE)

0 commit comments

Comments
 (0)