Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[buildmgr] Add CLANG system includes and clean-up #1058

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tools/buildmgr/cbuildgen/config/CLANG.16.0.0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
endif()

set(CPP_FLAGS "-E -P ${CLANG_CPU} -xc ${CC_SECURE}")
set(CPP_FLAGS "-E -P --target=${CLANG_ARCH}-none-eabi ${CLANG_CPU} -xc ${CC_SECURE}")
set(CPP_DEFINES ${LD_SCRIPT_PP_DEFINES})
cbuild_set_defines(CC CPP_DEFINES)
if(DEFINED LD_REGIONS AND NOT LD_REGIONS STREQUAL "")
Expand All @@ -277,6 +277,7 @@ set(CC_DEFINES ${ASM_DEFINES})
set(CC_BYTE_ORDER ${ASM_BYTE_ORDER})
set(CC_FLAGS "--target=${CLANG_ARCH}-none-eabi --sysroot=${TOOLCHAIN_ROOT}/../lib/clang-runtimes/arm-none-eabi/${CLANG_ARCH}${CLANG_ARCH_SUFFIX}")
set(_PI "-include ")
set(_ISYS "-isystem ")
set(CC_OPTIONS_FLAGS)
cbuild_set_options_flags(CC "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "${LANGUAGE_CC}" CC_OPTIONS_FLAGS)

Expand All @@ -288,6 +289,10 @@ elseif(BRANCHPROT STREQUAL "BTI_SIGNRET")
set(CC_BRANCHPROT "-mbranch-protection=bti+pac-ret")
endif()

set (CC_SYS_INC_PATHS_LIST
"$\{TOOLCHAIN_ROOT}/../lib/clang/\${TOOLCHAIN_MAJOR_VERSION}/include"
)

# C++ Compiler

set(CXX_CPU "${CC_CPU}")
Expand All @@ -299,6 +304,10 @@ set(CXX_FLAGS "${CC_FLAGS}")
set(CXX_OPTIONS_FLAGS)
cbuild_set_options_flags(CXX "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "${LANGUAGE_CXX}" CXX_OPTIONS_FLAGS)

set (CXX_SYS_INC_PATHS_LIST
"${CC_SYS_INC_PATHS_LIST}"
)

# Linker

set(LD_CPU ${CLANG_CPU})
Expand Down
2 changes: 2 additions & 0 deletions tools/buildmgr/cbuildgen/config/CMSIS-Build-Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ endfunction()
# Get system includes
# Replace TOOLCHAIN_ROOT and TOOLCHAIN_VERSION variables
function(cbuild_get_system_includes input output)
string(REGEX MATCH "^[0-9]+" TOOLCHAIN_MAJOR_VERSION ${TOOLCHAIN_VERSION})
foreach(ENTRY ${${input}})
string(REGEX REPLACE "\\\${TOOLCHAIN_ROOT}" ${TOOLCHAIN_ROOT} ENTRY ${ENTRY})
string(REGEX REPLACE "\\\${TOOLCHAIN_VERSION}" ${TOOLCHAIN_VERSION} ENTRY ${ENTRY})
string(REGEX REPLACE "\\\${TOOLCHAIN_MAJOR_VERSION}" ${TOOLCHAIN_MAJOR_VERSION} ENTRY ${ENTRY})
cmake_path(NORMAL_PATH ENTRY OUTPUT_VARIABLE NORMAL_ENTRY)
string(APPEND ${output} "${_ISYS}\"${NORMAL_ENTRY}\" ")
endforeach()
Expand Down
8 changes: 0 additions & 8 deletions tools/buildmgr/cbuildgen/config/GCC.10.3.1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ set (CC_SYS_INC_PATHS_LIST
"$\{TOOLCHAIN_ROOT}/../lib/gcc/arm-none-eabi/\${TOOLCHAIN_VERSION}/include-fixed"
"$\{TOOLCHAIN_ROOT}/../arm-none-eabi/include"
)
function(cbuild_get_c_system_includes includes)
cbuild_get_system_includes(CC_SYS_INC_PATHS_LIST ${includes})
set(${includes} ${${includes}} PARENT_SCOPE)
endfunction()

# C++ Compiler

Expand All @@ -313,10 +309,6 @@ set (CXX_SYS_INC_PATHS_LIST
"$\{TOOLCHAIN_ROOT}/../arm-none-eabi/include/c++/\${TOOLCHAIN_VERSION}/backward"
"${CC_SYS_INC_PATHS_LIST}"
)
function(cbuild_get_cxx_system_includes includes)
cbuild_get_system_includes(CXX_SYS_INC_PATHS_LIST ${includes})
set(${includes} ${${includes}} PARENT_SCOPE)
endfunction()

# Linker

Expand Down
Loading