|
| 1 | +# Copyright(c) 2021 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/build.gni") |
| 16 | +import("//build_overrides/chip.gni") |
| 17 | +import("//build_overrides/openthread.gni") |
| 18 | +import("//build_overrides/qpg_sdk.gni") |
| 19 | + |
| 20 | +import("${build_root}/config/defaults.gni") |
| 21 | +import("${chip_root}/src/platform/device.gni") |
| 22 | +import("${qpg_sdk_build_root}/qpg_executable.gni") |
| 23 | +import("${qpg_sdk_build_root}/qpg_sdk.gni") |
| 24 | + |
| 25 | +# declares chip_build_libshell = false |
| 26 | +import("${chip_root}/src/lib/lib.gni") |
| 27 | + |
| 28 | +# declares chip_enable_pw_rpc = false |
| 29 | +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") |
| 30 | +if (chip_enable_pw_rpc) { |
| 31 | + import("//build_overrides/pigweed.gni") |
| 32 | + import("$dir_pw_build/target_types.gni") |
| 33 | +} |
| 34 | + |
| 35 | +assert(current_os == "freertos") |
| 36 | + |
| 37 | +qpg_project_dir = "${chip_root}/examples/light-switch-app/qpg" |
| 38 | +examples_plat_dir = "${chip_root}/examples/platform/qpg" |
| 39 | + |
| 40 | +qpg_sdk("sdk") { |
| 41 | + include_dirs = [ |
| 42 | + "${chip_root}/src/platform/qpg", |
| 43 | + "${examples_plat_dir}", |
| 44 | + "${qpg_project_dir}/include", |
| 45 | + ] |
| 46 | + |
| 47 | + defines = [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] |
| 48 | +} |
| 49 | + |
| 50 | +qpg_executable("light_switch_app") { |
| 51 | + output_name = "chip-${qpg_target_ic}-light-switch-example.out" |
| 52 | + |
| 53 | + sources = [ |
| 54 | + "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp", |
| 55 | + "${examples_plat_dir}/app/main.cpp", |
| 56 | + "${examples_plat_dir}/ota/ota.cpp", |
| 57 | + "src/AppTask.cpp", |
| 58 | + "src/SwitchManager.cpp", |
| 59 | + "src/ZclCallbacks.cpp", |
| 60 | + "src/binding-handler.cpp", |
| 61 | + ] |
| 62 | + |
| 63 | + deps = [ |
| 64 | + ":sdk", |
| 65 | + "${chip_root}/examples/light-switch-app/qpg/zap/", |
| 66 | + "${chip_root}/examples/providers:device_info_provider", |
| 67 | + "${chip_root}/src/lib", |
| 68 | + "${chip_root}/src/setup_payload", |
| 69 | + "${chip_root}/third_party/openthread/platforms:libopenthread-platform", |
| 70 | + "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", |
| 71 | + "${chip_root}/third_party/qpg_sdk:qpg_switch_factorydata_lib", |
| 72 | + "${chip_root}/third_party/qpg_sdk:qpg_switch_firmwaredata_lib", |
| 73 | + ] |
| 74 | + |
| 75 | + if (chip_openthread_ftd) { |
| 76 | + deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] |
| 77 | + } else { |
| 78 | + deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] |
| 79 | + } |
| 80 | + |
| 81 | + include_dirs = [ |
| 82 | + "include", |
| 83 | + "${examples_plat_dir}/ota", |
| 84 | + ] |
| 85 | + |
| 86 | + defines = [] |
| 87 | + |
| 88 | + if (chip_enable_pw_rpc) { |
| 89 | + defines += [ |
| 90 | + "PW_RPC_ATTRIBUTE_SERVICE=1", |
| 91 | + "PW_RPC_BUTTON_SERVICE=1", |
| 92 | + "PW_RPC_DEVICE_SERVICE=1", |
| 93 | + "PW_RPC_LOCKING_SERVICE=1", |
| 94 | + ] |
| 95 | + |
| 96 | + sources += [ |
| 97 | + "${chip_root}/examples/common/pigweed/RpcService.cpp", |
| 98 | + "${chip_root}/examples/common/pigweed/qpg/PigweedLoggerMutex.cpp", |
| 99 | + "${examples_plat_dir}/PigweedLogger.cpp", |
| 100 | + "${examples_plat_dir}/Rpc.cpp", |
| 101 | + "${examples_plat_dir}/uart.c", |
| 102 | + ] |
| 103 | + |
| 104 | + deps += [ |
| 105 | + "$dir_pw_hdlc:rpc_channel_output", |
| 106 | + "$dir_pw_stream:sys_io_stream", |
| 107 | + "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc", |
| 108 | + "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", |
| 109 | + "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", |
| 110 | + "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", |
| 111 | + "${chip_root}/examples/common/pigweed:locking_service.nanopb_rpc", |
| 112 | + "${examples_plat_dir}/pw_sys_io:pw_sys_io_qpg", |
| 113 | + ] |
| 114 | + |
| 115 | + deps += pw_build_LINK_DEPS |
| 116 | + |
| 117 | + include_dirs += [ |
| 118 | + "${chip_root}/examples/common", |
| 119 | + "${chip_root}/examples/common/pigweed/qpg", |
| 120 | + ] |
| 121 | + } else { |
| 122 | + # The below gives compiler erros in pigweed, therefore it is only enabled |
| 123 | + # when rpc is not |
| 124 | + cflags = [ "-Wconversion" ] |
| 125 | + } |
| 126 | + |
| 127 | + if (chip_build_libshell) { |
| 128 | + deps += [ "${examples_plat_dir}:qpg-matter-shell" ] |
| 129 | + } else { |
| 130 | + if (chip_openthread_ftd) { |
| 131 | + deps += |
| 132 | + [ "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd" ] |
| 133 | + } else { |
| 134 | + deps += |
| 135 | + [ "${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd" ] |
| 136 | + } |
| 137 | + } |
| 138 | + |
| 139 | + ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld" |
| 140 | + |
| 141 | + inputs = [ ldscript ] |
| 142 | + |
| 143 | + ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] |
| 144 | + |
| 145 | + output_dir = root_out_dir |
| 146 | +} |
| 147 | + |
| 148 | +group("qpg") { |
| 149 | + deps = [ ":light_switch_app" ] |
| 150 | +} |
| 151 | + |
| 152 | +group("default") { |
| 153 | + deps = [ ":qpg" ] |
| 154 | +} |
0 commit comments