simplify pybind11_protobuf patch and bump git version
This commit is contained in:
@@ -248,7 +248,7 @@ new_git_repository(
|
||||
name = "pybind11_protobuf",
|
||||
#build_file = "@pybind11_bazel//:pybind11.BUILD",
|
||||
#tag = "v2.10.3",
|
||||
commit = "5baa2dc9d93e3b608cde86dfa4b8c63aeab4ac78",
|
||||
commit = "8359a091a9b0bc7deb0233de986c06c885a3ff2d",
|
||||
remote = "https://github.com/pybind/pybind11_protobuf.git",
|
||||
)
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@ index e936f66..eaac571 100644
|
||||
@@ -21,7 +21,7 @@ option(BUILD_TESTS "Build tests." OFF)
|
||||
# ============================================================================
|
||||
# Find Python
|
||||
|
||||
|
||||
-find_package(Python COMPONENTS Interpreter Development)
|
||||
+find_package(Python3 COMPONENTS Interpreter Development.Module)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Build dependencies
|
||||
@@ -47,8 +47,10 @@ pybind11_add_module(
|
||||
pybind11_protobuf/proto_utils.h)
|
||||
|
||||
|
||||
target_link_libraries(
|
||||
- pybind11_proto_utils PRIVATE absl::strings protobuf::libprotobuf
|
||||
- ${Python_LIBRARIES})
|
||||
@@ -21,7 +21,7 @@ index e936f66..eaac571 100644
|
||||
+ absl::strings
|
||||
+ protobuf::libprotobuf
|
||||
+ Python3::Module)
|
||||
|
||||
|
||||
target_include_directories(
|
||||
pybind11_proto_utils PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS}
|
||||
@@ -57,7 +59,7 @@ target_include_directories(
|
||||
@@ -39,46 +39,20 @@ index e936f66..eaac571 100644
|
||||
pybind11::pybind11
|
||||
- ${Python_LIBRARIES})
|
||||
+ Python3::Module)
|
||||
|
||||
|
||||
target_include_directories(
|
||||
pybind11_native_proto_caster
|
||||
+ PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
|
||||
${pybind11_INCLUDE_DIRS})
|
||||
|
||||
|
||||
@@ -109,7 +113,7 @@ target_link_libraries(
|
||||
absl::optional
|
||||
protobuf::libprotobuf
|
||||
pybind11::pybind11
|
||||
- ${Python_LIBRARIES})
|
||||
+ Python3::Module)
|
||||
|
||||
|
||||
target_include_directories(
|
||||
pybind11_wrapped_proto_caster
|
||||
diff --git a/pybind11_protobuf/proto_cast_util.cc b/pybind11_protobuf/proto_cast_util.cc
|
||||
index 06bde44..1cc6a30 100644
|
||||
--- a/pybind11_protobuf/proto_cast_util.cc
|
||||
+++ b/pybind11_protobuf/proto_cast_util.cc
|
||||
@@ -599,13 +599,14 @@ absl::optional<std::string> PyProtoDescriptorName(py::handle py_proto) {
|
||||
|
||||
bool PyProtoIsCompatible(py::handle py_proto, const Descriptor* descriptor) {
|
||||
assert(PyGILState_Check());
|
||||
- if (descriptor->file()->pool() != DescriptorPool::generated_pool()) {
|
||||
- /// This indicates that the C++ descriptor does not come from the C++
|
||||
- /// DescriptorPool. This may happen if the C++ code has the same proto
|
||||
- /// in different descriptor pools, perhaps from different shared objects,
|
||||
- /// and could be result in undefined behavior.
|
||||
- return false;
|
||||
- }
|
||||
+ // if (descriptor->file()->pool() != DescriptorPool::generated_pool()) {
|
||||
+ // /// This indicates that the C++ descriptor does not come from the C++
|
||||
+ // /// DescriptorPool. This may happen if the C++ code has the same proto
|
||||
+ // /// in different descriptor pools, perhaps from different shared objects,
|
||||
+ // /// and could be result in undefined behavior.
|
||||
+ // std::cout << " * Different";
|
||||
+ // return false;
|
||||
+ // }
|
||||
|
||||
auto py_descriptor = ResolveAttrs(py_proto, {"DESCRIPTOR"});
|
||||
if (!py_descriptor) {
|
||||
|
||||
Reference in New Issue
Block a user