From d02e7aa287a5e14b139615c3ec4c82d08590ed3a Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Mon, 24 Jul 2023 15:52:24 +0200 Subject: [PATCH] TEST: rework pytbind_protobuf fix * 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 --- patches/pybind11_protobuf.patch | 42 ++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/patches/pybind11_protobuf.patch b/patches/pybind11_protobuf.patch index 1008de897b3..426a3f41c06 100644 --- a/patches/pybind11_protobuf.patch +++ b/patches/pybind11_protobuf.patch @@ -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( @@ -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 @@ -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