| # Copyright 2019 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//third_party/protobuf/proto_library.gni") |
| |
| # Compiles a protocol buffer into gRPC C++ interface. |
| # |
| # Example |
| # cc_grpc_library("mylib") { |
| # sources = [ |
| # "foo.proto", |
| # ] |
| # } |
| template("cc_grpc_library") { |
| proto_library_name = "${target_name}_proto_lib" |
| proto_library(proto_library_name) { |
| forward_variables_from(invoker, |
| [ |
| "defines", |
| "deps", |
| "sources", |
| "use_protobuf_full", |
| "import_dirs", |
| ]) |
| remove_configs = [ "//build/config/compiler:chromium_code" ] |
| extra_configs = [ |
| "//build/config/compiler:no_chromium_code", |
| "//third_party/grpc:grpc_config", |
| ] |
| generate_python = false |
| generator_plugin_label = "//third_party/grpc:grpc_cpp_plugin" |
| generator_plugin_suffix = ".grpc.pb" |
| } |
| |
| # This group forces caller to depend on grpcpp, which is required when using |
| # the compiled gRPC library. |
| group(target_name) { |
| public_deps = [ |
| ":${proto_library_name}", |
| "//third_party/grpc:grpcpp", |
| ] |
| } |
| } |