@@ -15,83 +15,6 @@ set(NCS_VERSION_MINOR ${CMAKE_MATCH_2})
1515set (NCS_VERSION_PATCH ${CMAKE_MATCH_3} )
1616set (NCS_VERSION_EXTRA ${CMAKE_MATCH_4} )
1717
18- file (STRINGS ${NRF_DIR} /scripts/ncs-toolchain-version -minimum.txt
19- toolchain_string LIMIT_COUNT 1 REGEX "^nrf-connect-sdk-toolchain="
20- )
21-
22- string (REGEX MATCH "=([^ \t ]*)" OUT_VAR "${toolchain_string} " )
23- set (NCS_TOOLCHAIN_MINIMUM_REQUIRED ${CMAKE_MATCH_1} )
24-
2518if (NOT NO_BOILERPLATE)
26- if (NOT DEFINED NCS_TOOLCHAIN_VERSION AND SYSBUILD)
27- file (STRINGS "${SYSBUILD_CACHE} " sysbuild_cache_strings ENCODING UTF-8 REGEX "^NCS_TOOLCHAIN_VERSION:" )
28- list (POP_FRONT sysbuild_cache_strings sysbuild_ncs_toolchain)
29- if (DEFINED sysbuild_ncs_toolchain)
30- string (REGEX MATCH "([^:]*):([^=]*)=" variable_identifier ${sysbuild_ncs_toolchain} )
31- string (LENGTH ${variable_identifier} variable_identifier_length)
32- string (SUBSTRING "${sysbuild_ncs_toolchain} " ${variable_identifier_length} -1 variable_value)
33- set (NCS_TOOLCHAIN_VERSION ${variable_value} CACHE "${CMAKE_MATCH_2} " "NCS Toolchain controlled by sysbuild" )
34- endif ()
35- endif ()
36-
37- if (NCS_TOOLCHAIN_VERSION)
38- set (NCS_TOOLCHAIN_MINIMUM_REQUIRED ${NCS_TOOLCHAIN_VERSION} )
39- set (EXACT "EXACT" )
40- endif ()
41-
42- if (NOT "${NCS_TOOLCHAIN_MINIMUM_REQUIRED} " STREQUAL "NONE" )
43- find_package (NcsToolchain ${NCS_TOOLCHAIN_MINIMUM_REQUIRED} ${EXACT} QUIET )
44- if (${NcsToolchain_FOUND} )
45- message ("-- Using NCS Toolchain ${NcsToolchain_VERSION} for building. (${NcsToolchain_DIR} )" )
46-
47- set (CUSTOM_COMMAND_PATH ${NCS_TOOLCHAIN_BIN_PATH} $ENV{PATH} )
48- cmake_path(CONVERT "${CUSTOM_COMMAND_PATH} " TO_NATIVE_PATH_LIST CUSTOM_COMMAND_PATH)
49- string (REPLACE ";" "\\\; " CUSTOM_COMMAND_PATH "${CUSTOM_COMMAND_PATH} " )
50-
51- set (CUSTOM_COMMAND_ENV ${CMAKE_COMMAND} -E env "PATH=${CUSTOM_COMMAND_PATH} " )
52- set (GIT_EXECUTABLE ${NCS_TOOLCHAIN_GIT} CACHE FILEPATH "NCS Toolchain Git" )
53-
54- set (DTC ${NCS_TOOLCHAIN_DTC} CACHE FILEPATH "NCS Toolchain DTC" )
55- set (GPERF ${NCS_TOOLCHAIN_GPERF} CACHE FILEPATH "NCS Toolchain gperf" )
56- set (WEST ${NCS_TOOLCHAIN_WEST} CACHE FILEPATH "NCS Toolchain West" )
57- set (Python3_EXECUTABLE ${NCS_TOOLCHAIN_PYTHON} CACHE FILEPATH "NCS Toolchain Python" )
58- set (PYTHON_EXECUTABLE ${NCS_TOOLCHAIN_PYTHON} CACHE FILEPATH "NCS Toolchain Python" )
59-
60- if (DEFINED NCS_TOOLCHAIN_PROTOC)
61- set (PROTOC ${CUSTOM_COMMAND_ENV} ${NCS_TOOLCHAIN_PROTOC} CACHE STRING "NCS Toolchain protoc" )
62- set (PROTOBUF_PROTOC_EXECUTABLE ${CUSTOM_COMMAND_ENV} ${NCS_TOOLCHAIN_PROTOC} CACHE STRING "NCS Toolchain protoc" )
63- endif ()
64-
65- set (ZEPHYR_TOOLCHAIN_VARIANT ${NCS_TOOLCHAIN_VARIANT} CACHE STRING "NCS Toolchain Variant" )
66- if ("${ZEPHYR_TOOLCHAIN_VARIANT} " STREQUAL "zephyr" )
67- set (ZEPHYR_SDK_INSTALL_DIR ${NCS_ZEPHYR_SDK_INSTALL_DIR} CACHE PATH "NCS Zephyr SDK install dir" )
68- endif ()
69- set (GNUARMEMB_TOOLCHAIN_PATH ${NCS_GNUARMEMB_TOOLCHAIN_PATH} CACHE PATH "NCS GNU ARM emb path" )
70-
71- if ("${CMAKE_GENERATOR} " STREQUAL "Ninja" )
72- set (CMAKE_MAKE_PROGRAM ${NCS_TOOLCHAIN_NINJA} CACHE INTERNAL "NCS Toolchain ninja" )
73- endif ()
74-
75- if ("${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Windows" )
76- set (env_list_delimeter ";" )
77- else ()
78- set (env_list_delimeter ":" )
79- endif ()
80-
81- # If NCS_TOOLCHAIN_ENV_PATH is set, then we must ensure to prepend it
82- # to ENV{PATH}. This is especially needed for west to work properly
83- # in windows with MinGW64.
84- if (NCS_TOOLCHAIN_ENV_PATH)
85- set (ENV{PATH } "${NCS_TOOLCHAIN_ENV_PATH}${env_list_delimeter}$ENV{PATH} " )
86- endif ()
87-
88- # If the NCS toolchain specifies a dedicated PYTHONPATH,
89- # we must ensure all calls uses that.
90- if (NCS_TOOLCHAIN_PYTHONPATH)
91- set (ENV{PYTHONPATH} "${NCS_TOOLCHAIN_PYTHONPATH} " )
92- endif ()
93- endif ()
94- endif ()
95-
9619 include (${NRF_DIR} /cmake/boilerplate.cmake NO_POLICY_SCOPE)
9720endif ()
0 commit comments