forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.gn
378 lines (333 loc) · 12 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# Copyright (c) 2020 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/buildconfig_header.gni")
import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/platform/device.gni")
import("common_flags.gni")
import("icd/icd.gni")
declare_args() {
# Enable strict schema checks.
enable_im_pretty_print =
is_debug && (current_os == "linux" || current_os == "mac" ||
current_os == "ios" || current_os == "android")
# Logging verbosity control for Access Control implementation
#
# If set to > 0, it is desired to get additional logging on all
# access control checks for better debugging ability.
#
# If set to > 1, it is desired to log every single check
chip_access_control_policy_logging_verbosity = 0
if (is_debug && (current_os == "linux" || current_os == "mac")) {
chip_access_control_policy_logging_verbosity = 2
}
chip_enable_session_resumption = true
# 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.
chip_im_force_fabric_quota_check = false
enable_eventlist_attribute = false
# Allow building ota-requestor-app with a non-spec-compliant floor
# (i.e. smaller than 2 minutes) for action delays.
non_spec_compliant_ota_action_delay_floor = -1
# enable time sync client for use in `time-synchronization-server` (if linked)
# TODO: this should probably be migrated to be time-synchronization-server specific
# if the cluster build targets are decoupled as stand-alone units.
time_sync_enable_tsc_feature = 1
# Systems that can spare a bit of RAM for InteractionModelEngine/delegate
# pointers should do so (allows InteractionModelEngine decoupling and less usage
# of global pointers)
chip_im_static_global_interaction_model_engine =
current_os != "linux" && current_os != "mac" && current_os != "ios" &&
current_os != "android"
}
buildconfig_header("app_buildconfig") {
header = "AppBuildConfig.h"
header_dir = "app"
defines = [
"CHIP_CONFIG_IM_PRETTY_PRINT=${enable_im_pretty_print}",
"CHIP_CONFIG_IM_FORCE_FABRIC_QUOTA_CHECK=${chip_im_force_fabric_quota_check}",
"CHIP_CONFIG_ENABLE_SESSION_RESUMPTION=${chip_enable_session_resumption}",
"CHIP_CONFIG_ACCESS_CONTROL_POLICY_LOGGING_VERBOSITY=${chip_access_control_policy_logging_verbosity}",
"CHIP_CONFIG_PERSIST_SUBSCRIPTIONS=${chip_persist_subscriptions}",
"CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION=${chip_subscription_timeout_resumption}",
"CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE=${enable_eventlist_attribute}",
"CHIP_CONFIG_ENABLE_READ_CLIENT=${chip_enable_read_client}",
"CHIP_CONFIG_STATIC_GLOBAL_INTERACTION_MODEL_ENGINE=${chip_im_static_global_interaction_model_engine}",
"TIME_SYNC_ENABLE_TSC_FEATURE=${time_sync_enable_tsc_feature}",
"NON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR=${non_spec_compliant_ota_action_delay_floor}",
"CHIP_DEVICE_CONFIG_DYNAMIC_SERVER=${chip_build_controller_dynamic_server}",
"CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP=${chip_enable_busy_handling_for_operational_session_setup}",
]
visibility = [ ":app_config" ]
}
source_set("app_config") {
sources = [ "AppConfig.h" ]
deps = [ ":app_buildconfig" ]
}
source_set("paths") {
sources = [
"AttributePathParams.h",
"CommandPathParams.h",
"CommandPathRegistry.h",
"ConcreteAttributePath.h",
"ConcreteClusterPath.h",
"ConcreteCommandPath.h",
"ConcreteEventPath.h",
"DataVersionFilter.h",
"EventPathParams.h",
]
# This source sets also depends on basic-types.h that is not in any dependency we can use
public_deps = [
":app_config",
"${chip_root}/src/app/util:types",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/core:types",
]
}
source_set("global-attributes") {
sources = [ "GlobalAttributes.h" ]
# This also depends on zap-generated code which is currently impossible to split out
# as a dependency
public_deps = [
":app_config",
"${chip_root}/src/lib/support",
]
}
source_set("subscription-info-provider") {
sources = [ "SubscriptionsInfoProvider.h" ]
public_deps = [ "${chip_root}/src/lib/core" ]
}
config("config-controller-dynamic-server") {
defines = [
"CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1",
"CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=1",
]
}
source_set("constants") {
sources = [
"InteractionModelTimeout.h",
"SpecificationDefinedRevisions.h",
]
public_deps = [
"${chip_root}/src/lib/core",
"${chip_root}/src/system",
]
}
source_set("test-event-trigger") {
sources = [ "TestEventTriggerDelegate.h" ]
}
# 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
# which in tern depens on the interaction-model.
# Using source_set prevents the unit test to build correctly.
static_library("interaction-model") {
sources = [
"CASEClient.cpp",
"CASEClient.h",
"CASEClientPool.h",
"CASESessionManager.cpp",
"CASESessionManager.h",
"CommandSender.cpp",
"CommandSender.h",
"DeviceProxy.cpp",
"DeviceProxy.h",
"InteractionModelDelegatePointers.cpp",
"InteractionModelDelegatePointers.h",
"InteractionModelEngine.cpp",
"InteractionModelEngine.h",
"InteractionModelHelper.h",
"OperationalSessionSetup.cpp",
"OperationalSessionSetup.h",
"OperationalSessionSetupPool.h",
"PendingResponseTracker.h",
"PendingResponseTrackerImpl.cpp",
"PendingResponseTrackerImpl.h",
"ReadClient.h", # TODO: cpp is only included conditionally. Needs logic
# fixing
"ReadPrepareParams.h",
"RequiredPrivilege.h",
"StatusResponse.cpp",
"StatusResponse.h",
"SubscriptionResumptionStorage.h",
"TimedHandler.cpp",
"TimedHandler.h",
"TimedRequest.cpp",
"TimedRequest.h",
"WriteClient.cpp",
"WriteClient.h",
"reporting/Engine.cpp",
"reporting/Engine.h",
"reporting/ReportScheduler.h",
"reporting/ReportSchedulerImpl.cpp",
"reporting/ReportSchedulerImpl.h",
"reporting/SynchronizedReportSchedulerImpl.cpp",
"reporting/SynchronizedReportSchedulerImpl.h",
# TODO: reporting header is part of interaction-model, however actual implementation depends
# on generated code as subscriptions depend on attribute data versioning to determine
# when "data changed" reports should be sent.
#
# This breaks having `.h` and `.cpp` based off the same compilation unit and
# should ideally be cleaned up.
"reporting/reporting.h",
]
deps = [ "${chip_root}/src/app:events" ]
public_deps = [
":app_config",
":constants",
":paths",
":subscription-info-provider",
"${chip_root}/src/app/MessageDef",
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/app/icd/server:manager",
"${chip_root}/src/app/icd/server:observer",
"${chip_root}/src/app/util:af-types",
"${chip_root}/src/app/util:callbacks",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:static-support",
"${chip_root}/src/protocols/interaction_model",
"${chip_root}/src/protocols/secure_channel",
"${chip_root}/src/system",
]
public_configs = [ "${chip_root}/src:includes" ]
if (chip_enable_read_client) {
sources += [ "ReadClient.cpp" ]
}
if (chip_persist_subscriptions) {
sources += [
"SimpleSubscriptionResumptionStorage.cpp",
"SimpleSubscriptionResumptionStorage.h",
"SubscriptionResumptionSessionEstablisher.cpp",
"SubscriptionResumptionSessionEstablisher.h",
]
}
if (chip_build_controller_dynamic_server) {
sources += [
"clusters/ota-provider/ota-provider.cpp",
"dynamic_server/AccessControl.cpp",
"dynamic_server/AccessControl.h",
"dynamic_server/DynamicDispatcher.cpp",
"util/privilege-storage.cpp",
"util/privilege-storage.h",
]
public_deps += [
":global-attributes",
"${chip_root}/src/access",
"${chip_root}/src/app/dynamic_server:mock-codegen-includes",
]
public_configs += [ ":config-controller-dynamic-server" ]
}
}
source_set("events") {
sources = [
"EventHeader.h",
"EventLoggingDelegate.h",
"EventLoggingTypes.h",
]
deps = [
":paths",
"${chip_root}/src/access:types",
"${chip_root}/src/lib/core",
]
}
static_library("attribute-access") {
sources = [
"AttributeAccessInterface.h",
"AttributeAccessInterfaceCache.h",
"AttributeAccessInterfaceRegistry.cpp",
"AttributeAccessInterfaceRegistry.h",
"AttributeEncodeState.h",
"AttributeReportBuilder.cpp",
"AttributeReportBuilder.h",
"AttributeValueDecoder.h",
"AttributeValueEncoder.cpp",
"AttributeValueEncoder.h",
]
deps = [
":paths",
"${chip_root}/src/access:types",
"${chip_root}/src/app/MessageDef",
"${chip_root}/src/app/data-model",
"${chip_root}/src/app/util:af-types",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
]
}
# 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.
# 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.
static_library("app") {
output_name = "libCHIPDataModel"
sources = [
"AttributePathExpandIterator.cpp",
"AttributePathExpandIterator.h",
"AttributePersistenceProvider.h",
"ChunkedWriteCallback.cpp",
"ChunkedWriteCallback.h",
"CommandHandler.cpp",
"CommandHandlerExchangeInterface.h",
"CommandResponseHelper.h",
"CommandResponseSender.cpp",
"DefaultAttributePersistenceProvider.cpp",
"DefaultAttributePersistenceProvider.h",
"DeferredAttributePersistenceProvider.cpp",
"DeferredAttributePersistenceProvider.h",
"EventLogging.h",
"EventManagement.cpp",
"EventManagement.h",
"FailSafeContext.cpp",
"FailSafeContext.h",
"OTAUserConsentCommon.h",
"ReadHandler.cpp",
"SafeAttributePersistenceProvider.h",
"TimerDelegates.cpp",
"TimerDelegates.h",
"WriteHandler.cpp",
# TODO: the following items cannot be included due to interaction-model circularity
# (app depending on im and im including these headers):
# Name with _ so that linter does not recognize it
# "CommandResponseSender._h"
# "CommandHandler._h"
# "ReadHandler._h",
# "WriteHandler._h"
]
public_deps = [
":app_config",
":attribute-access",
":constants",
":global-attributes",
":interaction-model",
"${chip_root}/src/app/data-model",
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/app/util:callbacks",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
"${chip_root}/src/protocols/interaction_model",
"${chip_root}/src/system",
]
if (chip_enable_read_client) {
sources += [
"BufferedReadCallback.cpp",
"BufferedReadCallback.h",
"ClusterStateCache.cpp",
"ClusterStateCache.h",
]
}
if (chip_enable_icd_server) {
public_deps += [
"${chip_root}/src/app/icd/server:manager",
"${chip_root}/src/app/icd/server:notifier",
]
}
cflags = [ "-Wconversion" ]
public_configs = [ "${chip_root}/src:includes" ]
}