Skip to content

Commit fd51859

Browse files
committed
SWPROT-8953: Build zpc with uic as source dep on latest
Version 1.6.0 it not supported yet, but it can help to initiate the migration to next UnifySDK-1.7. Last-Update: 2025-01-21 Origin: #13 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent 0398441 commit fd51859

File tree

5 files changed

+68
-183
lines changed

5 files changed

+68
-183
lines changed

CMakeLists.txt

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,18 @@
11
cmake_minimum_required(VERSION 3.21)
2-
3-
# ##############################################################################
4-
# Modules
5-
# ##############################################################################
6-
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
7-
${CMAKE_MODULE_PATH})
8-
set(CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/"
9-
${CMAKE_INCLUDE_PATH})
2+
project(unify-z-wave)
103

114
# ##############################################################################
125
# Include Configurations
136
# ##############################################################################
14-
if(NOT CMAKE_BUILD_TYPE)
15-
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "default build type: Debug" FORCE)
16-
endif()
17-
18-
message(STATUS "Building Unify with BUILD_TYPE=${CMAKE_BUILD_TYPE}")
197

208
include(cmake/include/version.cmake)
219
include(cmake/include/build_permutations.cmake)
2210

23-
project(
24-
uic
25-
LANGUAGES C CXX
26-
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV})
27-
28-
# Set shared version string to use in filenames (deb packages etc.)
29-
set(FILE_NAME_VERSIONING "${CMAKE_PROJECT_VERSION}")
30-
if(VERSION_PATCH)
31-
string(APPEND FILE_NAME_VERSIONING "-${VERSION_PATCH}")
32-
endif()
33-
set(FILE_NAME_VERSIONING_ARCH
34-
"${FILE_NAME_VERSIONING}_${CMAKE_SYSTEM_PROCESSOR}")
35-
36-
include(cmake/include/zap.cmake)
37-
include(cmake/include/target_interface_libraries.cmake)
38-
include(cmake/include/compiler_options.cmake)
39-
include(cmake/include/compatible_platform.cmake)
40-
include(cmake/include/unittest.cmake)
41-
include(cmake/include/doxygen.cmake)
42-
include(cmake/include/package-helper.cmake)
43-
include(cmake/include/uic_helper.cmake)
44-
45-
if(BUILD_TESTING)
46-
include(components/testframework/target_add_unittest.cmake)
47-
endif()
48-
49-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
50-
set(CMAKE_INSTALL_PREFIX
51-
"/usr"
52-
CACHE PATH "default install path" FORCE)
53-
endif()
54-
55-
message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}")
56-
57-
##########
58-
# Python #
59-
##########
60-
find_package(Python3 REQUIRED)
61-
62-
########
63-
# Rust #
64-
########
65-
enable_language(Rust)
66-
set(RUST_MIN_VERSION 1.64)
67-
if(CMAKE_Rust_COMPILER_VERSION VERSION_LESS RUST_MIN_VERSION)
68-
message(
69-
FATAL_ERROR
70-
"Rust version is ${CMAKE_Rust_COMPILER_VERSION}, expect at least ${RUST_MIN_VERSION},
71-
please update using 'rustup update' or similar,
72-
see https://www.rust-lang.org/tools/install documentation for further details."
73-
)
11+
include(cmake/modules/FindUnifySDK.cmake)
12+
if(NOT DEFINED COMMON_LOCATION)
13+
set(COMMON_LOCATION "${UNIFYSDK_SOURCE_DIR}")
7414
endif()
7515

76-
include(CMakeCargo)
77-
7816
# ##############################################################################
7917
# Global includes
8018
# ##############################################################################
@@ -83,7 +21,6 @@ include_directories(include ${CMAKE_CURRENT_BINARY_DIR}/include)
8321
# ##############################################################################
8422
# Subdirectories
8523
# #############################################################################
86-
add_subdirectory(components)
8724
add_subdirectory(applications)
8825
include(cmake/include/package.cmake)
8926
include(cmake/include/version_file.cmake)

applications/CMakeLists.txt

Lines changed: 4 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,12 @@
1-
# Fetch dependencies if forced
2-
if(FETCH_GSDK MATCHES ON)
3-
find_package(GeckoSDK 2024.6.0 REQUIRED)
4-
endif()
5-
61
# Build options will determine if the applications will be included and build
72

8-
## Protocol Controllers
3+
if(NOT DEFINED BUILD_ZPC)
4+
set(BUILD_ZPC ON)
5+
endif()
6+
97
if(BUILD_ZPC MATCHES ON)
108
add_subdirectory(zpc)
119
message(STATUS "ZPC will build")
1210
else()
1311
message(STATUS "ZPC will NOT build")
1412
endif()
15-
16-
## Example applications/components
17-
if((BUILD_UIC_DEMO MATCHES ON) OR (BUILD_EPC MATCHES ON) OR (BUILD_EMD MATCHES ON))
18-
add_subdirectory(examples)
19-
message(STATUS "UIC Demo, Example MQTT Device (EMD) and/or EPC will build")
20-
else()
21-
message(STATUS "UIC Demo, Example MQTT Device (EMD) and/or EPC will NOT build")
22-
endif()
23-
24-
## IoT services
25-
if(BUILD_DEV_GUI MATCHES ON)
26-
add_subdirectory(dev_ui/dev_gui)
27-
message(STATUS "DevGui will build")
28-
else()
29-
message(STATUS "DevGui will NOT build")
30-
endif()
31-
32-
if(BUILD_UPVL MATCHES ON)
33-
message(STATUS "UPVL will build")
34-
add_subdirectory(upvl)
35-
else()
36-
message(STATUS "UPVL will NOT build")
37-
endif()
38-
39-
if(BUILD_GMS MATCHES ON)
40-
add_subdirectory(gms)
41-
message(STATUS "GMS will build")
42-
else()
43-
message(STATUS "GMS will NOT build")
44-
endif()
45-
46-
if(BUILD_IMAGE_PROVIDER MATCHES ON)
47-
add_subdirectory(image_provider)
48-
message(STATUS "Image provider will build")
49-
else()
50-
message(STATUS "Image provider will NOT build")
51-
endif()
52-
53-
54-
if(BUILD_NAL MATCHES ON)
55-
add_subdirectory(nal)
56-
message(STATUS "NAL will build")
57-
else()
58-
message(STATUS "NAL will NOT build")
59-
endif()
60-
61-
if(BUILD_UPTI_CAP MATCHES ON)
62-
add_subdirectory(upti_cap)
63-
message(STATUS "UPTI Cap will build")
64-
else()
65-
message(STATUS "UPTI Cap will NOT build")
66-
endif()
67-
68-
if(BUILD_UPTI_WRITER MATCHES ON)
69-
add_subdirectory(upti_writer)
70-
message(STATUS "UPTI Writer will build")
71-
else()
72-
message(STATUS "UPTI Writer will NOT build")
73-
endif()
74-
75-
if(NOT APPLE )
76-
if((BUILD_AOXPC MATCHES ON) OR (BUILD_POSITIONING MATCHES ON))
77-
add_subdirectory(aox)
78-
message(STATUS "AoX applications will build")
79-
else()
80-
message(STATUS "AoX applications will NOT build")
81-
endif()
82-
83-
84-
if(BUILD_CPCD MATCHES ON)
85-
add_subdirectory(cpcd)
86-
add_subdirectory(cpc-hci-bridge)
87-
add_subdirectory(bt_host_empty)
88-
message(STATUS "CPCd daemon and applications will build")
89-
else()
90-
message(STATUS "CPCd daemon and applications will NOT build")
91-
endif()
92-
93-
IF (BUILD_OTBR MATCHES ON)
94-
add_subdirectory(openthread_border_router)
95-
message(STATUS "OTBR application will build")
96-
else()
97-
message(STATUS "OTBR application will NOT build")
98-
endif()
99-
100-
if(BUILD_ZIGBEED MATCHES ON)
101-
add_subdirectory(zigbeed)
102-
message(STATUS "Zigbeed will build")
103-
else()
104-
message(STATUS "Zigbeed will NOT build")
105-
endif()
106-
107-
if(BUILD_ZIGPC MATCHES ON)
108-
add_subdirectory(zigpc)
109-
message(STATUS "ZigPC will build")
110-
else()
111-
message(STATUS "ZigPC will NOT build")
112-
endif()
113-
endif()

applications/zpc/CMakeLists.txt

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ include(${COMMON_PATH}/cmake/include/uic_helper.cmake)
2626
include(${COMMON_PATH}/cmake/include/compatible_platform.cmake)
2727
include(${COMMON_PATH}/cmake/include/compiler_options.cmake)
2828
include(${COMMON_PATH}/cmake/include/version.cmake)
29-
include(${COMMON_PATH}/cmake/include/doxygen.cmake)
29+
# include(${COMMON_PATH}/cmake/include/doxygen.cmake)
3030
include(${COMMON_PATH}/cmake/modules/CMakeCargo.cmake)
31-
include(${COMMON_PATH}/cmake/include/package-helper.cmake)
31+
# include(${COMMON_PATH}/cmake/include/package-helper.cmake)
3232
include(${COMMON_PATH}/cmake/include/zap.cmake)
3333
include(${COMMON_PATH}/cmake/include/unittest.cmake)
3434
include(${COMMON_PATH}/cmake/include/version_file.cmake)
3535

3636
set(DEFAULT_UNIFY-TESTFRAMEWORK_PATH
37-
${CMAKE_CURRENT_SOURCE_DIR}/../../components/testframework)
37+
${COMMON_PATH}/components/testframework)
3838
if(EXISTS ${UNIFY-TESTFRAMEWORK_LOCATION})
3939
set(UNIFY-TESTFRAMEWORK_PATH ${UNIFY-TESTFRAMEWORK_LOCATION})
4040
else()
@@ -49,6 +49,40 @@ endif()
4949
include(${UNIFY-TESTFRAMEWORK_PATH}/add_mock.cmake)
5050
include(${UNIFY-TESTFRAMEWORK_PATH}/target_add_unittest.cmake)
5151

52+
include_directories(
53+
include
54+
${COMMON_PATH}/components/uic_config/include/ # config.h
55+
${COMMON_PATH}/components/uic_gbl_interface/include/# uic_gbl_interface.h
56+
${COMMON_PATH}/components/uic_definitions/include/# uic_typedefs.h
57+
${COMMON_PATH}/components/uic_attribute_store/include/# attribute_store.h
58+
${COMMON_PATH}/components/uic_datastore/include/# datastore_attributes.h
59+
${COMMON_PATH}/components/unify_dotdot_attribute_store/zap-generated/include/# unify_dotdot_defined_attribute_types.h
60+
${COMMON_PATH}/components/uic_dotdot/zap-generated/include/# dotdot_cluster_id_definitions.h
61+
${COMMON_PATH}/components/uic_smartstart_management/include/# smartstart_management.hpp
62+
${COMMON_PATH}/components/uic_contiki/core/ # sys/ctimer.h
63+
${COMMON_PATH}/components/uic_contiki/platform/posix/ # contiki-conf.h
64+
${COMMON_PATH}/components/uic_attribute_resolver/include/# attribute_resolver.h
65+
${COMMON_PATH}/components/uic_contiki/core/sys/# clock.h
66+
${COMMON_PATH}/components/uic_main_fd/include/# uic_main_externals.h
67+
${COMMON_PATH}/components/unify_dotdot_attribute_store/include/# unify_dotdot_attribute_store_node_state.h
68+
${COMMON_PATH}/components/uic_dotdot_mqtt/zap-generated/include # dotdot_mqtt.h
69+
${COMMON_PATH}/components/uic_mqtt/include # uic_mqtt.h
70+
${COMMON_PATH}/components/unify_application_monitoring/include # unify_application_monitoring.h
71+
${COMMON_PATH}/components/uic_stdin/include/# uic_stdin.hpp
72+
${COMMON_PATH}/components/uic_ota/platform/posix/# ota_time.hpp
73+
${COMMON_PATH}/components/uic_attribute_mapper/include # attribute_mapper.h
74+
${COMMON_PATH}/components/uic_attribute_utils/include # attribute_timeouts.h
75+
${COMMON_PATH}/components/uic_ota/include # ota.hpp
76+
${COMMON_PATH}/components/uic_dotdot_mqtt/include # dotdot_mqtt_parsing_helpers.hpp
77+
${COMMON_PATH}/components/uic_main/include # uic_main.h
78+
${COMMON_PATH}/components/uic_contiki/include # request_poller.h
79+
${COMMON_PATH}/components/uic_rust/unify_middleware/include/ # rust_contiki_fixt.h
80+
)
81+
82+
link_directories(
83+
${UNIFYSDK_BINARY_DIR}/components # libunify.so
84+
${UNIFYSDK_BINARY_DIR}/components/uic_config # libuic_config_mock.a
85+
)
5286

5387
if(EXISTS ${LIBUNIFY_LOCATION})
5488
message(STATUS "Found libunify: ${LIBUNIFY_LOCATION}")

applications/zpc/components/zpc_rust/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
# Use libunify from dep
2+
3+
if(NOT DEFINED COMMON_LOCATION)
4+
set(COMMON_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../../../../_deps/unifysdk-src")
5+
endif()
6+
7+
# TODO: prefer https://cmake.org/cmake/help/latest/command/add_custom_target.html
8+
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
9+
${CMAKE_SOURCE_DIR}/components
10+
)
11+
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
12+
${COMMON_LOCATION}/components/uic_rust
13+
${CMAKE_SOURCE_DIR}/components/uic_rust
14+
)
15+
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
16+
${COMMON_LOCATION}/components/unify_attribute_poll
17+
${CMAKE_SOURCE_DIR}/components/unify_attribute_poll
18+
)
19+
120
cargo_build(NAME zpc_rust_build MANIFEST_PATH ${CMAKE_CURRENT_LIST_DIR}
221
DISABLE_TESTS)
322
cargo_as_cmake_target(zpc_rust_build zpc_rust)
423

24+
# TODO: include UNIFY_BINARY_DIR
25+
add_dependencies(zpc_rust unify)
26+
527
install(
628
FILES zwave_poll_config.yaml
729
DESTINATION share/uic
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
# Build options enabling different permutations and exluding unwanted software
22
# applications
3-
option(FETCH_GSDK "Force CMAKE to fetch Gecko SDK from GitHub" OFF)
4-
option(BUILD_ZIGPC "Package the ZIGPC" OFF)
53
option(BUILD_ZPC "Package the ZPC" ON)
64
option(BUILD_DEV_GUI "Package the developer GUI" OFF)
75
option(BUILD_UIC_DEMO "Package the Unify demo" OFF)
86
option(BUILD_UPVL "Package the UIC-UPVL" OFF)
97
option(BUILD_GMS "Package the UIC-GMS" OFF)
108
option(BUILD_IMAGE_PROVIDER "Build the UIC-IMAGE-PROVIDER" OFF)
11-
option(BUILD_AOXPC "Package the AOXPC" OFF)
12-
option(BUILD_POSITIONING "Package the Positioning Service" OFF)
139
option(BUILD_NAL "Package the Name and location service" OFF)
1410
option(BUILD_UPTI_CAP "Build the UIC-UPTI-CAP" OFF)
1511
option(BUILD_UPTI_WRITER "Build the UIC-UPTI-WRITER" OFF)
16-
option(BUILD_CPCD "Package CPCd" OFF)
17-
option(BUILD_ZIGBEED "Build Zigbeed" OFF)
18-
option(BUILD_OTBR "Build OpenThread Border Router" OFF)
1912
option(BUILD_MATTER_BRIDGE "Build the Matter Bridge" OFF)
2013
option(BUILD_EPC "Build EPC (Example Protocol Controller)" OFF)
21-
option(BUILD_EMD "Build EMD (Example MQTT Device)" OFF)
14+
option(BUILD_EED "Build EED (Emulated End Device)" OFF)

0 commit comments

Comments
 (0)