blob: ee75cbdc2d5e16e86a7cbb888326403a09fd9643 [file]
# Copyright (c) 2020-2022 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}/config/standalone/args.gni")
chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
chip_project_config_include = "<CHIPProjectAppConfig.h>"
chip_system_project_config_include = "<SystemProjectConfig.h>"
chip_project_config_include_dirs =
[ "${chip_root}/examples/tv-casting-app/tv-casting-common/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
import(
"${chip_root}/examples/tv-casting-app/tv-casting-common/tv-casting-common.gni")
chip_enable_additional_data_advertising = true
chip_enable_rotating_device_id = true
chip_config_network_layer_ble = false
chip_max_discovered_ip_addresses = 20
enable_rtti = true
if (optimize_apk_size) {
# Size-optimized build: smaller APK, fewer debug features
# NOTE: The following flags are declared in declare_args() blocks
# elsewhere and MUST be passed as explicit GN build args from
# android.py to override their defaults. Setting them here in
# args.gni has NO EFFECT because this file is evaluated inside
# default_args (before args.gn values are applied), so the
# if (optimize_apk_size) conditional sees the default value of
# false and the entire block is skipped.
#
# Flags passed from android.py for size-optimized builds:
# optimize_apk_size = true (this flag itself)
# is_debug = false
# matter_enable_tracing_support = false
# use_static_libcxx = true
# chip_data_model_overrides_dir (tv-casting-app only)
#
# The assignments below are kept for documentation and for any
# build path that evaluates args.gni AFTER args.gn (e.g. a manual
# gn gen with optimize_apk_size=true in args.gn directly).
chip_build_libshell = false
optimize_for_size = true # -Os (size) instead of -O2 (speed)
symbol_level = 0 # -g0: no debug symbols
enable_rtti =
false # Disable C++ RTTI to remove type_info and vtable overhead
# Point the build at the override directory containing slim source
# files (cluster-objects, TLV decoders, accessors, cluster servers)
# covering only the ~36 casting-relevant clusters. The build system
# resolves well-known filenames inside this directory automatically,
# replacing the full zap-generated sources (~200+ clusters) with slim
# versions that keep ChipClusters.java read/subscribe APIs functional
# while reducing binary size.
chip_data_model_overrides_dir =
"${chip_root}/examples/tv-casting-app/tv-casting-common"
} else {
# Default development build: full debug features, fast compilation
chip_build_libshell = true
optimize_for_size = false # -O2 (speed) - faster compilation
symbol_level = 0 # -g0 (no debug symbols) - fastest compilation
}
# Symbol Level Options:
# 0 = No debug symbols (-g0): Fastest build, smallest binary, no crash stack traces
# 1 = Minimal symbols (-g1): Moderate build speed, crash reports with function names
# 2 = Full symbols (-g2): Slowest build, largest binary, full debugging capability
# Note: These settings affect C++ compilation only, not Java/Kotlin code
# is_debug Options:
# false = Release mode: Removes assert() checks, bounds checking, extra logging
# true = Debug mode: Keeps all safety checks, slower execution but catches bugs
# Default: true (if not specified, GN defaults to debug mode)
# Note: In size-optimized builds, is_debug=false is set by android.py as a
# GN build arg to properly override the declare_args() default.