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 call.cc 28 endpoint.cc 29 server.cc 30 server_call.cc 31 service.cc 32 PUBLIC_DEPS 33 pw_rpc.common 34 PRIVATE_DEPS 35 pw_log 36) 37if(Zephyr_FOUND AND CONFIG_PIGWEED_RPC_SERVER) 38 zephyr_link_libraries(pw_rpc.server) 39endif() 40 41pw_add_module_library(pw_rpc.client 42 SOURCES 43 client.cc 44 client_call.cc 45 PUBLIC_DEPS 46 pw_rpc.common 47 pw_result 48 PRIVATE_DEPS 49 pw_log 50) 51if(Zephyr_FOUND AND CONFIG_PIGWEED_RPC_CLIENT) 52 zephyr_link_libraries(pw_rpc.client) 53endif() 54 55pw_add_module_library(pw_rpc.client_server 56 SOURCES 57 client_server.cc 58 PUBLIC_DEPS 59 pw_rpc.client 60 pw_rpc.server 61) 62if(Zephyr_FOUND AND CONFIG_PIGWEED_RPC_CLIENT_SERVER) 63 zephyr_link_libraries(pw_rpc.client_server) 64endif() 65 66pw_add_module_library(pw_rpc.common 67 SOURCES 68 channel.cc 69 channel_list.cc 70 packet.cc 71 PUBLIC_DEPS 72 pw_assert 73 pw_bytes 74 pw_containers 75 pw_function 76 pw_span 77 pw_status 78 pw_sync.lock_annotations 79 pw_rpc.protos.pwpb 80 PRIVATE_DEPS 81 pw_log 82) 83if(Zephyr_FOUND AND CONFIG_PIGWEED_RPC_COMMON) 84 zephyr_link_libraries(pw_rpc.common) 85endif() 86 87if (NOT "${pw_sync.mutex_BACKEND}" STREQUAL "pw_sync.mutex.NO_BACKEND_SET" AND 88 NOT "${pw_sync.mutex_BACKEND}" STREQUAL "") 89 target_link_libraries(pw_rpc.common PUBLIC pw_sync.mutex) 90endif() 91 92pw_add_module_library(pw_rpc.test_utils 93 SOURCES 94 fake_channel_output.cc 95 PUBLIC_DEPS 96 pw_assert 97 pw_bytes 98 pw_rpc.client 99 pw_rpc.server 100) 101target_include_directories(pw_rpc.test_utils PUBLIC .) 102 103pw_proto_library(pw_rpc.protos 104 SOURCES 105 internal/packet.proto 106 echo.proto 107 INPUTS 108 echo.options 109 PREFIX 110 pw_rpc 111) 112 113pw_proto_library(pw_rpc.test_protos 114 SOURCES 115 pw_rpc_test_protos/test.proto 116) 117 118pw_auto_add_module_tests(pw_rpc 119 PRIVATE_DEPS 120 pw_rpc.client 121 pw_rpc.server 122) 123