From fe40470f23d5776f3c393f75aad3dace61a9718a Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Fri, 4 Nov 2022 14:08:02 +0200 Subject: [PATCH] [Telink] use src/app/chip_data_model.cmake for data model inclusions (#23255) (#23466) Co-authored-by: Andrei Litvin Co-authored-by: Andrei Litvin --- .../light-switch-app/telink/CMakeLists.txt | 59 ++--------------- examples/lighting-app/telink/CMakeLists.txt | 65 +++---------------- .../ota-requestor-app/telink/CMakeLists.txt | 60 ++--------------- 3 files changed, 23 insertions(+), 161 deletions(-) diff --git a/examples/light-switch-app/telink/CMakeLists.txt b/examples/light-switch-app/telink/CMakeLists.txt index 36a2970bc76371..f47a79987c50b2 100755 --- a/examples/light-switch-app/telink/CMakeLists.txt +++ b/examples/light-switch-app/telink/CMakeLists.txt @@ -31,6 +31,7 @@ find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(chip-telink-light-switch-example) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) target_compile_options(app PRIVATE -fpermissive) @@ -46,7 +47,6 @@ add_definitions( "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" ) -# TODO - re-use chip_data_model.cmake to add cluster implementations. target_sources(app PRIVATE src/AppTask.cpp src/main.cpp @@ -56,57 +56,12 @@ target_sources(app PRIVATE ${GEN_DIR}/light-switch-app/zap-generated/IMClusterCommandHandler.cpp ${TELINK_COMMON}/util/src/LEDWidget.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp - ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp - ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp - ${CHIP_ROOT}/src/app/util/DataModelHandler.cpp - ${CHIP_ROOT}/src/app/util/af-event.cpp - ${CHIP_ROOT}/src/app/util/attribute-size-util.cpp - ${CHIP_ROOT}/src/app/util/attribute-storage.cpp - ${CHIP_ROOT}/src/app/util/attribute-table.cpp - ${CHIP_ROOT}/src/app/util/binding-table.cpp - ${CHIP_ROOT}/src/app/util/ember-compatibility-functions.cpp - ${CHIP_ROOT}/src/app/util/ember-print.cpp - ${CHIP_ROOT}/src/app/util/error-mapping.cpp - ${CHIP_ROOT}/src/app/util/message.cpp - ${CHIP_ROOT}/src/app/util/privilege-storage.cpp - ${CHIP_ROOT}/src/app/util/util.cpp - ${CHIP_ROOT}/src/app/server/EchoHandler.cpp - ${CHIP_ROOT}/src/app/server/Dnssd.cpp - ${CHIP_ROOT}/src/app/server/OnboardingCodesUtil.cpp - ${CHIP_ROOT}/src/app/server/Server.cpp - ${CHIP_ROOT}/src/app/server/CommissioningWindowManager.cpp - ${CHIP_ROOT}/src/app/clusters/access-control-server/access-control-server.cpp - ${CHIP_ROOT}/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp - ${CHIP_ROOT}/src/app/clusters/basic/basic.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/BindingManager.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/bindings.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/PendingNotificationMap.cpp - ${CHIP_ROOT}/src/app/clusters/descriptor/descriptor.cpp - ${CHIP_ROOT}/src/app/clusters/identify-server/identify-server.cpp - ${CHIP_ROOT}/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp - ${CHIP_ROOT}/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp - ${CHIP_ROOT}/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp - ${CHIP_ROOT}/src/app/clusters/fixed-label-server/fixed-label-server.cpp - ${CHIP_ROOT}/src/app/clusters/user-label-server/user-label-server.cpp - ${CHIP_ROOT}/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/switch-server/switch-server.cpp - ${CHIP_ROOT}/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp - ${CHIP_ROOT}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp - ${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp - ${CHIP_ROOT}/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp - ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/ota-requestor-server.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp - ${CHIP_ROOT}/src/app/clusters/groups-server/groups-server.cpp - ) + ${TELINK_COMMON}/util/src/ThreadUtil.cpp) + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../light-switch-common/light-switch-app.zap +) if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp) diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index bad40aedef8a8e..e1e5c38f48d9ea 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2022 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(chip-telink-lighting-example) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) target_compile_options(app PRIVATE -fpermissive) @@ -46,7 +47,6 @@ add_definitions( "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" ) -# TODO - re-use chip_data_model.cmake to add cluster implementations. target_sources(app PRIVATE src/AppTask.cpp src/LightingManager.cpp @@ -56,60 +56,13 @@ target_sources(app PRIVATE ${GEN_DIR}/lighting-app/zap-generated/IMClusterCommandHandler.cpp ${TELINK_COMMON}/util/src/LEDWidget.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp - ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp - ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp - ${CHIP_ROOT}/src/app/util/DataModelHandler.cpp - ${CHIP_ROOT}/src/app/util/af-event.cpp - ${CHIP_ROOT}/src/app/util/attribute-size-util.cpp - ${CHIP_ROOT}/src/app/util/attribute-storage.cpp - ${CHIP_ROOT}/src/app/util/attribute-table.cpp - ${CHIP_ROOT}/src/app/util/binding-table.cpp - ${CHIP_ROOT}/src/app/util/ember-compatibility-functions.cpp - ${CHIP_ROOT}/src/app/util/ember-print.cpp - ${CHIP_ROOT}/src/app/util/error-mapping.cpp - ${CHIP_ROOT}/src/app/util/message.cpp - ${CHIP_ROOT}/src/app/util/privilege-storage.cpp - ${CHIP_ROOT}/src/app/util/util.cpp - ${CHIP_ROOT}/src/app/server/EchoHandler.cpp - ${CHIP_ROOT}/src/app/server/Dnssd.cpp - ${CHIP_ROOT}/src/app/server/OnboardingCodesUtil.cpp - ${CHIP_ROOT}/src/app/server/Server.cpp - ${CHIP_ROOT}/src/app/server/CommissioningWindowManager.cpp - ${CHIP_ROOT}/src/app/clusters/access-control-server/access-control-server.cpp - ${CHIP_ROOT}/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp - ${CHIP_ROOT}/src/app/clusters/basic/basic.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/BindingManager.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/bindings.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/PendingNotificationMap.cpp - ${CHIP_ROOT}/src/app/clusters/descriptor/descriptor.cpp - ${CHIP_ROOT}/src/app/clusters/identify-server/identify-server.cpp - ${CHIP_ROOT}/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp - ${CHIP_ROOT}/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp - ${CHIP_ROOT}/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp - ${CHIP_ROOT}/src/app/clusters/fixed-label-server/fixed-label-server.cpp - ${CHIP_ROOT}/src/app/clusters/user-label-server/user-label-server.cpp - ${CHIP_ROOT}/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/switch-server/switch-server.cpp - ${CHIP_ROOT}/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp - ${CHIP_ROOT}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp - ${CHIP_ROOT}/src/app/clusters/on-off-server/on-off-server.cpp - ${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp - ${CHIP_ROOT}/src/app/clusters/level-control/level-control.cpp - ${CHIP_ROOT}/src/app/clusters/color-control-server/color-control-server.cpp - ${CHIP_ROOT}/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp - ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/ota-requestor-server.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp - ${CHIP_ROOT}/src/app/clusters/groups-server/groups-server.cpp - ) + ${TELINK_COMMON}/util/src/ThreadUtil.cpp) + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lighting-common/lighting-app.zap + GEN_DIR ${GEN_DIR}/lighting-app/zap-generated +) if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp) diff --git a/examples/ota-requestor-app/telink/CMakeLists.txt b/examples/ota-requestor-app/telink/CMakeLists.txt index c602b75b7bffb7..6efbc5ec434465 100644 --- a/examples/ota-requestor-app/telink/CMakeLists.txt +++ b/examples/ota-requestor-app/telink/CMakeLists.txt @@ -31,6 +31,7 @@ find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(chip-telink-ota-requestor-example) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) target_compile_options(app PRIVATE -fpermissive) @@ -46,7 +47,6 @@ add_definitions( "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" ) -# TODO - re-use chip_data_model.cmake to add cluster implementations. target_sources(app PRIVATE src/AppTask.cpp src/main.cpp @@ -55,58 +55,12 @@ target_sources(app PRIVATE ${GEN_DIR}/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp ${TELINK_COMMON}/util/src/LEDWidget.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp - ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp - ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp - ${CHIP_ROOT}/src/app/util/DataModelHandler.cpp - ${CHIP_ROOT}/src/app/util/af-event.cpp - ${CHIP_ROOT}/src/app/util/attribute-size-util.cpp - ${CHIP_ROOT}/src/app/util/attribute-storage.cpp - ${CHIP_ROOT}/src/app/util/attribute-table.cpp - ${CHIP_ROOT}/src/app/util/binding-table.cpp - ${CHIP_ROOT}/src/app/util/ember-compatibility-functions.cpp - ${CHIP_ROOT}/src/app/util/ember-print.cpp - ${CHIP_ROOT}/src/app/util/error-mapping.cpp - ${CHIP_ROOT}/src/app/util/message.cpp - ${CHIP_ROOT}/src/app/util/privilege-storage.cpp - ${CHIP_ROOT}/src/app/util/util.cpp - ${CHIP_ROOT}/src/app/server/EchoHandler.cpp - ${CHIP_ROOT}/src/app/server/Dnssd.cpp - ${CHIP_ROOT}/src/app/server/OnboardingCodesUtil.cpp - ${CHIP_ROOT}/src/app/server/Server.cpp - ${CHIP_ROOT}/src/app/server/CommissioningWindowManager.cpp - ${CHIP_ROOT}/src/app/clusters/access-control-server/access-control-server.cpp - ${CHIP_ROOT}/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp - ${CHIP_ROOT}/src/app/clusters/basic/basic.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/BindingManager.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/bindings.cpp - ${CHIP_ROOT}/src/app/clusters/bindings/PendingNotificationMap.cpp - ${CHIP_ROOT}/src/app/clusters/descriptor/descriptor.cpp - ${CHIP_ROOT}/src/app/clusters/identify-server/identify-server.cpp - ${CHIP_ROOT}/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp - ${CHIP_ROOT}/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp - ${CHIP_ROOT}/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp - ${CHIP_ROOT}/src/app/clusters/fixed-label-server/fixed-label-server.cpp - ${CHIP_ROOT}/src/app/clusters/user-label-server/user-label-server.cpp - ${CHIP_ROOT}/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/switch-server/switch-server.cpp - ${CHIP_ROOT}/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp - ${CHIP_ROOT}/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp - ${CHIP_ROOT}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp - ${CHIP_ROOT}/src/app/clusters/on-off-server/on-off-server.cpp - ${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp - ${CHIP_ROOT}/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp - ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/ota-requestor-server.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp - ${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp - ${CHIP_ROOT}/src/app/clusters/groups-server/groups-server.cpp - ) + ${TELINK_COMMON}/util/src/ThreadUtil.cpp) + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../ota-requestor-common/ota-requestor-app.zap +) if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp)