Skip to content

Commit 3a42ff9

Browse files
galaknashif
authored andcommitted
cmake: Support SDK versions more broadly
The SDK version is of the form X.Y.Z. Change the cmake scripts to be based on X.Y of the version. This allows us to easily support newer toolchains without having to explicitly add cmake files for the version as well as removes duplication between those files. Signed-off-by: Kumar Gala <[email protected]> Signed-off-by: Carles Cufi <[email protected]>
1 parent 1b397dd commit 3a42ff9

File tree

9 files changed

+8
-60
lines changed

9 files changed

+8
-60
lines changed

cmake/toolchain/zephyr/0.10.1/generic.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

cmake/toolchain/zephyr/0.10.1/host-tools.cmake

Lines changed: 0 additions & 13 deletions
This file was deleted.

cmake/toolchain/zephyr/0.10.1/target.cmake

Lines changed: 0 additions & 32 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_VERSION}/generic.cmake)
3+
if (NOT ZEPHYR_SDK_INSTALL_DIR)
4+
message(FATAL_ERROR "ZEPHYR_SDK_INSTALL_DIR must be set")
5+
endif()
6+
7+
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_MAJOR_MINOR}/generic.cmake)

cmake/toolchain/zephyr/host-tools.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ file(READ ${sdk_version_path} SDK_VERSION_PRE1)
3434
string(REGEX REPLACE "-.*" "" SDK_VERSION_PRE2 ${SDK_VERSION_PRE1})
3535
# Strip any trailing spaces/newlines from the version string
3636
string(STRIP ${SDK_VERSION_PRE2} SDK_VERSION)
37+
string(REGEX MATCH "([0-9]*).([0-9]*)" SDK_MAJOR_MINOR ${SDK_VERSION})
3738
if(${REQUIRED_SDK_VER} VERSION_GREATER ${SDK_VERSION})
3839
message(FATAL_ERROR "The SDK version you are using is too old, please update your SDK.
3940
You need at least SDK version ${REQUIRED_SDK_VER}.
@@ -43,4 +44,4 @@ https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${REQUIRED_SDK_V
4344
")
4445
endif()
4546

46-
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_VERSION}/host-tools.cmake)
47+
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_MAJOR_MINOR}/host-tools.cmake)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_VERSION}/target.cmake)
3+
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_MAJOR_MINOR}/target.cmake)

0 commit comments

Comments
 (0)