Skip to content

Commit

Permalink
copybara: strip out code that depends on PyProto_API.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 644613416
  • Loading branch information
Ralf W. Grosse-Kunstleve authored and copybara-github committed Jun 19, 2024
1 parent af8ee51 commit 38b7df6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 277 deletions.
17 changes: 4 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ target_include_directories(
# ============================================================================
# pybind11_native_proto_caster shared library
add_library(
pybind11_native_proto_caster SHARED
pybind11_native_proto_caster STATIC
# bazel: pybind_library: native_proto_caster
pybind11_protobuf/native_proto_caster.h
# bazel: pybind_library: enum_type_caster
pybind11_protobuf/enum_type_caster.h
# bazel: pybind_library: proto_cast_util
pybind11_protobuf/proto_cast_util.cc
pybind11_protobuf/proto_cast_util.h
pybind11_protobuf/proto_caster_impl.h
# bazel: cc_library::check_unknown_fields
pybind11_protobuf/check_unknown_fields.cc
pybind11_protobuf/check_unknown_fields.h)
pybind11_protobuf/proto_caster_impl.h)

target_link_libraries(
pybind11_native_proto_caster
Expand All @@ -92,16 +89,13 @@ target_include_directories(
# ============================================================================
# pybind11_wrapped_proto_caster shared library
add_library(
pybind11_wrapped_proto_caster SHARED
pybind11_wrapped_proto_caster STATIC
# bazel: pybind_library: wrapped_proto_caster
pybind11_protobuf/wrapped_proto_caster.h
# bazel: pybind_library: proto_cast_util
pybind11_protobuf/proto_cast_util.cc
pybind11_protobuf/proto_cast_util.h
pybind11_protobuf/proto_caster_impl.h
# bazel: cc_library: check_unknown_fields
pybind11_protobuf/check_unknown_fields.cc
pybind11_protobuf/check_unknown_fields.h)
pybind11_protobuf/proto_caster_impl.h)

target_link_libraries(
pybind11_wrapped_proto_caster
Expand All @@ -119,9 +113,6 @@ target_include_directories(
PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
${pybind11_INCLUDE_DIRS})

# TODO set defines PYBIND11_PROTOBUF_ENABLE_PYPROTO_API see: bazel:
# pybind_library: proto_cast_util

# bazel equivs. checklist
#
# bazel: pybind_library: enum_type_caster - enum_type_caster.h
Expand Down
20 changes: 0 additions & 20 deletions pybind11_protobuf/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Pybind11 bindings for Google's Protocol Buffers

load("@pybind11_bazel//:build_defs.bzl", "pybind_library")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

licenses(["notice"])

Expand Down Expand Up @@ -30,32 +29,13 @@ pybind_library(
],
)

# To enable PyProto_API use, specify:
# bazel build --@//:enable_pyproto_api
bool_flag(
name = "enable_pyproto_api",
build_setting_default = False,
)

config_setting(
name = "enable_pyproto_api_setting",
flag_values = {
":enable_pyproto_api": "True",
},
visibility = ["//visibility:private"],
)

pybind_library(
name = "proto_cast_util",
srcs = ["proto_cast_util.cc"],
hdrs = [
"proto_cast_util.h",
"proto_caster_impl.h",
],
local_defines = select({
":enable_pyproto_api_setting": ["PYBIND11_PROTOBUF_ENABLE_PYPROTO_API"],
"//conditions:default": [],
}),
deps = [
":check_unknown_fields",
"@com_google_absl//absl/container:flat_hash_map",
Expand Down
3 changes: 0 additions & 3 deletions pybind11_protobuf/native_proto_caster.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "google/protobuf/message.h"
#include "absl/strings/string_view.h"
#include "pybind11_protobuf/check_unknown_fields.h"
#include "pybind11_protobuf/enum_type_caster.h"
#include "pybind11_protobuf/proto_caster_impl.h"

Expand Down Expand Up @@ -64,8 +63,6 @@ inline void ImportNativeProtoCasters() { InitializePybindProtoCastUtil(); }
inline void AllowUnknownFieldsFor(
absl::string_view top_message_descriptor_full_name,
absl::string_view unknown_field_parent_message_fqn) {
check_unknown_fields::AllowUnknownFieldsFor(top_message_descriptor_full_name,
unknown_field_parent_message_fqn);
}

} // namespace pybind11_protobuf
Expand Down
Loading

0 comments on commit 38b7df6

Please sign in to comment.