Skip to content

Commit

Permalink
TEST: rework pytbind_protobuf fix
Browse files Browse the repository at this point in the history
* Try to get rid of ${Python_LIBRARIES} unavailable on manylinux
note: module should link against libpython but only depends on python.h
since it will be dynamic loaded in the python process
  • Loading branch information
Mizux committed Jul 24, 2023
1 parent 06aae5e commit d02e7aa
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions patches/pybind11_protobuf.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e936f66..5461aaf 100644
index e936f66..eaac571 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,7 @@ target_include_directories(
@@ -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})
+ pybind11_proto_utils PRIVATE
+ 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(
# ============================================================================
# pybind11_native_proto_caster shared library
add_library(
Expand All @@ -11,7 +33,12 @@ index e936f66..5461aaf 100644
# bazel: pybind_library: native_proto_caster
pybind11_protobuf/native_proto_caster.h
# bazel: pybind_library: enum_type_caster
@@ -83,6 +83,8 @@ target_link_libraries(
@@ -79,10 +81,12 @@ target_link_libraries(
absl::optional
protobuf::libprotobuf
pybind11::pybind11
- ${Python_LIBRARIES})
+ Python3::Module)

target_include_directories(
pybind11_native_proto_caster
Expand All @@ -20,6 +47,15 @@ index e936f66..5461aaf 100644
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
Expand Down

0 comments on commit d02e7aa

Please sign in to comment.