|
| 1 | +# Copyright (c) 2023 Project CHIP Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import("//build_overrides/asr.gni") |
| 16 | +import("//build_overrides/build.gni") |
| 17 | +import("//build_overrides/chip.gni") |
| 18 | +import("${asr_sdk_build_root}/asr_sdk.gni") |
| 19 | +import("${build_root}/config/defaults.gni") |
| 20 | +import("${chip_root}/src/lib/lib.gni") |
| 21 | +import("${chip_root}/src/platform/device.gni") |
| 22 | +import("${chip_root}/third_party/asr/asr_executable.gni") |
| 23 | + |
| 24 | +import("cfg.gni") |
| 25 | + |
| 26 | +assert(current_os == "freertos") |
| 27 | + |
| 28 | +asr_project_dir = "${chip_root}/examples/lighting-app/asr" |
| 29 | +examples_plat_dir = "${chip_root}/examples/platform/asr" |
| 30 | + |
| 31 | +declare_args() { |
| 32 | + # Dump memory usage at link time. |
| 33 | + chip_print_memory_usage = false |
| 34 | +} |
| 35 | + |
| 36 | +asr_sdk_sources("lighting_app_sdk_sources") { |
| 37 | + include_dirs = [ |
| 38 | + "${chip_root}/src/platform/ASR", |
| 39 | + "${asr_project_dir}/include", |
| 40 | + "${examples_plat_dir}", |
| 41 | + ] |
| 42 | + |
| 43 | + defines = [ |
| 44 | + "ASR_LOG_ENABLED=1", |
| 45 | + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", |
| 46 | + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", |
| 47 | + ] |
| 48 | + |
| 49 | + if (chip_enable_factory_data) { |
| 50 | + defines += [ |
| 51 | + "CONFIG_ENABLE_ASR_FACTORY_DATA_PROVIDER=1", |
| 52 | + "CONFIG_ENABLE_ASR_FACTORY_DEVICE_INFO_PROVIDER=1", |
| 53 | + ] |
| 54 | + } |
| 55 | + |
| 56 | + if (chip_lwip_ip6_hook) { |
| 57 | + defines += [ |
| 58 | + "CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT", |
| 59 | + "CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT", |
| 60 | + ] |
| 61 | + } |
| 62 | + |
| 63 | + sources = [ "${asr_project_dir}/include/CHIPProjectConfig.h" ] |
| 64 | + |
| 65 | + public_configs = [ "${asr_sdk_build_root}:asr_sdk_config" ] |
| 66 | +} |
| 67 | + |
| 68 | +asr_executable("lighting_app") { |
| 69 | + include_dirs = [] |
| 70 | + defines = [] |
| 71 | + output_name = "chip-asr-lighting-example.out" |
| 72 | + |
| 73 | + sources = [ |
| 74 | + "${examples_plat_dir}/CHIPDeviceManager.cpp", |
| 75 | + "${examples_plat_dir}/LEDWidget.cpp", |
| 76 | + "${examples_plat_dir}/init_Matter.cpp", |
| 77 | + "${examples_plat_dir}/init_asrPlatform.cpp", |
| 78 | + "${examples_plat_dir}/shell/matter_shell.cpp", |
| 79 | + "src/AppTask.cpp", |
| 80 | + "src/DeviceCallbacks.cpp", |
| 81 | + "src/main.cpp", |
| 82 | + ] |
| 83 | + |
| 84 | + if (chip_enable_ota_requestor) { |
| 85 | + sources += [ "${examples_plat_dir}/init_OTARequestor.cpp" ] |
| 86 | + } |
| 87 | + |
| 88 | + deps = [ |
| 89 | + ":lighting_app_sdk_sources", |
| 90 | + "${chip_root}/examples/common/QRCode", |
| 91 | + "${chip_root}/examples/lighting-app/lighting-common", |
| 92 | + "${chip_root}/examples/providers:device_info_provider", |
| 93 | + "${chip_root}/src/lib", |
| 94 | + "${chip_root}/src/setup_payload", |
| 95 | + ] |
| 96 | + |
| 97 | + include_dirs += [ |
| 98 | + "include", |
| 99 | + "${examples_plat_dir}", |
| 100 | + "${asr_project_dir}/include", |
| 101 | + "${chip_root}/src/lib", |
| 102 | + ] |
| 103 | + |
| 104 | + defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] |
| 105 | + |
| 106 | + if (chip_build_libshell) { |
| 107 | + defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] |
| 108 | + sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] |
| 109 | + include_dirs += [ "${examples_plat_dir}/shell" ] |
| 110 | + } |
| 111 | + |
| 112 | + if (chip_print_memory_usage) { |
| 113 | + ldflags += [ |
| 114 | + "-Wl,--print-memory-usage", |
| 115 | + "-fstack-usage", |
| 116 | + ] |
| 117 | + } |
| 118 | + |
| 119 | + output_dir = root_out_dir |
| 120 | +} |
| 121 | + |
| 122 | +group("asr") { |
| 123 | + deps = [ ":lighting_app" ] |
| 124 | +} |
| 125 | + |
| 126 | +group("default") { |
| 127 | + deps = [ ":asr" ] |
| 128 | +} |
0 commit comments