# Copyright Materialize, Inc. and contributors. All rights reserved. # # 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 in the LICENSE file at the # root of this repository, or online at # # http://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. load("@//misc/bazel/rules:rust_cxx_bridge.bzl", "rust_cxx_bridge") cc_library( name = "protobuf-native-bridge", srcs = [ "src/compiler.cc", "src/compiler.rs.cc", "src/io.cc", "src/io.rs.cc", "src/lib.cc", "src/lib.rs.cc", ], hdrs = glob(["src/**/*.h"]), copts = ["-std=c++17"], include_prefix = "protobuf-native", linkstatic = True, deps = [ ":compiler-bridge/include", ":internal-bridge", ":internal-bridge/include", ":io-bridge/include", ":lib-bridge/include", "@com_google_absl//absl/strings", "@com_google_protobuf//src/google/protobuf/compiler:code_generator", "@com_google_protobuf//src/google/protobuf/compiler:importer", "@crates_io__cxx-1.0.122//:cxx_cc", ], ) rust_cxx_bridge( name = "compiler-bridge", src = "src/compiler.rs", headers_prefix = "protobuf-native", deps = [":internal-include"], ) rust_cxx_bridge( name = "io-bridge", src = "src/io.rs", headers_prefix = "protobuf-native", deps = [ ":internal-include", ":io-include", ], ) rust_cxx_bridge( name = "lib-bridge", src = "src/lib.rs", headers_prefix = "protobuf-native", deps = [ ":internal-include", ":lib-include", ], ) rust_cxx_bridge( name = "internal-bridge", src = "src/internal.rs", headers_prefix = "protobuf-native", deps = [":internal-include"], ) cc_library( name = "internal-include", hdrs = ["src/internal.h"], include_prefix = "protobuf-native", deps = [ "@com_google_absl//absl/strings", "@crates_io__cxx-1.0.122//:cxx_cc", ], )