cmake: Toolchain abstraction: Assembly
Introduce toolchain_cc_asm macro to capture toolchain specific flags related to assembly. -D_ASMLANGUAGE is kept common for all, assuming -D as define flag is supported by all compilers (which is almost the case). No functional change expected. Clang's flags are compatible with gcc, and are thus inherited. This is motivated by the wish to abstract Zephyr's usage of toolchains, permitting easier porting to other (commercial) toolchains. Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
This commit is contained in:
parent
942d4bba94
commit
cb0fd451c2
5 changed files with 16 additions and 1 deletions
|
@ -205,8 +205,14 @@ zephyr_compile_options(
|
|||
${TOOLCHAIN_C_FLAGS}
|
||||
)
|
||||
|
||||
# @Intent: Obtain compiler specific flags related to assembly
|
||||
toolchain_cc_asm_base_flags(ASM_BASE_FLAG)
|
||||
zephyr_compile_options(
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${ASM_BASE_FLAG}>
|
||||
)
|
||||
|
||||
# Common toolchain-agnostic assembly flags
|
||||
zephyr_compile_options(
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-xassembler-with-cpp>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-D_ASMLANGUAGE>
|
||||
)
|
||||
|
||||
|
|
|
@ -58,3 +58,4 @@ include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_fortify.cmake)
|
|||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_canaries.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_optimizations.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_cpp.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_asm.cmake)
|
||||
|
|
|
@ -143,3 +143,4 @@ include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_security_fortify.cmake)
|
|||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_security_canaries.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_optimizations.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_cpp.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_asm.cmake)
|
||||
|
|
6
cmake/compiler/gcc/target_asm.cmake
Normal file
6
cmake/compiler/gcc/target_asm.cmake
Normal file
|
@ -0,0 +1,6 @@
|
|||
# See root CMakeLists.txt for description and expectations of this macro
|
||||
|
||||
macro(toolchain_cc_asm_base_flags dest_var_name)
|
||||
# Specify assembly as the source language for the preprocessor to expect
|
||||
set_ifndef(${dest_var_name} "-xassembler-with-cpp")
|
||||
endmacro()
|
|
@ -81,3 +81,4 @@ include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_fortify.cmake)
|
|||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_canaries.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_optimizations.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_cpp.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_asm.cmake)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue