diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 299229e890a92f..f9df2847e35070 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -333,7 +333,7 @@ def main(argv: Sequence[str]) -> None: with open(f"{_CHEF_SCRIPT_PATH}/linux/args.gni", "w") as f: f.write(textwrap.dedent(f"""\ import("//build_overrides/chip.gni") - import("\\${{chip_root}}/config/standalone/args.gni") + import("${{chip_root}}/config/standalone/args.gni") chip_shell_cmd_server = false target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={'1' if options.do_rpc else '0'}"] """)) @@ -344,7 +344,10 @@ def main(argv: Sequence[str]) -> None: """)) if options.do_clean: shell.run_cmd(f"rm -rf out") - shell.run_cmd("gn gen out") + if options.do_rpc: + shell.run_cmd("gn gen out --args='import(\"//with_pw_rpc.gni\")'") + else: + shell.run_cmd("gn gen out --args=''") shell.run_cmd("ninja -C out") # diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn index 5201c3659e74bc..9bd88e4b53c03d 100644 --- a/examples/chef/linux/BUILD.gn +++ b/examples/chef/linux/BUILD.gn @@ -13,11 +13,10 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/openthread.gni") + import("${chip_root}/build/chip/tools.gni") import("${chip_root}/src/app/chip_data_model.gni") import("${chip_root}/src/app/common_flags.gni") -import("${chip_root}/src/app/common_flags.gni") assert(chip_build_tools) @@ -34,27 +33,19 @@ project_dir = "./.." chip_data_model("chef-data-model") { zap_file = "${project_dir}/devices/${sample_zap_file}" + zap_pregenerated_dir = "${chip_root}/examples/chef/out/${sample_name}/zap-generated/" is_server = true } executable("${sample_name}") { - sources = [ - "${project_dir}/common/stubs.cpp", - "${project_dir}/linux/main.cpp", - ] + sources = [ "${project_dir}/linux/main.cpp" ] deps = [ ":chef-data-model", "${chip_root}/examples/platform/linux:app-main", - "${chip_root}/examples/platform/linux:app-main", - "${chip_root}/src/controller", - "${chip_root}/src/credentials", - "${chip_root}/src/lib", "${chip_root}/src/lib", - "${chip_root}/src/lib/shell", - "${chip_root}/src/platform", "${project_dir}/shell_common:shell_common", ] @@ -62,11 +53,13 @@ executable("${sample_name}") { if (chip_enable_pw_rpc) { defines = [ + "PW_RPC_ENABLED", "PW_RPC_ATTRIBUTE_SERVICE=1", "PW_RPC_BUTTON_SERVICE=1", "PW_RPC_DESCRIPTOR_SERVICE=1", "PW_RPC_DEVICE_SERVICE=1", "PW_RPC_LIGHTING_SERVICE=1", + "PW_RPC_TRACING_SERVICE=1", ] sources += [ @@ -83,6 +76,9 @@ executable("${sample_name}") { "$dir_pw_stream:socket_stream", "$dir_pw_stream:sys_io_stream", "$dir_pw_sync:mutex", + "$dir_pw_trace", + "$dir_pw_trace_tokenized", + "$dir_pw_trace_tokenized:trace_rpc_service", "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", @@ -93,6 +89,10 @@ executable("${sample_name}") { ] deps += pw_build_LINK_DEPS + + cflags = [ "-Wno-gnu-designator" ] + + include_dirs += [ "${chip_root}/examples/common" ] } else { # The system_rpc_server.cc file is in pigweed and doesn't compile with # -Wconversion, remove check for RPC build only. diff --git a/examples/chef/linux/with_pw_rpc.gni b/examples/chef/linux/with_pw_rpc.gni index e64dd0fe8a2b12..e498d86a8e4c23 100644 --- a/examples/chef/linux/with_pw_rpc.gni +++ b/examples/chef/linux/with_pw_rpc.gni @@ -26,6 +26,7 @@ cpp_standard = "gnu++17" pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" @@ -38,3 +39,7 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true +<<<<<<< HEAD +======= +chip_build_pw_trace_lib = true +>>>>>>> 1eb092115 (RPC support in the example tool chef linux build (#18294))