blob: 3dfbbbffe56daf56e8a9f08652d36a59eeea3a45 [file] [log] [blame]
# 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
# 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}",
]
visibility = [ ":app_config" ]
}
source_set("app_config") {
sources = [ "AppConfig.h" ]
deps = [ ":app_buildconfig" ]
}
source_set("revision_info") {
sources = [
"DataModelRevision.h",
"InteractionModelRevision.h",
"SpecificationVersion.h",
]
}
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-manager") {
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",
]
}
# 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",
"DeviceProxy.cpp",
"DeviceProxy.h",
"InteractionModelDelegatePointers.cpp",
"InteractionModelDelegatePointers.h",
"InteractionModelEngine.cpp",
"InteractionModelEngine.h",
"InteractionModelTimeout.h",
"OperationalSessionSetup.cpp",
"OperationalSessionSetup.h",
"OperationalSessionSetupPool.h",
"RequiredPrivilege.cpp",
"RequiredPrivilege.h",
"StatusResponse.cpp",
"StatusResponse.h",
"SubscriptionResumptionStorage.h",
"TimedHandler.cpp",
"TimedHandler.h",
"reporting/Engine.cpp",
"reporting/Engine.h",
"reporting/ReportScheduler.h",
"reporting/ReportSchedulerImpl.cpp",
"reporting/ReportSchedulerImpl.h",
"reporting/SynchronizedReportSchedulerImpl.cpp",
"reporting/SynchronizedReportSchedulerImpl.h",
"reporting/reporting.h",
]
public_deps = [
":app_config",
":paths",
":subscription-manager",
"${chip_root}/src/app/MessageDef",
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/app/icd/server:observer",
"${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_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",
]
public_configs += [ ":config-controller-dynamic-server" ]
}
}
# 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 = [
"AttributeAccessInterface.cpp",
"AttributePathExpandIterator.cpp",
"AttributePathExpandIterator.h",
"AttributePersistenceProvider.h",
"ChunkedWriteCallback.cpp",
"ChunkedWriteCallback.h",
"CommandHandler.cpp",
"CommandResponseHelper.h",
"CommandResponseSender.cpp",
"CommandResponseSender.h",
"CommandSender.cpp",
"DefaultAttributePersistenceProvider.cpp",
"DefaultAttributePersistenceProvider.h",
"DeferredAttributePersistenceProvider.cpp",
"DeferredAttributePersistenceProvider.h",
"EventManagement.cpp",
"EventManagement.h",
"FailSafeContext.cpp",
"FailSafeContext.h",
"OTAUserConsentCommon.h",
"PendingResponseTracker.h",
"PendingResponseTrackerImpl.cpp",
"PendingResponseTrackerImpl.h",
"ReadHandler.cpp",
"SafeAttributePersistenceProvider.h",
"TimedRequest.cpp",
"TimedRequest.h",
"TimerDelegates.cpp",
"TimerDelegates.h",
"WriteClient.cpp",
"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
# "CommandHandler._h"
# "CommandSender._h",
# "ReadClient._h",
# "ReadHandler._h",
# "WriteClient._h",
# "WriteHandler._h"
# TODO: the following items cannot be included due to platform includes not being
# able to depend on src/app
# Name with _ so that linter does not recognize it
# "_AttributeAccessInterface._h",
]
public_deps = [
":app_config",
":global-attributes",
":interaction-model",
":revision_info",
"${chip_root}/src/app/data-model",
"${chip_root}/src/app/icd/server:icd-server-config",
"${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",
"ReadClient.cpp",
# TODO: cannot include "ReadClient._h" because interaction-model backreference
# Name with _ so that linter does not recognize it
]
}
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" ]
}