| # Copyright 2020 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| import("//build_overrides/pigweed.gni") |
| |
| import("$dir_pw_build/target_types.gni") |
| import("$dir_pw_docgen/docs.gni") |
| import("$dir_pw_third_party/nanopb/nanopb.gni") |
| import("$dir_pw_unit_test/test.gni") |
| |
| config("public") { |
| include_dirs = [ "public" ] |
| visibility = [ ":*" ] |
| } |
| |
| pw_source_set("method") { |
| public_configs = [ ":public" ] |
| public = [ |
| "public/pw_rpc/nanopb/internal/method.h", |
| "public/pw_rpc/nanopb/server_reader_writer.h", |
| ] |
| sources = [ |
| "method.cc", |
| "server_reader_writer.cc", |
| ] |
| public_deps = [ |
| ":common", |
| "..:config", |
| "..:server", |
| dir_pw_bytes, |
| ] |
| deps = [ dir_pw_log ] |
| } |
| |
| pw_source_set("method_union") { |
| public_configs = [ ":public" ] |
| public = [ "public/pw_rpc/nanopb/internal/method_union.h" ] |
| public_deps = [ |
| ":method", |
| "$dir_pw_rpc/raw:method_union", |
| ] |
| } |
| |
| pw_source_set("client") { |
| public_configs = [ ":public" ] |
| public_deps = [ |
| ":common", |
| "..:client", |
| dir_pw_function, |
| ] |
| public = [ "public/pw_rpc/nanopb/client_call.h" ] |
| sources = [ "client_call.cc" ] |
| } |
| |
| pw_source_set("common") { |
| public_deps = [ dir_pw_bytes ] |
| public_configs = [ ":public" ] |
| deps = [ dir_pw_log ] |
| public = [ "public/pw_rpc/nanopb/internal/common.h" ] |
| sources = [ "common.cc" ] |
| |
| if (dir_pw_third_party_nanopb != "") { |
| public_deps += [ "$dir_pw_third_party/nanopb" ] |
| } |
| } |
| |
| pw_source_set("test_method_context") { |
| public_configs = [ ":public" ] |
| public = [ "public/pw_rpc/nanopb/test_method_context.h" ] |
| public_deps = [ |
| ":method", |
| "..:test_utils", |
| dir_pw_assert, |
| dir_pw_containers, |
| ] |
| } |
| |
| pw_source_set("internal_test_utils") { |
| public = [ "pw_rpc_nanopb_private/internal_test_utils.h" ] |
| public_deps = [] |
| if (dir_pw_third_party_nanopb != "") { |
| public_deps += [ "$dir_pw_third_party/nanopb" ] |
| } |
| } |
| |
| pw_source_set("echo_service") { |
| public_configs = [ ":public" ] |
| public_deps = [ "..:protos.nanopb_rpc" ] |
| sources = [ "public/pw_rpc/echo_service_nanopb.h" ] |
| } |
| |
| pw_doc_group("docs") { |
| sources = [ "docs.rst" ] |
| } |
| |
| pw_test_group("tests") { |
| tests = [ |
| ":client_call_test", |
| ":codegen_test", |
| ":echo_service_test", |
| ":method_lookup_test", |
| ":method_test", |
| ":method_union_test", |
| ":stub_generation_test", |
| ] |
| } |
| |
| pw_test("client_call_test") { |
| deps = [ |
| ":client", |
| ":internal_test_utils", |
| "..:test_protos.nanopb", |
| "..:test_utils", |
| ] |
| sources = [ "client_call_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |
| |
| pw_test("codegen_test") { |
| deps = [ |
| ":client", |
| ":internal_test_utils", |
| ":test_method_context", |
| "..:server", |
| "..:test_protos.nanopb_rpc", |
| "..:test_utils", |
| ] |
| sources = [ "codegen_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |
| |
| pw_test("method_test") { |
| deps = [ |
| ":internal_test_utils", |
| ":method_union", |
| "..:server", |
| "..:test_protos.nanopb", |
| "..:test_utils", |
| ] |
| sources = [ "method_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |
| |
| pw_test("method_lookup_test") { |
| deps = [ |
| ":method", |
| ":test_method_context", |
| "..:test_protos.nanopb_rpc", |
| "..:test_utils", |
| "../raw:test_method_context", |
| ] |
| sources = [ "method_lookup_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |
| |
| pw_test("method_union_test") { |
| deps = [ |
| ":internal_test_utils", |
| ":method_union", |
| "..:test_protos.nanopb", |
| "..:test_utils", |
| ] |
| sources = [ "method_union_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |
| |
| pw_test("echo_service_test") { |
| deps = [ |
| ":echo_service", |
| ":method", |
| ":test_method_context", |
| ] |
| sources = [ "echo_service_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |
| |
| pw_test("stub_generation_test") { |
| deps = [ "..:test_protos.nanopb_rpc" ] |
| sources = [ "stub_generation_test.cc" ] |
| enable_if = dir_pw_third_party_nanopb != "" |
| } |