-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
chip_data_model.gni
182 lines (160 loc) · 6.41 KB
/
chip_data_model.gni
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
# Copyright (c) 2021 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}/src/lib/core/core.gni")
_app_root = get_path_info(".", "abspath")
_zap_cluster_list_script = get_path_info("zap_cluster_list.py", "abspath")
# Defines a source_set for CHIP data model.
#
# Arguments:
# zap_pregenerated_dir
# Path to the ZAP "gen" dir.
#
# zap_file
# Names of ZAP source file.
#
# cluster_sources
# Names of the clusters directories to compile.
# Deprecated, specify zap_file instead.
#
# remove_cluster_sources
# Names of the cluster directories to remove.
# TODO - Remove this option once everything compiles.
#
# use_default_client_callbacks
# Include CHIPClientCallbacks.cpp.
#
# Forwards all the remaining variables to the source_set.
#
template("chip_data_model") {
_data_model_name = target_name
config("${_data_model_name}_config") {
include_dirs = []
if (defined(invoker.zap_pregenerated_dir)) {
include_dirs += [ "${invoker.zap_pregenerated_dir}/.." ]
}
}
_use_default_client_callbacks =
defined(invoker.use_default_client_callbacks) &&
invoker.use_default_client_callbacks
source_set(_data_model_name) {
forward_variables_from(invoker,
"*",
[
"zap_pregenerated_dir",
"cluster_sources",
"remove_cluster_sources",
"zap_file",
"use_default_client_callbacks",
])
if (!defined(sources)) {
sources = []
}
sources += [
"${_app_root}/clusters/barrier-control-server/barrier-control-server.h",
"${_app_root}/clusters/basic/basic.h",
"${_app_root}/clusters/color-control-server/color-control-server.h",
"${_app_root}/clusters/door-lock-server/door-lock-server.h",
"${_app_root}/clusters/groups-server/groups-server.h",
"${_app_root}/clusters/ias-zone-client/ias-zone-client.h",
"${_app_root}/clusters/ias-zone-server/ias-zone-server-tokens.h",
"${_app_root}/clusters/ias-zone-server/ias-zone-server.h",
"${_app_root}/clusters/identify/identify.h",
"${_app_root}/clusters/level-control/level-control.h",
"${_app_root}/clusters/messaging-client/messaging-client.h",
"${_app_root}/clusters/messaging-server/messaging-server.h",
"${_app_root}/clusters/network-commissioning/network-commissioning.h",
"${_app_root}/clusters/on-off-server/on-off-server.h",
"${_app_root}/clusters/scenes-client/scenes-client.h",
"${_app_root}/clusters/scenes/scenes-tokens.h",
"${_app_root}/clusters/scenes/scenes.h",
"${_app_root}/clusters/temperature-measurement-server/temperature-measurement-server.h",
"${_app_root}/clusters/zll-level-control-server/zll-level-control-server.h",
"${_app_root}/clusters/zll-on-off-server/zll-on-off-server.h",
"${_app_root}/clusters/zll-scenes-server/zll-scenes-server.h",
"${_app_root}/reporting/reporting-default-configuration.cpp",
"${_app_root}/reporting/reporting.cpp",
"${_app_root}/server/DataModelHandler.cpp",
"${_app_root}/util/af-event.cpp",
"${_app_root}/util/af-main-common.cpp",
"${_app_root}/util/attribute-size.cpp",
"${_app_root}/util/attribute-storage.cpp",
"${_app_root}/util/attribute-table.cpp",
"${_app_root}/util/binding-table.cpp",
"${_app_root}/util/chip-message-send.cpp",
"${_app_root}/util/client-api.cpp",
"${_app_root}/util/ember-compatibility-functions.cpp",
"${_app_root}/util/ember-print.cpp",
"${_app_root}/util/message.cpp",
"${_app_root}/util/process-cluster-message.cpp",
"${_app_root}/util/process-global-message.cpp",
"${_app_root}/util/util.cpp",
]
if (defined(invoker.cluster_sources)) {
_cluster_sources = invoker.cluster_sources
} else if (defined(invoker.zap_file)) {
_zap_path = rebase_path(invoker.zap_file, root_build_dir)
_script_args = [ "--zap_file=" + _zap_path ]
_cluster_sources = exec_script(_zap_cluster_list_script,
_script_args,
"list lines",
[ invoker.zap_file ])
}
if (defined(invoker.remove_cluster_sources)) {
_cluster_sources -= invoker.remove_cluster_sources
}
foreach(cluster, _cluster_sources) {
if (cluster == "door-lock-server") {
sources += [
"${_app_root}/clusters/${cluster}/door-lock-server-core.cpp",
"${_app_root}/clusters/${cluster}/door-lock-server-logging.cpp",
"${_app_root}/clusters/${cluster}/door-lock-server-schedule.cpp",
"${_app_root}/clusters/${cluster}/door-lock-server-user.cpp",
]
} else if (cluster == "network-commissioning") {
sources += [
"${_app_root}/clusters/${cluster}/${cluster}-ember.cpp",
"${_app_root}/clusters/${cluster}/${cluster}.cpp",
]
} else {
sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ]
}
}
if (defined(invoker.zap_pregenerated_dir)) {
sources += [
"${invoker.zap_pregenerated_dir}/call-command-handler.cpp",
"${invoker.zap_pregenerated_dir}/callback-stub.cpp",
]
if (_use_default_client_callbacks) {
sources += [ "${invoker.zap_pregenerated_dir}/CHIPClientCallbacks.cpp" ]
}
if (chip_enable_interaction_model) {
sources +=
[ "${invoker.zap_pregenerated_dir}/IMClusterCommandHandler.cpp" ]
}
}
if (!defined(public_deps)) {
public_deps = []
}
public_deps += [
"${chip_root}/src/app",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
]
if (!defined(public_configs)) {
public_configs = []
}
public_configs += [ ":${_data_model_name}_config" ]
}
}