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>
26 lines
569 B
CMake
26 lines
569 B
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
if(CONFIG_LLVM_USE_LD)
|
|
set(LINKER 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()
|