File tree Expand file tree Collapse file tree 17 files changed +62
-24
lines changed Expand file tree Collapse file tree 17 files changed +62
-24
lines changed Original file line number Diff line number Diff line change @@ -491,7 +491,7 @@ choice COMPILER_OPTIMIZATIONS
491
491
prompt "Optimization level"
492
492
default NO_OPTIMIZATIONS if COVERAGE
493
493
default DEBUG_OPTIMIZATIONS if DEBUG
494
- default SIZE_OPTIMIZATIONS_AGGRESSIVE if "$(ZEPHYR_TOOLCHAIN_VARIANT )" = "llvm"
494
+ default SIZE_OPTIMIZATIONS_AGGRESSIVE if "$(TOOLCHAIN_VARIANT_COMPILER )" = "llvm"
495
495
default SIZE_OPTIMIZATIONS
496
496
help
497
497
Note that these flags shall only control the compiler
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ endif()
73
73
# Default to the host system's toolchain if we are targeting a host based target
74
74
if ((${BOARD_DIR} MATCHES "boards\/ native" ) OR ("${ARCH} " STREQUAL "posix" )
75
75
OR ("${BOARD} " STREQUAL "unit_testing" ))
76
- if (NOT "${ZEPHYR_TOOLCHAIN_VARIANT} " STREQUAL "llvm" )
76
+ if (NOT "${ZEPHYR_TOOLCHAIN_VARIANT} " STREQUAL "host/ llvm" )
77
77
set (ZEPHYR_TOOLCHAIN_VARIANT "host" )
78
78
endif ()
79
79
endif ()
@@ -102,6 +102,16 @@ endif()
102
102
set (TOOLCHAIN_ROOT ${TOOLCHAIN_ROOT} CACHE STRING "Zephyr toolchain root" FORCE )
103
103
assert (TOOLCHAIN_ROOT "Zephyr toolchain root path invalid: please set the TOOLCHAIN_ROOT-variable" )
104
104
105
+
106
+ # Check if ZEPHYR_TOOLCHAIN_VARIANT follows "<variant_name>/<compiler>" pattern
107
+ if ("${ZEPHYR_TOOLCHAIN_VARIANT} " MATCHES "^([^/]+)/([^/]+)$" )
108
+ set (_variant "${CMAKE_MATCH_1} " )
109
+ set (_compiler "${CMAKE_MATCH_2} " )
110
+ set (ZEPHYR_TOOLCHAIN_VARIANT "${_variant} " )
111
+ set (TOOLCHAIN_VARIANT_COMPILER "${_compiler} " )
112
+ set (TOOLCHAIN_VARIANT_COMPILER ${_compiler} CACHE STRING "compiler used by the toolchain variant" FORCE )
113
+ endif ()
114
+
105
115
# Set cached ZEPHYR_TOOLCHAIN_VARIANT.
106
116
set (ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr toolchain variant" )
107
117
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS
168
168
KCONFIG_BINARY_DIR =${KCONFIG_BINARY_DIR}
169
169
APPLICATION_SOURCE_DIR =${APPLICATION_SOURCE_DIR}
170
170
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
171
+ TOOLCHAIN_VARIANT_COMPILER=${TOOLCHAIN_VARIANT_COMPILER}
171
172
TOOLCHAIN_KCONFIG_DIR=${TOOLCHAIN_KCONFIG_DIR}
172
173
TOOLCHAIN_HAS_NEWLIB=${_local_TOOLCHAIN_HAS_NEWLIB}
173
174
TOOLCHAIN_HAS_PICOLIBC=${_local_TOOLCHAIN_HAS_PICOLIBC}
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
- set (COMPILER host-gcc )
4
- set (LINKER ld )
5
- set (BINTOOLS host-gnu )
3
+ if (TOOLCHAIN_VARIANT_COMPILER STREQUAL "gnu" OR
4
+ NOT DEFINED TOOLCHAIN_VARIANT_COMPILER )
6
5
7
- set (TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib" )
8
- set (TOOLCHAIN_HAS_GLIBCXX ON CACHE BOOL "True if toolchain supports libstdc++" )
6
+ if (NOT DEFINED TOOLCHAIN_VARIANT_COMPILER )
7
+ set (TOOLCHAIN_VARIANT_COMPILER "gnu" CACHE STRING "compiler used by the toolchain variant" FORCE )
8
+ endif ()
9
9
10
- message (STATUS "Found toolchain: host (gcc/ld)" )
10
+ include (${ZEPHYR_BASE} /cmake/toolchain/host/gnu/generic.cmake )
11
+
12
+ set (TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_BASE} /cmake/toolchain/host/gnu )
13
+ set (TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib" )
14
+ set (TOOLCHAIN_HAS_GLIBCXX ON CACHE BOOL "True if toolchain supports libstdc++" )
15
+ elseif (TOOLCHAIN_VARIANT_COMPILER STREQUAL "llvm" )
16
+
17
+ include (${ZEPHYR_BASE} /cmake/toolchain/host/llvm/generic.cmake )
18
+ set (TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_BASE} /cmake/toolchain/host/llvm )
19
+ endif ()
Original file line number Diff line number Diff line change 1
- # Copyright (c) 2024 Basalte bv
1
+ # Copyright The Zephyr Project Contributors
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
4
4
config TOOLCHAIN_HOST_SUPPORTS_GNU_EXTENSIONS
Original file line number Diff line number Diff line change
1
+
2
+ set (TOOLCHAIN_VARIANT_COMPILER gcc CACHE STRING "Variant compiler being used" )
3
+ set (COMPILER host-gcc )
4
+ set (LINKER ld )
5
+ set (BINTOOLS host-gnu )
6
+
7
+ set (TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib" )
8
+
9
+ message (STATUS "Found toolchain: host (gcc/ld)" )
Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: Apache-2.0
Original file line number Diff line number Diff line change 1
- # Copyright (c) 2023 Intel Corporation
1
+ # Copyright The Zephyr Project Contributors
2
+ # Copyright (c) 2024 Basalte bv
2
3
# SPDX-License-Identifier: Apache-2.0
3
-
4
+ #
4
5
choice LLVM_LINKER
5
6
prompt "LLVM Linker"
6
- depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "llvm"
7
7
default LLVM_USE_LD
8
8
9
9
config LLVM_USE_LD
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments