@@ -8,8 +8,110 @@ set(dir "${sdk_root}/component/common/api")
8
8
set (chip_main chip_main)
9
9
set (list_chip_main_sources chip_main_sources)
10
10
11
+ if (matter_enable_rpc)
12
+ set (pigweed_dir "${chip_dir} /third_party/pigweed/repo" )
13
+
14
+ include (${pigweed_dir} /pw_build/pigweed.cmake)
15
+ include (${pigweed_dir} /pw_protobuf_compiler/proto.cmake)
16
+
17
+ set (dir_pw_third_party_nanopb "${chip_dir} /third_party/nanopb/repo" CACHE STRING "" FORCE)
18
+
19
+ pw_set_backend(pw_log pw_log_basic)
20
+ pw_set_backend(pw_assert pw_assert_log)
21
+ pw_set_backend(pw_sys_io pw_sys_io.ameba)
22
+ pw_set_backend(pw_trace pw_trace_tokenized)
23
+
24
+ add_subdirectory (${chip_dir} /third_party/pigweed/repo ${chip_dir} /examples/all -clusters-app/ameba/out/pigweed)
25
+ add_subdirectory (${chip_dir} /third_party/nanopb/repo ${chip_dir} /examples/all -clusters-app/ameba/out/nanopb)
26
+ add_subdirectory (${chip_dir} /examples/platform/ameba/pw_sys_io ${chip_dir} /examples/all -clusters-app/ameba/out/pw_sys_io)
27
+
28
+ pw_proto_library(attributes_service
29
+ SOURCES
30
+ ${chip_dir} /examples/common/pigweed/protos/attributes_service.proto
31
+ INPUTS
32
+ ${chip_dir} /examples/common/pigweed/protos/attributes_service.options
33
+ PREFIX
34
+ attributes_service
35
+ STRIP_PREFIX
36
+ ${chip_dir} /examples/common/pigweed/protos
37
+ DEPS
38
+ pw_protobuf.common_protos
39
+ )
40
+
41
+ pw_proto_library(button_service
42
+ SOURCES
43
+ ${chip_dir} /examples/common/pigweed/protos/button_service.proto
44
+ PREFIX
45
+ button_service
46
+ STRIP_PREFIX
47
+ ${chip_dir} /examples/common/pigweed/protos
48
+ DEPS
49
+ pw_protobuf.common_protos
50
+ )
51
+
52
+ pw_proto_library(device_service
53
+ SOURCES
54
+ ${chip_dir} /examples/common/pigweed/protos/device_service.proto
55
+ INPUTS
56
+ ${chip_dir} /examples/common/pigweed/protos/device_service.options
57
+ PREFIX
58
+ device_service
59
+ STRIP_PREFIX
60
+ ${chip_dir} /examples/common/pigweed/protos
61
+ DEPS
62
+ pw_protobuf.common_protos
63
+ )
64
+
65
+ pw_proto_library(lighting_service
66
+ SOURCES
67
+ ${chip_dir} /examples/common/pigweed/protos/lighting_service.proto
68
+ PREFIX
69
+ lighting_service
70
+ STRIP_PREFIX
71
+ ${chip_dir} /examples/common/pigweed/protos
72
+ DEPS
73
+ pw_protobuf.common_protos
74
+ )
75
+
76
+ pw_proto_library(locking_service
77
+ SOURCES
78
+ ${chip_dir} /examples/common/pigweed/protos/locking_service.proto
79
+ PREFIX
80
+ locking_service
81
+ STRIP_PREFIX
82
+ ${chip_dir} /examples/common/pigweed/protos
83
+ DEPS
84
+ pw_protobuf.common_protos
85
+ )
86
+
87
+ pw_proto_library(wifi_service
88
+ SOURCES
89
+ ${chip_dir} /examples/ipv6only-app/common/wifi_service/wifi_service.proto
90
+ INPUTS
91
+ ${chip_dir} /examples/ipv6only-app/common/wifi_service/wifi_service.options
92
+ PREFIX
93
+ wifi_service
94
+ DEPS
95
+ pw_protobuf.common_protos
96
+ STRIP_PREFIX
97
+ ${chip_dir} /examples/ipv6only-app/common/wifi_service
98
+ )
99
+
100
+ endif (matter_enable_rpc)
101
+
11
102
include (${prj_root} /GCC-RELEASE/project_hp/asdk/includepath.cmake)
12
103
104
+ if (matter_enable_rpc)
105
+ list (
106
+ APPEND ${list_chip_main_sources}
107
+ #rpc
108
+ ${chip_dir} /examples/platform/ameba/PigweedLogger.cpp
109
+ ${chip_dir} /examples/platform/ameba/Rpc.cpp
110
+ ${chip_dir} /examples/common/pigweed/RpcService.cpp
111
+ ${chip_dir} /examples/common/pigweed/ameba/PigweedLoggerMutex.cpp
112
+ )
113
+ endif (matter_enable_rpc)
114
+
13
115
list (
14
116
APPEND ${list_chip_main_sources}
15
117
@@ -40,10 +142,26 @@ chip_configure_data_model(chip_main
40
142
ZAP_FILE ${matter_example_path} /../all -clusters-common/all -clusters-app.zap
41
143
)
42
144
145
+ if (matter_enable_rpc)
43
146
target_include_directories (
44
147
${chip_main}
45
148
PUBLIC
46
- ${inc_path}
149
+ #rpc
150
+ ${chip_dir} /examples/platform/ameba
151
+ ${chip_dir} /examples/platform/ameba/pw_sys_io/public
152
+ ${chip_dir} /examples/common
153
+ ${chip_dir} /examples/common/pigweed
154
+ ${chip_dir} /examples/common/pigweed/ameba
155
+ ${chip_dir} /src
156
+ ${chip_dir} /src/lib/support
157
+ ${pigweed_dir} /pw_rpc/nanopb/public
158
+ )
159
+ endif (matter_enable_rpc)
160
+
161
+ target_include_directories (
162
+ ${chip_main}
163
+ PUBLIC
164
+ ${inc_path}
47
165
${chip_dir} /zzz_generated/all -clusters-app
48
166
${chip_dir} /zzz_generated/all -clusters-app/zap-generated
49
167
${chip_dir} /zzz_generated/app-common
@@ -63,6 +181,30 @@ target_include_directories(
63
181
${chip_dir} /third_party/nlunit-test /repo/src
64
182
)
65
183
184
+ if (matter_enable_rpc)
185
+ target_link_libraries (${chip_main} PUBLIC
186
+ attributes_service.nanopb_rpc
187
+ button_service.nanopb_rpc
188
+ device_service.nanopb_rpc
189
+ lighting_service.nanopb_rpc
190
+ locking_service.nanopb_rpc
191
+ wifi_service.nanopb_rpc
192
+ pw_checksum
193
+ pw_hdlc
194
+ pw_log
195
+ pw_rpc.server
196
+ pw_trace_tokenized
197
+ pw_trace_tokenized.trace_buffer
198
+ pw_trace_tokenized.rpc_service
199
+ pw_trace_tokenized.protos.nanopb_rpc
200
+ PwRpc
201
+ )
202
+
203
+ link_directories (
204
+ ${chip_dir_output} /lib
205
+ )
206
+ endif (matter_enable_rpc)
207
+
66
208
list (
67
209
APPEND chip_main_flags
68
210
@@ -74,6 +216,19 @@ list(
74
216
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
75
217
)
76
218
219
+ if (matter_enable_rpc)
220
+ list (
221
+ APPEND chip_main_flags
222
+
223
+ -DPW_RPC_ATTRIBUTE_SERVICE=1
224
+ -DPW_RPC_BUTTON_SERVICE=1
225
+ -DPW_RPC_DEVICE_SERVICE=1
226
+ -DPW_RPC_LIGHTING_SERVICE=1
227
+ -DPW_RPC_LOCKING_SERVICE=1
228
+ -DCONFIG_ENABLE_PW_RPC=1
229
+ )
230
+ endif (matter_enable_rpc)
231
+
77
232
list (
78
233
APPEND chip_main_cpp_flags
79
234
@@ -91,3 +246,4 @@ add_custom_command(
91
246
POST_BUILD
92
247
COMMAND cp lib${chip_main} .a ${CMAKE_CURRENT_SOURCE_DIR} /lib/application
93
248
)
249
+
0 commit comments