blob: 84540e97892e6abc10a4fc1b0f514f374a94f205 [file] [log] [blame]
Michael Spangefa630b2020-07-08 22:23:08 -04001# Copyright (c) 2020 Project CHIP Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("//build_overrides/chip.gni")
Michael Spange00eac32021-06-21 17:25:47 -040016import("${chip_root}/build/chip/buildconfig_header.gni")
yunhanw-googlef4735792023-10-24 20:42:50 -070017import("${chip_root}/src/lib/core/core.gni")
yunhanw-google6e3d0452023-09-15 19:32:28 -070018import("${chip_root}/src/platform/device.gni")
Song Guoa77a6622021-01-29 13:13:02 +080019import("common_flags.gni")
mkardous-silabs98282932023-06-05 14:13:46 -040020import("icd/icd.gni")
Michael Spangefa630b2020-07-08 22:23:08 -040021
yunhanw-googled644bb02021-04-13 07:26:17 -070022declare_args() {
23 # Enable strict schema checks.
yunhanw-google751d0dd2022-11-16 19:09:58 -080024 enable_im_pretty_print =
Boris Zbarskyc17d7232022-09-09 12:56:27 -040025 is_debug && (current_os == "linux" || current_os == "mac" ||
26 current_os == "ios" || current_os == "android")
Tennessee Carmel-Veilleux085acd02022-04-13 23:42:22 -040027
28 # Logging verbosity control for Access Control implementation
29 #
30 # If set to > 0, it is desired to get additional logging on all
31 # access control checks for better debugging ability.
32 #
33 # If set to > 1, it is desired to log every single check
34 chip_access_control_policy_logging_verbosity = 0
35 if (is_debug && (current_os == "linux" || current_os == "mac")) {
36 chip_access_control_policy_logging_verbosity = 2
37 }
38
Zang MingJie7dede202022-04-06 11:54:50 +080039 chip_enable_session_resumption = true
Song GUO077e44e2022-04-25 10:16:30 +080040
41 # By default, the resources used by each fabric is unlimited if they are allocated on heap. This flag is for checking the resource usage even when they are allocated on heap to increase code coverage in integration tests.
42 chip_im_force_fabric_quota_check = false
Evgeny Margolisb89e83b2023-02-24 18:20:02 -100043
Andrei Litvin7baabb72023-07-28 13:47:45 -040044 enable_eventlist_attribute = false
yunhanw-googled644bb02021-04-13 07:26:17 -070045}
46
Michael Spange00eac32021-06-21 17:25:47 -040047buildconfig_header("app_buildconfig") {
48 header = "AppBuildConfig.h"
49 header_dir = "app"
50
Zang MingJie7dede202022-04-06 11:54:50 +080051 defines = [
yunhanw-google751d0dd2022-11-16 19:09:58 -080052 "CHIP_CONFIG_IM_PRETTY_PRINT=${enable_im_pretty_print}",
Song GUO077e44e2022-04-25 10:16:30 +080053 "CHIP_CONFIG_IM_FORCE_FABRIC_QUOTA_CHECK=${chip_im_force_fabric_quota_check}",
Zang MingJie7dede202022-04-06 11:54:50 +080054 "CHIP_CONFIG_ENABLE_SESSION_RESUMPTION=${chip_enable_session_resumption}",
Tennessee Carmel-Veilleux085acd02022-04-13 23:42:22 -040055 "CHIP_CONFIG_ACCESS_CONTROL_POLICY_LOGGING_VERBOSITY=${chip_access_control_policy_logging_verbosity}",
Jeff Tung19cb1a52023-01-26 05:56:05 -080056 "CHIP_CONFIG_PERSIST_SUBSCRIPTIONS=${chip_persist_subscriptions}",
Jeff Tungc1ec2d72023-07-22 10:33:06 -070057 "CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION=${chip_subscription_timeout_resumption}",
Evgeny Margolisb89e83b2023-02-24 18:20:02 -100058 "CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE=${enable_eventlist_attribute}",
Wang Qixiang14bdc242023-08-04 13:04:55 +080059 "CHIP_CONFIG_ENABLE_READ_CLIENT=${chip_enable_read_client}",
Zang MingJie7dede202022-04-06 11:54:50 +080060 ]
Michael Spangc6b6fb32023-11-17 02:21:20 -050061
62 visibility = [ ":app_config" ]
Michael Spangefa630b2020-07-08 22:23:08 -040063}
64
mkardous-silabsb8db5ee2024-01-25 15:05:17 -050065source_set("app_config") {
66 sources = [ "AppConfig.h" ]
67
68 deps = [ ":app_buildconfig" ]
69}
70
Terence Hampson4460db12023-11-15 11:21:03 -050071source_set("revision_info") {
72 sources = [
73 "DataModelRevision.h",
74 "InteractionModelRevision.h",
75 "SpecificationVersion.h",
76 ]
77}
78
mkardous-silabsb8db5ee2024-01-25 15:05:17 -050079source_set("paths") {
80 sources = [
81 "AttributePathParams.h",
82 "ConcreteClusterPath.h",
83 "ConcreteEventPath.h",
84 "DataVersionFilter.h",
85 "EventPathParams.h",
86 ]
Daniel Nicoara641e3ad2022-07-25 15:32:03 -040087
mkardous-silabsb8db5ee2024-01-25 15:05:17 -050088 # This source sets also depends on basic-types.h that is not in any dependency we can use
89 public_deps = [
90 ":app_config",
91 "${chip_root}/src/lib/core",
Andrei Litvinb389c602024-02-01 00:25:59 -050092 "${chip_root}/src/lib/core:types",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -050093 ]
Daniel Nicoara641e3ad2022-07-25 15:32:03 -040094}
95
mkardous-silabsb8db5ee2024-01-25 15:05:17 -050096source_set("global-attributes") {
97 sources = [ "GlobalAttributes.h" ]
Michael Spangefa630b2020-07-08 22:23:08 -040098
Andrei Litvincfd15512024-02-01 03:57:55 -050099 # This also depends on zap-generated code which is currently impossible to split out
100 # as a dependency
101 public_deps = [
102 ":app_config",
103 "${chip_root}/src/lib/support",
104 ]
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500105}
106
mkardous-silabsd61bfd62024-01-30 17:50:01 -0500107source_set("subscription-manager") {
mkardous-silabs95263182024-01-31 23:17:45 -0500108 sources = [ "SubscriptionsInfoProvider.h" ]
mkardous-silabsd61bfd62024-01-30 17:50:01 -0500109
110 public_deps = [ "${chip_root}/src/lib/core" ]
111}
112
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500113config("config-controller-dynamic-server") {
114 defines = [
115 "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1",
116 "CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=1",
117 ]
118}
119
120# interaction-model is a static-library because it currently requires global functions (app/util/...) that are stubbed in different test files that depend on the app static_library
121# which in tern depens on the interaction-model.
122# Using source_set prevents the unit test to build correctly.
123static_library("interaction-model") {
124 sources = [
125 "CASEClient.cpp",
126 "CASEClient.h",
127 "CASEClientPool.h",
128 "CASESessionManager.cpp",
129 "CASESessionManager.h",
130 "DeviceProxy.cpp",
131 "DeviceProxy.h",
132 "InteractionModelEngine.cpp",
133 "InteractionModelEngine.h",
134 "InteractionModelTimeout.h",
Terence Hampsonb6859d72022-08-05 13:48:11 -0400135 "OperationalSessionSetup.cpp",
136 "OperationalSessionSetup.h",
137 "OperationalSessionSetupPool.h",
Marc Lepage2c4de1b2022-01-27 13:25:46 -0500138 "RequiredPrivilege.cpp",
139 "RequiredPrivilege.h",
yunhanw-googleb5dbad12021-11-16 16:46:37 -0800140 "StatusResponse.cpp",
141 "StatusResponse.h",
Jeff Tung37919a12023-01-20 17:58:51 -0800142 "SubscriptionResumptionStorage.h",
Boris Zbarskyffee2a92021-12-01 14:34:57 -0500143 "TimedHandler.cpp",
144 "TimedHandler.h",
yunhanw-googlededd3d02021-04-08 05:51:34 -0700145 "reporting/Engine.cpp",
Michael Spanga08f8262021-04-23 18:06:20 -0400146 "reporting/Engine.h",
lpbeliveau-silabsedbdf8a2023-07-13 12:20:44 -0400147 "reporting/ReportScheduler.h",
148 "reporting/ReportSchedulerImpl.cpp",
149 "reporting/ReportSchedulerImpl.h",
lpbeliveau-silabsd44f7892023-07-19 18:17:12 -0400150 "reporting/SynchronizedReportSchedulerImpl.cpp",
151 "reporting/SynchronizedReportSchedulerImpl.h",
Boris Zbarsky95d337c2022-11-18 01:30:16 -0500152 "reporting/reporting.h",
Michael Spangefa630b2020-07-08 22:23:08 -0400153 ]
154
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500155 public_deps = [
156 ":app_config",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500157 ":paths",
mkardous-silabsd61bfd62024-01-30 17:50:01 -0500158 ":subscription-manager",
Andrei Litvin0ba1b7c2024-02-06 21:16:00 -0500159 "${chip_root}/src/app/MessageDef",
mkardous-silabs5f955f42024-01-30 20:52:28 -0500160 "${chip_root}/src/app/icd/server:icd-server-config",
161 "${chip_root}/src/app/icd/server:observer",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500162 "${chip_root}/src/lib/address_resolve",
163 "${chip_root}/src/lib/support",
164 "${chip_root}/src/protocols/interaction_model",
165 "${chip_root}/src/protocols/secure_channel",
166 "${chip_root}/src/system",
167 ]
168
169 public_configs = [ "${chip_root}/src:includes" ]
170
Jeff Tung19cb1a52023-01-26 05:56:05 -0800171 if (chip_persist_subscriptions) {
172 sources += [
173 "SimpleSubscriptionResumptionStorage.cpp",
174 "SimpleSubscriptionResumptionStorage.h",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500175 "SubscriptionResumptionSessionEstablisher.cpp",
176 "SubscriptionResumptionSessionEstablisher.h",
Jeff Tung19cb1a52023-01-26 05:56:05 -0800177 ]
178 }
179
yunhanw-google6e3d0452023-09-15 19:32:28 -0700180 if (chip_build_controller_dynamic_server) {
yunhanw-google6e3d0452023-09-15 19:32:28 -0700181 sources += [
182 "clusters/ota-provider/ota-provider.cpp",
183 "dynamic_server/AccessControl.cpp",
184 "dynamic_server/AccessControl.h",
185 "dynamic_server/DynamicDispatcher.cpp",
186 "util/privilege-storage.cpp",
187 "util/privilege-storage.h",
188 ]
yunhanw-google6e3d0452023-09-15 19:32:28 -0700189
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500190 public_deps += [
191 ":global-attributes",
192 "${chip_root}/src/access",
Wang Qixiang371756b2024-01-05 04:46:39 +0800193 ]
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500194
195 public_configs += [ ":config-controller-dynamic-server" ]
Wang Qixiang371756b2024-01-05 04:46:39 +0800196 }
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500197}
198
199# Note to developpers, instead of continuously adding files in the app librabry, it is recommand to create smaller source_sets that app can depend on.
200# This way, we can have a better understanding of dependencies and other componenets can depend on the different source_sets without needing to depend on the entire app library.
201static_library("app") {
202 output_name = "libCHIPDataModel"
203
204 sources = [
205 "AttributeAccessInterface.cpp",
206 "AttributePathExpandIterator.cpp",
207 "AttributePathExpandIterator.h",
208 "AttributePersistenceProvider.h",
209 "ChunkedWriteCallback.cpp",
210 "ChunkedWriteCallback.h",
211 "CommandHandler.cpp",
212 "CommandResponseHelper.h",
213 "CommandResponseSender.cpp",
214 "CommandSender.cpp",
215 "DefaultAttributePersistenceProvider.cpp",
216 "DefaultAttributePersistenceProvider.h",
217 "DeferredAttributePersistenceProvider.cpp",
218 "DeferredAttributePersistenceProvider.h",
219 "EventManagement.cpp",
220 "FailSafeContext.cpp",
221 "FailSafeContext.h",
222 "OTAUserConsentCommon.h",
223 "ReadHandler.cpp",
224 "SafeAttributePersistenceProvider.h",
225 "TimedRequest.cpp",
226 "TimedRequest.h",
227 "TimerDelegates.cpp",
228 "TimerDelegates.h",
229 "WriteClient.cpp",
230 "WriteHandler.cpp",
231 ]
232
233 public_deps = [
234 ":app_config",
235 ":global-attributes",
236 ":interaction-model",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500237 ":revision_info",
Andrei Litvinaa67fba2024-02-01 12:55:50 -0500238 "${chip_root}/src/app/data-model",
mkardous-silabs5f955f42024-01-30 20:52:28 -0500239 "${chip_root}/src/app/icd/server:icd-server-config",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500240 "${chip_root}/src/lib/address_resolve",
241 "${chip_root}/src/lib/support",
242 "${chip_root}/src/messaging",
243 "${chip_root}/src/protocols/interaction_model",
244 "${chip_root}/src/system",
mkardous-silabsb8db5ee2024-01-25 15:05:17 -0500245 ]
Wang Qixiang371756b2024-01-05 04:46:39 +0800246
Wang Qixiang14bdc242023-08-04 13:04:55 +0800247 if (chip_enable_read_client) {
248 sources += [
249 "BufferedReadCallback.cpp",
250 "ClusterStateCache.cpp",
251 "ClusterStateCache.h",
252 "ReadClient.cpp",
253 ]
254 }
255
mkardous-silabs98282932023-06-05 14:13:46 -0400256 if (chip_enable_icd_server) {
mkardous-silabsa9d5b1a2023-11-28 12:50:44 -0500257 public_deps += [
mkardous-silabs5f955f42024-01-30 20:52:28 -0500258 "${chip_root}/src/app/icd/server:manager",
259 "${chip_root}/src/app/icd/server:notifier",
mkardous-silabsa9d5b1a2023-11-28 12:50:44 -0500260 ]
mkardous-silabs98282932023-06-05 14:13:46 -0400261 }
262
Boris Zbarsky46c78302020-09-24 15:57:57 -0400263 cflags = [ "-Wconversion" ]
264
Michael Spange00eac32021-06-21 17:25:47 -0400265 public_configs = [ "${chip_root}/src:includes" ]
Michael Spangefa630b2020-07-08 22:23:08 -0400266}