Skip to content

Commit

Permalink
Add chip_configure_data_model to lock-app and lighting-app cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
ATmobica committed Jan 19, 2022
1 parent 79638a7 commit c026679
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 110 deletions.
75 changes: 17 additions & 58 deletions examples/lighting-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
cmake_minimum_required(VERSION 3.19.0)

get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH)
get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH)
get_filename_component(MBED_COMMON ${CHIP_ROOT}/examples/platform/mbed REALPATH)
get_filename_component(LIGHTING_COMMON ${CHIP_ROOT}/examples/lighting-app/lighting-common REALPATH)
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH)
get_filename_component(NLIO_ROOT ${CHIP_ROOT}/third_party/nlio/repo/include REALPATH)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.in
Expand All @@ -19,6 +20,7 @@ set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
set(APP_TARGET chip-mbed-lighting-app-example)

include(${MBED_PATH}/tools/cmake/app.cmake)
include(${CHIP_ROOT}/src/app/chip_data_model.cmake)

project(${APP_TARGET})

Expand All @@ -32,73 +34,30 @@ add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
mbed_configure_app_target(${APP_TARGET})

target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/main/include/
${APP_ROOT}/lighting-common
main/include/
${LIGHTING_COMMON}
${MBED_COMMON}/util/include
${GEN_DIR}/app-common
${GEN_DIR}/lighting-app
${CHIP_ROOT}/src/app
${CHIP_ROOT}/third_party/nlio/repo/include
${NLIO_ROOT}
)

# TODO - re-use chip_data_model.cmake to add cluster implementations.
target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/AppTask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/LightingManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/ZclCallbacks.cpp
main/AppTask.cpp
main/LightingManager.cpp
main/main.cpp
main/ZclCallbacks.cpp
${GEN_DIR}/lighting-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lighting-app/zap-generated/IMClusterCommandHandler.cpp
${MBED_COMMON}/util/LEDWidget.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/af-main-common.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/chip-message-send.cpp
${CHIP_ROOT}/src/app/util/client-api.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/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/administrator-commissioning-server/administrator-commissioning-server.cpp
${CHIP_ROOT}/src/app/clusters/basic/basic.cpp
${CHIP_ROOT}/src/app/clusters/bindings/bindings.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/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-old/network-commissioning-ember.cpp
${CHIP_ROOT}/src/app/clusters/network-commissioning-old/network-commissioning-old.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/OTARequestor.cpp
)

chip_configure_data_model(${APP_TARGET}
INCLUDE_CLIENT_CALLBACKS
INCLUDE_SERVER
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lighting-common/lighting-app.zap
GEN_DIR ${GEN_DIR}/lighting-app/zap-generated
)

target_link_libraries(${APP_TARGET} mbed-os-posix-socket mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
Expand Down
66 changes: 14 additions & 52 deletions examples/lock-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
cmake_minimum_required(VERSION 3.19.0)

get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH)
get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH)
get_filename_component(MBED_COMMON ${CHIP_ROOT}/examples/platform/mbed REALPATH)
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH)
get_filename_component(NLIO_ROOT ${CHIP_ROOT}/third_party/nlio/repo/include REALPATH)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.in
Expand All @@ -19,6 +19,7 @@ set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
set(APP_TARGET chip-mbed-lock-app-example)

include(${MBED_PATH}/tools/cmake/app.cmake)
include(${CHIP_ROOT}/src/app/chip_data_model.cmake)

project(${APP_TARGET})

Expand All @@ -32,65 +33,26 @@ add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
mbed_configure_app_target(${APP_TARGET})

target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/main/include/
${MBED_COMMON}/util/include
${CHIP_ROOT}/src/app
${CHIP_ROOT}/third_party/nlio/repo/include
main/include/
${GEN_DIR}/app-common
${GEN_DIR}/lock-app
${NLIO_ROOT}
${MBED_COMMON}/util/include
)

target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/AppTask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/BoltLockManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/ZclCallbacks.cpp
main/AppTask.cpp
main/BoltLockManager.cpp
main/main.cpp
main/ZclCallbacks.cpp
${GEN_DIR}/lock-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lock-app/zap-generated/IMClusterCommandHandler.cpp
${MBED_COMMON}/util/LEDWidget.cpp
${CHIP_ROOT}/src/app/util/DataModelHandler.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/af-event.cpp
${CHIP_ROOT}/src/app/util/af-main-common.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/chip-message-send.cpp
${CHIP_ROOT}/src/app/util/client-api.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/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/administrator-commissioning-server/administrator-commissioning-server.cpp
${CHIP_ROOT}/src/app/clusters/basic/basic.cpp
${CHIP_ROOT}/src/app/clusters/bindings/bindings.cpp
${CHIP_ROOT}/src/app/clusters/descriptor/descriptor.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/fixed-label-server/fixed-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/network-commissioning-old/network-commissioning-ember.cpp
${CHIP_ROOT}/src/app/clusters/network-commissioning-old/network-commissioning-old.cpp
${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp
${CHIP_ROOT}/src/app/clusters/on-off-server/on-off-server.cpp
${CHIP_ROOT}/src/app/clusters/power-source-configuration-server/power-source-configuration-server.cpp
${CHIP_ROOT}/src/app/clusters/user-label-server/user-label-server.cpp
)

chip_configure_data_model(${APP_TARGET}
INCLUDE_SERVER
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lock-common/lock-app.zap
)

target_link_libraries(${APP_TARGET} mbed-os-posix-socket mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
Expand Down

0 comments on commit c026679

Please sign in to comment.