Skip to content

Commit

Permalink
cmake: Support SDK versions more broadly
Browse files Browse the repository at this point in the history
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 <kumar.gala@linaro.org>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
  • Loading branch information
galak authored and carlescufi committed Aug 5, 2019
1 parent 2b84c72 commit 6228a18
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 62 deletions.
13 changes: 0 additions & 13 deletions cmake/toolchain/zephyr/0.10.0/host-tools.cmake

This file was deleted.

32 changes: 0 additions & 32 deletions cmake/toolchain/zephyr/0.10.0/target.cmake

This file was deleted.

14 changes: 0 additions & 14 deletions cmake/toolchain/zephyr/0.10.1/generic.cmake

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cmake/toolchain/zephyr/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if (NOT ZEPHYR_SDK_INSTALL_DIR)
message(FATAL_ERROR "ZEPHYR_SDK_INSTALL_DIR must be set")
endif()

include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_VERSION}/generic.cmake)
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_MAJOR_MINOR}/generic.cmake)
3 changes: 2 additions & 1 deletion cmake/toolchain/zephyr/host-tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ file(READ ${sdk_version_path} SDK_VERSION_PRE1)
string(REGEX REPLACE "-.*" "" SDK_VERSION_PRE2 ${SDK_VERSION_PRE1})
# Strip any trailing spaces/newlines from the version string
string(STRIP ${SDK_VERSION_PRE2} SDK_VERSION)
string(REGEX MATCH "([0-9]*).([0-9]*)" SDK_MAJOR_MINOR ${SDK_VERSION})
if(${REQUIRED_SDK_VER} VERSION_GREATER ${SDK_VERSION})
message(FATAL_ERROR "The SDK version you are using is too old, please update your SDK.
You need at least SDK version ${REQUIRED_SDK_VER}.
Expand All @@ -43,4 +44,4 @@ https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${REQUIRED_SDK_V
")
endif()

include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_VERSION}/host-tools.cmake)
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_MAJOR_MINOR}/host-tools.cmake)
2 changes: 1 addition & 1 deletion cmake/toolchain/zephyr/target.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

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

0 comments on commit 6228a18

Please sign in to comment.