blob: 17e11b994f17b3aa57ee438fb3651a50aac7e428 [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",
"..:config",
"..:server",
]
deps = [ dir_pw_log ]
}
pw_source_set("method_union") {
public_configs = [ ":public" ]
public = [ "public/pw_rpc/internal/nanopb_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 = [ "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("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",
":nanopb_method_test",
":nanopb_method_union_test",
":stub_generation_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 = [
":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("nanopb_method_test") {
deps = [
":internal_test_utils",
":method_union",
"..:server",
"..:test_protos.nanopb",
"..:test_utils",
]
sources = [ "nanopb_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("nanopb_method_union_test") {
deps = [
":internal_test_utils",
":method_union",
"..:test_protos.nanopb",
"..:test_utils",
]
sources = [ "nanopb_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 != ""
}