1# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16include($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake)
17
18if(NOT "${dir_pw_third_party_nanopb}" STREQUAL "")
19  add_subdirectory(nanopb)
20endif()
21
22add_subdirectory(raw)
23add_subdirectory(system_server)
24
25pw_add_module_library(pw_rpc.server
26  SOURCES
27    base_server_writer.cc
28    server.cc
29    service.cc
30  PUBLIC_DEPS
31    pw_rpc.common
32  PRIVATE_DEPS
33    pw_log
34)
35
36pw_add_module_library(pw_rpc.client
37  SOURCES
38    base_client_call.cc
39    client.cc
40  PUBLIC_DEPS
41    pw_rpc.common
42  PRIVATE_DEPS
43    pw_log
44)
45
46pw_add_module_library(pw_rpc.client_server
47  SOURCES
48    client_server.cc
49  PUBLIC_DEPS
50    pw_rpc.client
51    pw_rpc.server
52)
53
54pw_add_module_library(pw_rpc.common
55  SOURCES
56    channel.cc
57    packet.cc
58  PUBLIC_DEPS
59    pw_assert
60    pw_bytes
61    pw_containers
62    pw_span
63    pw_status
64    pw_rpc.protos.pwpb
65  PRIVATE_DEPS
66    pw_log
67)
68
69pw_add_module_library(pw_rpc.synchronized_channel_output
70  PUBLIC_DEPS
71    pw_rpc.common
72    pw_sync.mutex
73)
74
75add_library(pw_rpc.test_utils INTERFACE)
76target_include_directories(pw_rpc.test_utils INTERFACE .)
77
78pw_proto_library(pw_rpc.protos
79  SOURCES
80    internal/packet.proto
81    echo.proto
82  INPUTS
83    echo.options
84  PREFIX
85    pw_rpc
86)
87
88pw_proto_library(pw_rpc.test_protos
89  SOURCES
90    pw_rpc_test_protos/test.proto
91)
92
93pw_auto_add_module_tests(pw_rpc
94  PRIVATE_DEPS
95    pw_rpc.client
96    pw_rpc.server
97)
98