summaryrefslogtreecommitdiff
path: root/chromium/third_party/grpc/grpc_library.gni
blob: 091706622cddc5a67ec5d01b334fa093660dcfc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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",
    ]
  }
}