build: Support SYSROOT_DIR in native_sim and clang
When running naive sim builds using clang, respect user passed SYSROOT_DIR values. Additionally, allow overriding the archive tool when calling Make for the native simulator. Add the sysroot (if available) to the native_simulator target and TOOLCHAIN_C_FLAGS and TOOLCHAIN_LD_FLAGS. Additionally pass CMAKE_AR to NSI_AR. Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
parent
8a26316f17
commit
d17956a074
2 changed files with 15 additions and 1 deletions
|
@ -7,8 +7,15 @@ get_property(CCACHE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
|||
target_link_options(native_simulator INTERFACE
|
||||
"-T ${ZEPHYR_BASE}/boards/native/common/natsim_linker_script.ld")
|
||||
|
||||
if(SYSROOT_DIR)
|
||||
message(NOTICE "Appending --sysroot=${SYSROOT_DIR} to native_simulator")
|
||||
target_compile_options(native_simulator INTERFACE "--sysroot=${SYSROOT_DIR}")
|
||||
target_link_options(native_simulator INTERFACE "--sysroot=${SYSROOT_DIR}")
|
||||
endif()
|
||||
|
||||
set(nsi_config_content
|
||||
${nsi_config_content}
|
||||
"NSI_AR:=${CMAKE_AR}"
|
||||
"NSI_BUILD_OPTIONS:=$<JOIN:$<TARGET_PROPERTY:native_simulator,INTERFACE_COMPILE_OPTIONS>,\ >"
|
||||
"NSI_BUILD_PATH:=${zephyr_build_path}/NSI"
|
||||
"NSI_CC:=${CCACHE} ${CMAKE_C_COMPILER}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue