Skip to content

Commit 8bdf1f5

Browse files
Energy Gateway commodity tariff example missing Pigweed build dependencies (project-chip#41704)
* Added some PW dependencies to enrg-gtw-app/CTC_server build files * Removed refs to nonexist files * The Pigweed inclusion way has changed. * Added comment * Fixed fail at building thew esp32 sample
1 parent 0a2fda2 commit 8bdf1f5

File tree

6 files changed

+35
-18
lines changed

6 files changed

+35
-18
lines changed

examples/energy-gateway-app/esp32/CMakeLists.txt

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,35 @@ idf_build_set_property(COMPILE_OPTIONS "-Wno-error=uninitialized" APPEND)
6060

6161
flashing_script()
6262

63+
# Dependencies required for pw_containers (used by CommodityTariff cluster)
64+
include(third_party/connectedhomeip/third_party/pigweed/repo/pw_build/pigweed.cmake)
65+
include($ENV{PW_ROOT}/pw_assert/backend.cmake)
66+
include($ENV{PW_ROOT}/pw_log/backend.cmake)
67+
include($ENV{PW_ROOT}/pw_sys_io/backend.cmake)
68+
69+
pw_set_backend(pw_log pw_log_basic)
70+
pw_set_backend(pw_assert.check pw_assert_log.check_backend)
71+
pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend)
72+
pw_set_backend(pw_sys_io pw_sys_io.esp32)
73+
74+
add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
75+
add_subdirectory(third_party/connectedhomeip/examples/platform/esp32/pw_sys_io)
76+
add_subdirectory(third_party/connectedhomeip/examples/platform/esp32/pw_sync)
77+
78+
# Dependencies required for pw_rpc
6379
if(CONFIG_ENABLE_PW_RPC)
64-
include(third_party/connectedhomeip/third_party/pigweed/repo/pw_build/pigweed.cmake)
65-
include($ENV{PW_ROOT}/pw_assert/backend.cmake)
66-
include($ENV{PW_ROOT}/pw_log/backend.cmake)
67-
include($ENV{PW_ROOT}/pw_sys_io/backend.cmake)
6880
include($ENV{PW_ROOT}/pw_trace/backend.cmake)
6981
include($ENV{PW_ROOT}/pw_interrupt/backend.cmake)
7082
include($ENV{PW_ROOT}/pw_sync/backend.cmake)
7183
include($ENV{PW_ROOT}/third_party/freertos/backend.cmake)
7284

7385
pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config)
7486

75-
pw_set_backend(pw_log pw_log_basic)
76-
pw_set_backend(pw_assert.check pw_assert_log.check_backend)
77-
pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend)
78-
pw_set_backend(pw_sys_io pw_sys_io.esp32)
7987
pw_set_backend(pw_trace pw_trace_tokenized)
8088
pw_set_backend(pw_interrupt.context pw_interrupt_freertos.context)
8189
pw_set_backend(pw_sync.interrupt_spin_lock pw_sync.esp32_interrupt_spin_lock)
8290
pw_set_backend(pw_sync.mutex pw_sync.esp32)
8391
pw_set_backend(pw_third_party.freertos idf::freertos)
8492

85-
add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
8693
add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo)
87-
add_subdirectory(third_party/connectedhomeip/examples/platform/esp32/pw_sys_io)
88-
add_subdirectory(third_party/connectedhomeip/examples/platform/esp32/pw_sync)
8994
endif(CONFIG_ENABLE_PW_RPC)

examples/energy-gateway-app/linux/BUILD.gn

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import("${chip_root}/third_party/imgui/imgui.gni")
2020

2121
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
2222

23-
if (chip_enable_pw_rpc) {
24-
import("//build_overrides/pigweed.gni")
25-
import("$dir_pw_build/target_types.gni")
26-
}
23+
import("//build_overrides/pigweed.gni")
2724

2825
config("includes") {
2926
include_dirs = [
@@ -53,6 +50,7 @@ executable("chip-energy-gateway-app") {
5350
]
5451

5552
deps = [
53+
"$dir_pw_containers:vector",
5654
"${chip_root}/examples/energy-gateway-app/energy-gateway-common",
5755
"${chip_root}/examples/platform/linux:app-main",
5856
"${chip_root}/src/app:attribute-persistence",

examples/energy-gateway-app/linux/args.gni

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
import("//build_overrides/chip.gni")
1818

19+
import("//build_overrides/pigweed.gni")
20+
1921
import("${chip_root}/config/standalone/args.gni")
2022

2123
chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
@@ -33,3 +35,7 @@ chip_enable_commodity_tariff_trigger = true
3335
chip_enable_electrical_grid_conditions_trigger = true
3436
chip_enable_meter_identification_trigger = true
3537
chip_enable_commodity_metering_trigger = true
38+
39+
pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert"
40+
41+
pw_build_LINK_DEPS = [ "$dir_pw_assert:impl" ]

src/app/clusters/commodity-tariff-server/BUILD.gn

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ source_set("commodity-tariff-server") {
2121
"CommodityTariffConsts.h",
2222
]
2323

24-
public_deps =
25-
[ "${chip_root}/zzz_generated/app-common/clusters/CommodityTariff" ]
24+
public_deps = [
25+
"${chip_root}/third_party/pigweed/repo/pw_containers:algorithm",
26+
"${chip_root}/third_party/pigweed/repo/pw_containers:vector",
27+
"${chip_root}/zzz_generated/app-common/clusters/CommodityTariff",
28+
]
2629
}

src/app/clusters/commodity-tariff-server/app_config_dependent_sources.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
# limitations under the License.
1414

1515
# This is the equivalent to app_config_dependent_sources.gni
16+
target_link_libraries(${APP_TARGET} PRIVATE
17+
pw_containers.algorithm
18+
pw_containers.vector
19+
)
20+
1621
TARGET_SOURCES(
1722
${APP_TARGET}
1823
PRIVATE

src/app/clusters/commodity-tariff-server/tests/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import("//build_overrides/pigweed.gni")
1919
import("${chip_root}/build/chip/chip_test_suite.gni")
2020

2121
chip_test_suite("tests") {
22-
output_name = "TestCommodityTariffBaseDataClass"
22+
output_name = "libTestCommodityTariffCluster"
2323

2424
test_sources = [ "TestCommodityTariffBaseDataClass.cpp" ]
2525

0 commit comments

Comments
 (0)