Skip to content

Commit aeec7f8

Browse files
committed
SWPROT-8953: Add recipe to pull UnifySDK dependency
This file is shared a single commit, to allow pick between projects (eg: z-wave-protocol-controller) consuming UnifySDK since the monorepo has been shrinked. Feedback welcome. Note values can be ajusted from env, it can be usefull for github actions with fork, if using private one make sure to pass the token in the build env: UNIFYSDK_GIT_REPOSITORY="https://<TOKEN>@github.com/rzr/UnifySDK" Bug-SiliconLabs: SWPROT-8953 Origin: SiliconLabs/UnifySDK#51 Forwarded: uic/pull-requests/2972 Forwarded: #10 Signed-off-by: Philippe Coval <[email protected]>
1 parent e94b678 commit aeec7f8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

cmake/modules/FindUnifySDK.cmake

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# SPDX-FileCopyrightText: Silicon Laboratories Inc. <https://www.silabs.com/>
2+
# SPDX-License-Identifier: Zlib
3+
#
4+
# Origin: https://github.com/SiliconLabs/UnifySDK/pull/51
5+
#
6+
# This recipe allows to download Unify Core
7+
# It can be used by projects which are depending on it
8+
# Feel free to copy this (up to date) file everywhere it is needed
9+
10+
include(FetchContent)
11+
12+
if(NOT DEFINED UNIFYSDK_GIT_REPOSITORY)
13+
if(DEFINED ENV{UNIFYSDK_GIT_REPOSITORY})
14+
set(UNIFYSDK_GIT_REPOSITORY $ENV{UNIFYSDK_GIT_REPOSITORY})
15+
endif()
16+
endif()
17+
if("${UNIFYSDK_GIT_REPOSITORY}" STREQUAL "")
18+
set(UNIFYSDK_GIT_REPOSITORY "https://github.com/SiliconLabs/UnifySDK")
19+
endif()
20+
21+
if(NOT DEFINED UNIFYSDK_GIT_TAG)
22+
if(DEFINED ENV{UNIFYSDK_GIT_TAG})
23+
set(UNIFYSDK_GIT_TAG $ENV{UNIFYSDK_GIT_TAG})
24+
endif()
25+
endif()
26+
if("${UNIFYSDK_GIT_TAG}" STREQUAL "")
27+
set(UNIFYSDK_GIT_TAG "main") # Override CMake default ("master")
28+
endif()
29+
30+
FetchContent_Declare(
31+
UnifySDK
32+
GIT_REPOSITORY ${UNIFYSDK_GIT_REPOSITORY}
33+
GIT_TAG ${UNIFYSDK_GIT_TAG}
34+
GIT_SUBMODULES_RECURSE True
35+
GIT_SHALLOW 1
36+
)
37+
38+
message(STATUS "${CMAKE_PROJECT_NAME}: Depends: ${UNIFYSDK_GIT_REPOSITORY}#${UNIFYSDK_GIT_TAG}")
39+
string(REGEX MATCH ".*/?main/?.*" UNIFYSDK_UNSTABLE_GIT_TAG "${UNIFYSDK_GIT_TAG}")
40+
if(UNIFYSDK_GIT_TAG STREQUAL "" OR UNIFYSDK_UNSTABLE_GIT_TAG)
41+
message(WARNING "${CMAKE_PROJECT_NAME}: Declare UNIFYSDK_GIT_TAG to stable version not: ${UNIFYSDK_UNSTABLE_GIT_TAG}")
42+
endif()
43+
44+
set(FETCHCONTENT_QUIET FALSE)
45+
FetchContent_MakeAvailable(UnifySDK)
46+
47+
# message(STATUS "UnifySDK Sources: ${unifysdk_SOURCE_DIR}")
48+
# message(STATUS "UnifySDK Binaries: ${unifysdk_BINARY_DIR}")

0 commit comments

Comments
 (0)