blob: 91e1872aa39604b537ee606159110a27f0c2fdc5 [file] [log] [blame]
# 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/internal/nanopb_method.h" ]
sources = [ "nanopb_method.cc" ]
public_deps = [
":common",
"..:server",
]
deps = [ dir_pw_log ]
}
pw_source_set("client") {
public_configs = [ ":public" ]
public_deps = [
":common",
"..:client",
]
public = [ "public/pw_rpc/nanopb_client_call.h" ]
sources = [ "nanopb_client_call.cc" ]
}
pw_source_set("common") {
public_deps = [ dir_pw_bytes ]
public_configs = [ ":public" ]
public = [ "public/pw_rpc/internal/nanopb_common.h" ]
sources = [ "nanopb_common.cc" ]
if (dir_pw_third_party_nanopb != "") {
public_deps += [ "$dir_pw_third_party/nanopb" ]
}
}
pw_source_set("service_method_traits") {
public_configs = [ ":public" ]
public = [ "public/pw_rpc/internal/service_method_traits.h" ]
public_deps = [
":method",
"..:server",
]
}
pw_source_set("test_method_context") {
public_configs = [ ":public" ]
public = [ "public/pw_rpc/test_method_context.h" ]
public_deps = [
":service_method_traits",
"..:server",
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 = [ "..:echo_service_proto_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",
":nanopb_method_test",
":service_method_traits_test",
]
}
pw_test("client_call_test") {
deps = [
":client",
":internal_test_utils",
"..:test_protos_nanopb",
"..:test_utils",
]
sources = [ "nanopb_client_call_test.cc" ]
enable_if = dir_pw_third_party_nanopb != ""
}
pw_test("codegen_test") {
deps = [
":test_method_context",
"..:server",
"..:test_protos_nanopb_rpc",
]
sources = [ "codegen_test.cc" ]
enable_if = dir_pw_third_party_nanopb != ""
}
pw_test("nanopb_method_test") {
deps = [
":internal_test_utils",
":method",
"..:server",
"..:test_protos_nanopb",
"..:test_utils",
]
sources = [ "nanopb_method_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("service_method_traits_test") {
deps = [
":echo_service",
":method",
":service_method_traits",
":test_method_context",
"..:test_protos_nanopb_rpc",
]
sources = [ "service_method_traits_test.cc" ]
enable_if = dir_pw_third_party_nanopb != ""
}