File tree Expand file tree Collapse file tree 4 files changed +37
-10
lines changed Expand file tree Collapse file tree 4 files changed +37
-10
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ zephyr_file(APPLICATION_ROOT TOOLCHAIN_ROOT)
95
95
96
96
# Host-tools don't unconditionally set TOOLCHAIN_HOME anymore,
97
97
# but in case Zephyr's SDK toolchain is used, set TOOLCHAIN_HOME
98
- if ("${ZEPHYR_TOOLCHAIN_VARIANT} " STREQUAL " zephyr" )
98
+ if ("${ZEPHYR_TOOLCHAIN_VARIANT} " MATCHES "^ zephyr/? " )
99
99
set (TOOLCHAIN_HOME ${HOST_TOOLS_HOME} )
100
100
endif ()
101
101
@@ -108,12 +108,11 @@ if("${ZEPHYR_TOOLCHAIN_VARIANT}" MATCHES "^([^/]+)/([^/]+)$")
108
108
set (_variant "${CMAKE_MATCH_1} " )
109
109
set (_compiler "${CMAKE_MATCH_2} " )
110
110
set (ZEPHYR_TOOLCHAIN_VARIANT "${_variant} " )
111
- set (TOOLCHAIN_VARIANT_COMPILER "${_compiler} " )
112
111
set (TOOLCHAIN_VARIANT_COMPILER ${_compiler} CACHE STRING "compiler used by the toolchain variant" FORCE )
113
112
endif ()
114
113
115
114
# Set cached ZEPHYR_TOOLCHAIN_VARIANT.
116
- set (ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr toolchain variant" )
115
+ set (ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr toolchain variant" FORCE )
117
116
118
117
# Configure the toolchain based on what SDK/toolchain is in use.
119
118
include (${TOOLCHAIN_ROOT} /cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT}/generic.cmake )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ endif()
54
54
# 1) Zephyr specified as toolchain (ZEPHYR_SDK_INSTALL_DIR still used if defined)
55
55
# 2) No toolchain specified == Default to Zephyr toolchain
56
56
# Until we completely deprecate it
57
- if (("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT} ) OR
57
+ if ((${ZEPHYR_TOOLCHAIN_VARIANT} MATCHES "^zephyr/?" ) OR
58
58
(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT ) OR
59
59
(DEFINED ZEPHYR_SDK_INSTALL_DIR ) OR
60
60
(Zephyr-sdk_FIND_REQUIRED ))
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
- include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/generic.cmake )
3
+ if (TOOLCHAIN_VARIANT_COMPILER STREQUAL "gnu" OR
4
+ NOT DEFINED TOOLCHAIN_VARIANT_COMPILER )
5
+ if (EXISTS ${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/gnu/generic.cmake )
6
+ include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/gnu/generic.cmake )
7
+ else ()
8
+ include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/generic.cmake )
9
+ endif ()
10
+ set (TOOLCHAIN_VARIANT_COMPILER "gnu" CACHE STRING "compiler used by the toolchain variant" FORCE )
4
11
5
- set (TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr )
12
+ set (TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr )
13
+ # Zephyr SDK < 0.17.1 does not set TOOLCHAIN_HAS_GLIBCXX
14
+ set (TOOLCHAIN_HAS_GLIBCXX ON CACHE BOOL "True if toolchain supports libstdc++" )
15
+ message (STATUS "Found toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR} )" )
16
+ elseif (TOOLCHAIN_VARIANT_COMPILER STREQUAL "llvm" )
17
+ include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/llvm/generic.cmake )
18
+ set (TOOLCHAIN_VARIANT_COMPILER "llvm" CACHE STRING "compiler used by the toolchain variant" FORCE )
6
19
7
- # Zephyr SDK < 0.17.1 does not set TOOLCHAIN_HAS_GLIBCXX
8
- set (TOOLCHAIN_HAS_GLIBCXX ON CACHE BOOL "True if toolchain supports libstdc++" )
20
+ set (TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr )
9
21
10
- message (STATUS "Found toolchain: zephyr-sdk-gnu ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR} )" )
22
+ message (STATUS "Found toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR} )" )
23
+ else ()
24
+ message (FATAL_ERROR "Unsupported TOOLCHAIN_VARIANT_COMPILER: ${TOOLCHAIN_VARIANT_COMPILER} " )
25
+ endif ()
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
- include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/target.cmake )
3
+ if (TOOLCHAIN_VARIANT_COMPILER STREQUAL "gnu" OR
4
+ TOOLCHAIN_VARIANT_COMPILER STREQUAL "default" )
5
+ set (TOOLCHAIN_VARIANT_COMPILER gnu CACHE STRING "Variant compiler being used" )
6
+ if (EXISTS ${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/gnu/target.cmake )
7
+ include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/gnu/target.cmake )
8
+ else ()
9
+ include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/target.cmake )
10
+ endif ()
11
+ elseif (TOOLCHAIN_VARIANT_COMPILER STREQUAL "llvm" )
12
+ set (TOOLCHAIN_VARIANT_COMPILER llvm CACHE STRING "Variant compiler being used" )
13
+ include (${ZEPHYR_SDK_INSTALL_DIR} /cmake/zephyr/llvm/target.cmake )
14
+ else ()
15
+ message (FATAL_ERROR "Unsupported TOOLCHAIN_VARIANT_COMPILER: ${TOOLCHAIN_VARIANT_COMPILER} " )
16
+ endif ()
You can’t perform that action at this time.
0 commit comments