| # 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/build.gni") |
| import("//build_overrides/chip.gni") |
| import("//build_overrides/openthread.gni") |
| import("//build_overrides/qpg_sdk.gni") |
| |
| import("${build_root}/config/defaults.gni") |
| import("${chip_root}/src/platform/device.gni") |
| import("${qpg_sdk_build_root}/qpg_executable.gni") |
| import("${qpg_sdk_build_root}/qpg_sdk.gni") |
| |
| # declares chip_build_libshell = false |
| import("${chip_root}/src/lib/lib.gni") |
| |
| # declares chip_enable_pw_rpc = false |
| import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") |
| if (chip_enable_pw_rpc) { |
| import("//build_overrides/pigweed.gni") |
| import("$dir_pw_build/target_types.gni") |
| } |
| |
| assert(current_os == "freertos") |
| |
| qpg_project_dir = "${chip_root}/examples/lock-app/qpg" |
| examples_plat_dir = "${chip_root}/examples/platform/qpg" |
| |
| qpg_sdk("sdk") { |
| include_dirs = [ |
| "${chip_root}/src/platform/qpg", |
| "${examples_plat_dir}", |
| "${qpg_project_dir}/include", |
| ] |
| |
| if (chip_enable_pw_rpc) { |
| defines = [ "PW_RPC_ENABLED" ] |
| } |
| } |
| |
| qpg_executable("lock_app") { |
| output_name = "chip-${qpg_target_ic}-lock-example.out" |
| |
| sources = [ |
| "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp", |
| "${examples_plat_dir}/app/main.cpp", |
| "${examples_plat_dir}/ota/ota.cpp", |
| "src/AppTask.cpp", |
| "src/BoltLockManager.cpp", |
| "src/ZclCallbacks.cpp", |
| ] |
| |
| deps = [ |
| ":sdk", |
| "${chip_root}/examples/lock-app/qpg/zap/", |
| "${chip_root}/examples/providers:device_info_provider", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/setup_payload", |
| "${chip_root}/third_party/openthread/platforms:libopenthread-platform", |
| "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", |
| "${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata_lib", |
| ] |
| |
| if (chip_openthread_ftd) { |
| deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] |
| } else { |
| deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] |
| } |
| |
| include_dirs = [ |
| "include", |
| "${examples_plat_dir}/ota", |
| ] |
| |
| defines = [] |
| |
| if (chip_enable_pw_rpc) { |
| defines += [ |
| "PW_RPC_ENABLED", |
| "PW_RPC_ATTRIBUTE_SERVICE=1", |
| "PW_RPC_BUTTON_SERVICE=1", |
| "PW_RPC_DEVICE_SERVICE=1", |
| "PW_RPC_LOCKING_SERVICE=1", |
| ] |
| |
| sources += [ |
| "${chip_root}/examples/common/pigweed/RpcService.cpp", |
| "${chip_root}/examples/common/pigweed/qpg/PigweedLoggerMutex.cpp", |
| "${examples_plat_dir}/PigweedLogger.cpp", |
| "${examples_plat_dir}/Rpc.cpp", |
| "${examples_plat_dir}/uart.c", |
| ] |
| |
| deps += [ |
| "$dir_pw_hdlc:rpc_channel_output", |
| "$dir_pw_stream:sys_io_stream", |
| "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc", |
| "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:locking_service.nanopb_rpc", |
| "${examples_plat_dir}/pw_sys_io:pw_sys_io_qpg", |
| ] |
| |
| deps += pw_build_LINK_DEPS |
| |
| include_dirs += [ |
| "${chip_root}/examples/common", |
| "${chip_root}/examples/common/pigweed/qpg", |
| ] |
| } else { |
| # The below gives compiler erros in pigweed, therefore it is only enabled |
| # when rpc is not |
| cflags = [ "-Wconversion" ] |
| } |
| |
| if (chip_build_libshell) { |
| deps += [ "${examples_plat_dir}:qpg-matter-shell" ] |
| } else { |
| if (chip_openthread_ftd) { |
| deps += |
| [ "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd" ] |
| } else { |
| deps += |
| [ "${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd" ] |
| } |
| } |
| |
| ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld" |
| |
| inputs = [ ldscript ] |
| |
| ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] |
| |
| output_dir = root_out_dir |
| } |
| |
| group("qpg") { |
| deps = [ ":lock_app" ] |
| } |
| |
| group("default") { |
| deps = [ ":qpg" ] |
| } |