BUILD.protobuf-native.bazel 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License in the LICENSE file at the
  6. # root of this repository, or online at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. load("@//misc/bazel/rules:rust_cxx_bridge.bzl", "rust_cxx_bridge")
  16. cc_library(
  17. name = "protobuf-native-bridge",
  18. srcs = [
  19. "src/compiler.cc",
  20. "src/compiler.rs.cc",
  21. "src/io.cc",
  22. "src/io.rs.cc",
  23. "src/lib.cc",
  24. "src/lib.rs.cc",
  25. ],
  26. hdrs = glob(["src/**/*.h"]),
  27. copts = ["-std=c++17"],
  28. include_prefix = "protobuf-native",
  29. linkstatic = True,
  30. deps = [
  31. ":compiler-bridge/include",
  32. ":internal-bridge",
  33. ":internal-bridge/include",
  34. ":io-bridge/include",
  35. ":lib-bridge/include",
  36. "@com_google_absl//absl/strings",
  37. "@com_google_protobuf//src/google/protobuf/compiler:code_generator",
  38. "@com_google_protobuf//src/google/protobuf/compiler:importer",
  39. "@crates_io__cxx-1.0.122//:cxx_cc",
  40. ],
  41. )
  42. rust_cxx_bridge(
  43. name = "compiler-bridge",
  44. src = "src/compiler.rs",
  45. headers_prefix = "protobuf-native",
  46. deps = [":internal-include"],
  47. )
  48. rust_cxx_bridge(
  49. name = "io-bridge",
  50. src = "src/io.rs",
  51. headers_prefix = "protobuf-native",
  52. deps = [
  53. ":internal-include",
  54. ":io-include",
  55. ],
  56. )
  57. rust_cxx_bridge(
  58. name = "lib-bridge",
  59. src = "src/lib.rs",
  60. headers_prefix = "protobuf-native",
  61. deps = [
  62. ":internal-include",
  63. ":lib-include",
  64. ],
  65. )
  66. rust_cxx_bridge(
  67. name = "internal-bridge",
  68. src = "src/internal.rs",
  69. headers_prefix = "protobuf-native",
  70. deps = [":internal-include"],
  71. )
  72. cc_library(
  73. name = "internal-include",
  74. hdrs = ["src/internal.h"],
  75. include_prefix = "protobuf-native",
  76. deps = [
  77. "@com_google_absl//absl/strings",
  78. "@crates_io__cxx-1.0.122//:cxx_cc",
  79. ],
  80. )