blob: 0ffe6deb6dd6c1eefeb64616e62427b0594a72df [file] [log] [blame]
# 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")
# Defines a source_set for CHIP data model.
#
# Arguments:
# zap_pregenerated_dir
# Path to the ZAP "gen" dir.
#
# cluster_sources
# Names of the clusters to compile.
#
# 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",
"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}/util/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)) {
foreach(cluster, invoker.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}/attribute-size.cpp",
"${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",
"${chip_root}/src/protocols/secure_channel",
]
if (!defined(public_configs)) {
public_configs = []
}
public_configs += [ ":${_data_model_name}_config" ]
}
}