toolchain: llvm: defer setting target triple to target.cmake
Since kconfigs are not available when generic.cmake is parsed. Setting the target triple for x86 needs to be deferred to target.cmake as it needs to know whether CONFIG_64BIT is enabled. This also moves the ARM triple to target.cmake as triple is needed for target tools. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
aa8f812118
commit
fb350bca10
2 changed files with 19 additions and 15 deletions
|
|
@ -17,21 +17,6 @@ set(LLVM_TOOLCHAIN_PATH ${CLANG_ROOT_DIR} CACHE PATH "clang install directory")
|
|||
set(COMPILER clang)
|
||||
set(BINTOOLS llvm)
|
||||
|
||||
if("${ARCH}" STREQUAL "arm")
|
||||
set(triple arm-none-eabi)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
|
||||
elseif("${ARCH}" STREQUAL "x86")
|
||||
if(CONFIG_64BIT)
|
||||
set(triple x86_64-pc-none-elf)
|
||||
else()
|
||||
set(triple i686-pc-none-elf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
||||
|
||||
set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
|
||||
|
||||
list(APPEND TOOLCHAIN_C_FLAGS --config ${ZEPHYR_BASE}/cmake/toolchain/llvm/clang.cfg)
|
||||
|
|
|
|||
|
|
@ -5,3 +5,22 @@ if(CONFIG_LLVM_USE_LD)
|
|||
elseif(CONFIG_LLVM_USE_LLD)
|
||||
set(LINKER lld)
|
||||
endif()
|
||||
|
||||
if("${ARCH}" STREQUAL "arm")
|
||||
set(triple arm-none-eabi)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
|
||||
elseif("${ARCH}" STREQUAL "x86")
|
||||
if(CONFIG_64BIT)
|
||||
set(triple x86_64-pc-none-elf)
|
||||
else()
|
||||
set(triple i686-pc-none-elf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED triple)
|
||||
set(CMAKE_C_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
||||
|
||||
unset(triple)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in a new issue