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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_third_party/nanopb/nanopb.gni") 20import("$dir_pw_unit_test/test.gni") 21 22config("public") { 23 include_dirs = [ "public" ] 24 visibility = [ ":*" ] 25} 26 27pw_source_set("method") { 28 public_configs = [ ":public" ] 29 public = [ "public/pw_rpc/internal/nanopb_method.h" ] 30 sources = [ "nanopb_method.cc" ] 31 public_deps = [ 32 ":common", 33 "..:config", 34 "..:server", 35 ] 36 deps = [ dir_pw_log ] 37} 38 39pw_source_set("method_union") { 40 public_configs = [ ":public" ] 41 public = [ "public/pw_rpc/internal/nanopb_method_union.h" ] 42 public_deps = [ 43 ":method", 44 "$dir_pw_rpc/raw:method_union", 45 ] 46} 47 48pw_source_set("client") { 49 public_configs = [ ":public" ] 50 public_deps = [ 51 ":common", 52 "..:client", 53 ] 54 public = [ "public/pw_rpc/nanopb_client_call.h" ] 55 sources = [ "nanopb_client_call.cc" ] 56} 57 58pw_source_set("common") { 59 public_deps = [ dir_pw_bytes ] 60 public_configs = [ ":public" ] 61 public = [ "public/pw_rpc/internal/nanopb_common.h" ] 62 sources = [ "nanopb_common.cc" ] 63 64 if (dir_pw_third_party_nanopb != "") { 65 public_deps += [ "$dir_pw_third_party/nanopb" ] 66 } 67} 68 69pw_source_set("test_method_context") { 70 public_configs = [ ":public" ] 71 public = [ "public/pw_rpc/nanopb_test_method_context.h" ] 72 public_deps = [ 73 ":method", 74 dir_pw_assert, 75 dir_pw_containers, 76 ] 77} 78 79pw_source_set("internal_test_utils") { 80 public = [ "pw_rpc_nanopb_private/internal_test_utils.h" ] 81 public_deps = [] 82 if (dir_pw_third_party_nanopb != "") { 83 public_deps += [ "$dir_pw_third_party/nanopb" ] 84 } 85} 86 87pw_source_set("echo_service") { 88 public_configs = [ ":public" ] 89 public_deps = [ "..:protos.nanopb_rpc" ] 90 sources = [ "public/pw_rpc/echo_service_nanopb.h" ] 91} 92 93pw_doc_group("docs") { 94 sources = [ "docs.rst" ] 95} 96 97pw_test_group("tests") { 98 tests = [ 99 ":client_call_test", 100 ":codegen_test", 101 ":echo_service_test", 102 ":method_lookup_test", 103 ":nanopb_method_test", 104 ":nanopb_method_union_test", 105 ":stub_generation_test", 106 ] 107} 108 109pw_test("client_call_test") { 110 deps = [ 111 ":client", 112 ":internal_test_utils", 113 "..:test_protos.nanopb", 114 "..:test_utils", 115 ] 116 sources = [ "nanopb_client_call_test.cc" ] 117 enable_if = dir_pw_third_party_nanopb != "" 118} 119 120pw_test("codegen_test") { 121 deps = [ 122 ":client", 123 ":internal_test_utils", 124 ":test_method_context", 125 "..:server", 126 "..:test_protos.nanopb_rpc", 127 "..:test_utils", 128 ] 129 sources = [ "codegen_test.cc" ] 130 enable_if = dir_pw_third_party_nanopb != "" 131} 132 133pw_test("nanopb_method_test") { 134 deps = [ 135 ":internal_test_utils", 136 ":method_union", 137 "..:server", 138 "..:test_protos.nanopb", 139 "..:test_utils", 140 ] 141 sources = [ "nanopb_method_test.cc" ] 142 enable_if = dir_pw_third_party_nanopb != "" 143} 144 145pw_test("method_lookup_test") { 146 deps = [ 147 ":method", 148 ":test_method_context", 149 "..:test_protos.nanopb_rpc", 150 "..:test_utils", 151 "../raw:test_method_context", 152 ] 153 sources = [ "method_lookup_test.cc" ] 154 enable_if = dir_pw_third_party_nanopb != "" 155} 156 157pw_test("nanopb_method_union_test") { 158 deps = [ 159 ":internal_test_utils", 160 ":method_union", 161 "..:test_protos.nanopb", 162 "..:test_utils", 163 ] 164 sources = [ "nanopb_method_union_test.cc" ] 165 enable_if = dir_pw_third_party_nanopb != "" 166} 167 168pw_test("echo_service_test") { 169 deps = [ 170 ":echo_service", 171 ":method", 172 ":test_method_context", 173 ] 174 sources = [ "echo_service_test.cc" ] 175 enable_if = dir_pw_third_party_nanopb != "" 176} 177 178pw_test("stub_generation_test") { 179 deps = [ "..:test_protos.nanopb_rpc" ] 180 sources = [ "stub_generation_test.cc" ] 181 enable_if = dir_pw_third_party_nanopb != "" 182} 183