|
| 1 | +# |
| 2 | +# Copyright (c) 2023-2024 Project CHIP Authors |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +cmake_minimum_required(VERSION 3.13.1) |
| 17 | + |
| 18 | +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) |
| 19 | +get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) |
| 20 | +get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) |
| 21 | +get_filename_component(ALL_CLUSTERS_NXP_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/nxp/common REALPATH) |
| 22 | +get_filename_component(EXAMPLE_PLATFORM_NXP_COMMON_DIR ${CHIP_ROOT}/examples/platform/nxp/common REALPATH) |
| 23 | +get_filename_component(EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR ${CHIP_ROOT}/examples/platform/nxp/zephyr REALPATH) |
| 24 | + |
| 25 | +# Perform common operations like detecting extra overlays in the platform folder for the target board |
| 26 | +# This must be called before find_package(Zephyr) |
| 27 | +include(${CHIP_ROOT}/config/nxp/app/pre-zephyr.cmake) |
| 28 | + |
| 29 | +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nxp/chip-module) |
| 30 | +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) |
| 31 | + |
| 32 | +# -Wmaybe-uninitialized has too many false positives, including on std::optional |
| 33 | +# and chip::Optional. Make it nonfatal. |
| 34 | +# |
| 35 | +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 |
| 36 | +target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) |
| 37 | + |
| 38 | +project(chip-nxp-all-clusters-app-example) |
| 39 | + |
| 40 | +include(${CHIP_ROOT}/config/nxp/app/enable-gnu-std.cmake) |
| 41 | +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) |
| 42 | + |
| 43 | +target_include_directories(app |
| 44 | + PRIVATE |
| 45 | + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/include |
| 46 | + ${ALL_CLUSTERS_COMMON_DIR}/include |
| 47 | + ${GEN_DIR}/app-common |
| 48 | + ${GEN_DIR}/all-clusters-app |
| 49 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/include |
| 50 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/include |
| 51 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/include |
| 52 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/factory_data/include |
| 53 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/include |
| 54 | +) |
| 55 | + |
| 56 | +target_sources(app |
| 57 | + PRIVATE |
| 58 | + main/main.cpp |
| 59 | + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/AppTask.cpp |
| 60 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/source/CHIPDeviceManager.cpp |
| 61 | + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/DeviceCallbacks.cpp |
| 62 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/source/CommonDeviceCallbacks.cpp |
| 63 | + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/ZclCallbacks.cpp |
| 64 | + ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp |
| 65 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskBase.cpp |
| 66 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskZephyr.cpp |
| 67 | + ${EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR}/factory_data/source/AppFactoryDataExample.cpp |
| 68 | +) |
| 69 | + |
| 70 | +target_compile_definitions(app PUBLIC |
| 71 | + "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/zephyr/FactoryDataProviderImpl.h\"" |
| 72 | +) |
| 73 | + |
| 74 | +if(CONFIG_CHIP_OTA_REQUESTOR) |
| 75 | + target_sources(app PRIVATE |
| 76 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorCommon.cpp |
| 77 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorZephyr.cpp |
| 78 | + ) |
| 79 | + target_include_directories(app PRIVATE |
| 80 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/include/ |
| 81 | + ) |
| 82 | +endif() |
| 83 | + |
| 84 | +chip_configure_data_model(app |
| 85 | + INCLUDE_SERVER |
| 86 | + ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/all-clusters-app.zap |
| 87 | +) |
| 88 | + |
| 89 | +if(CONFIG_CHIP_LIB_SHELL) |
| 90 | + target_compile_definitions(app PRIVATE ENABLE_CHIP_SHELL) |
| 91 | + target_include_directories(app PRIVATE |
| 92 | + ${CHIP_ROOT}/examples/shell/shell_common/include |
| 93 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/include |
| 94 | + ) |
| 95 | + target_sources(app PRIVATE |
| 96 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIBase.cpp |
| 97 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIZephyr.cpp |
| 98 | + ${CHIP_ROOT}/examples/shell/shell_common/cmd_misc.cpp |
| 99 | + ${CHIP_ROOT}/examples/shell/shell_common/cmd_otcli.cpp |
| 100 | + ${CHIP_ROOT}/examples/shell/shell_common/cmd_server.cpp |
| 101 | + ) |
| 102 | +endif() |
| 103 | + |
| 104 | +target_sources(app |
| 105 | + PRIVATE |
| 106 | + ${ALL_CLUSTERS_COMMON_DIR}/src/smco-stub.cpp |
| 107 | + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-modes-manager.cpp |
| 108 | + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp |
| 109 | + ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp |
| 110 | + ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp |
| 111 | + ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp |
| 112 | + ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp |
| 113 | + ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp |
| 114 | + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/source/ICDUtil.cpp |
| 115 | +) |
0 commit comments