blob: 51fe90751ae2199cb576e185bdcf84a1d5800f8c [file] [log] [blame]
# 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/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")
import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
import("$dir_pw_build/python.gni")
import("$dir_pw_protobuf_compiler/proto.gni")
assert(current_os == "freertos")
efr32_project_dir = "${chip_root}/src/test_driver/efr32"
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
pw_proto_library("nl_test_service") {
sources = [ "${efr32_project_dir}/proto/nl_test.proto" ]
inputs = [ "${efr32_project_dir}/proto/nl_test.options" ]
deps = [ "$dir_pw_protobuf:common_protos" ]
strip_prefix = "${efr32_project_dir}/proto"
prefix = "nl_test_service"
}
efr32_sdk("sdk") {
sources = [
"${efr32_project_dir}/include/CHIPProjectConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
]
include_dirs = [
"${chip_root}/src/platform/silabs/efr32",
"${efr32_project_dir}/include",
"${examples_plat_dir}",
"${examples_common_plat_dir}",
]
defines = [
"PW_RPC_ENABLED",
# Thread is built but test driver do not have the NETWORK_COMMISSIONING cluster or zap config.
"_NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_",
]
}
config("efr32_ldflags") {
_ldscript =
"${chip_root}/examples/platform/silabs/ldscripts/${silabs_family}.ld"
ldflags = [
"-T" + rebase_path(_ldscript, root_build_dir),
"-Wl,--no-warn-rwx-segment",
]
}
# This is the test runner. `pw_test` will dep this for each `silabs_executable` target.
source_set("efr32_test_main") {
defines = [ "PW_RPC_ENABLED" ]
sources = [
"${chip_root}/examples/common/pigweed/RpcService.cpp",
"${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
"${examples_common_plat_dir}/PigweedLogger.cpp",
"${examples_common_plat_dir}/provision/ProvisionStorageCustom.cpp",
"${examples_common_plat_dir}/provision/ProvisionStorageDefault.cpp",
"${examples_common_plat_dir}/syscalls_stubs.cpp",
"${examples_common_plat_dir}/uart.cpp",
"src/main.cpp",
]
deps = [
":nl_test_service.nanopb_rpc",
":sdk",
"$dir_pw_unit_test:rpc_service",
"${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
"${chip_root}/examples/common/pigweed:system_rpc_server",
"${chip_root}/src/lib",
"${chip_root}/src/lib/support:pw_tests_wrapper",
"${chip_root}/src/platform/silabs/provision:provision-headers",
"${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs",
]
# OpenThread Settings
if (chip_enable_openthread) {
deps += [
"${chip_root}/third_party/openthread:openthread",
"${chip_root}/third_party/openthread:openthread-platform",
"${examples_plat_dir}:matter-shell",
]
}
deps += pw_build_LINK_DEPS
libs = [
"${sdk_support_root}/matter/provision/lib/libProvision_${silabs_family}.a",
]
include_dirs = [ "${chip_root}/examples/common/pigweed/efr32" ]
public_configs = [ ":efr32_ldflags" ]
}
# This target is referred to by BuildRoot in scripts/build/builders/efr32.py, as well as the example in README.md.
# It builds the root target "src:tests", which builds the chip_test_suite target in each test directory, which builds a pw_test target for each test source file, which builds a silabs_executable, which includes the "efr32_test_main" target defined above.
group("efr32") {
deps = [ "${chip_root}/src:tests" ]
}
group("runner") {
deps = [
"${efr32_project_dir}/py:pw_test_runner.install",
"${efr32_project_dir}/py:pw_test_runner_wheel",
]
}
group("default") {
deps = [ ":efr32" ]
}