grpc_library.gni 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Copyright 2019 Google Inc. All Rights Reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. # Compile a grpc service.
  5. #
  6. # Example:
  7. # grpc_library("mylib") {
  8. # sources = [
  9. # "foo.proto",
  10. # ]
  11. # }
  12. import("//build/config/sanitizers/sanitizers.gni")
  13. import("//third_party/protobuf/proto_library.gni")
  14. template("grpc_library") {
  15. assert(defined(invoker.sources), "Need sources for proto_library")
  16. proto_library(target_name) {
  17. forward_variables_from(invoker,
  18. [
  19. "cc_include",
  20. "extra_configs",
  21. "generate_python",
  22. "import_dirs",
  23. "link_deps",
  24. "proto_in_dir",
  25. "proto_out_dir",
  26. "sources",
  27. "testonly",
  28. "visibility",
  29. "deps",
  30. "proto_deps",
  31. ])
  32. if (defined(invoker.use_protobuf_full)) {
  33. use_protobuf_full = invoker.use_protobuf_full
  34. } else {
  35. cc_generator_options = "lite"
  36. }
  37. if (!defined(extra_configs)) {
  38. extra_configs = []
  39. }
  40. extra_configs += [ "//third_party/grpc:grpc_config" ]
  41. generate_cc = true
  42. generator_plugin_label = "//third_party/grpc:grpc_cpp_plugin"
  43. generator_plugin_suffix = ".grpc.pb"
  44. }
  45. }