Skip to content

Commit

Permalink
testing...
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jul 9, 2024
1 parent f9adb26 commit 576c631
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 9 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ new_git_repository(

new_git_repository(
name = "pybind11_protobuf",
commit = "e90f33efeb2ae5c4e85ef83b22298f58e1e30894", # 2024/06/21
commit = "84653a591aea5df482dc2bde42c19efafbd53a57", # 2024/06/28
remote = "https://github.com/pybind/pybind11_protobuf.git",
)

Expand Down
11 changes: 8 additions & 3 deletions cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ if(BUILD_Protobuf)
FetchContent_Declare(
Protobuf
GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
GIT_TAG "v27.2"
#GIT_TAG "v27.2"
#GIT_TAG "v27.1"
GIT_TAG "v27.0"
GIT_SHALLOW TRUE
GIT_SUBMODULES ""
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/protobuf-v27.2.patch")
Expand Down Expand Up @@ -204,9 +206,12 @@ if(BUILD_PYTHON AND BUILD_pybind11_protobuf)
FetchContent_Declare(
pybind11_protobuf
GIT_REPOSITORY "https://github.com/pybind/pybind11_protobuf.git"
GIT_TAG "e90f33efeb2ae5c4e85ef83b22298f58e1e30894" # 2024/06/21
GIT_TAG "84653a591aea5df482dc2bde42c19efafbd53a57" # 2024/06/28
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11_protobuf_84653a5.patch"

#GIT_TAG "3b11990a99dea5101799e61d98a82c4737d240cc" # 2024/01/04
#PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11_protobuf.patch"
#GIT_SHALLOW TRUE
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11_protobuf.patch"
)
FetchContent_MakeAvailable(pybind11_protobuf)
list(POP_BACK CMAKE_MESSAGE_INDENT)
Expand Down
16 changes: 14 additions & 2 deletions patches/protobuf-v27.2.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b51e9722..33c1021d4 100644
index 9b51e972..33c1021d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ else (BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -54,8 +54,20 @@ index 9b51e9722..33c1021d4 100644
${protobuf_BINARY_DIR}
# Support #include-ing other top-level directories, i.e. upb_generator.
${protobuf_SOURCE_DIR}
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index 11c09b1b..fdea9ce1 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -28,6 +28,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
endif()
target_include_directories(libprotobuf PUBLIC
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
+ $<BUILD_INTERFACE:${protobuf_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(libprotobuf PUBLIC ${protobuf_ABSL_USED_TARGETS})
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
index 4fec7dc13..afb6f846a 100644
index 4fec7dc1..afb6f846 100644
--- a/src/google/protobuf/port.h
+++ b/src/google/protobuf/port.h
@@ -49,31 +49,35 @@ inline PROTOBUF_ALWAYS_INLINE void StrongPointer(T* var) {
Expand Down
6 changes: 3 additions & 3 deletions patches/pybind11_protobuf.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26dce5c..26d1648 100644
index 46388d1..a035b25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ option(BUILD_TESTS "Build tests." OFF)
Expand Down Expand Up @@ -33,7 +33,7 @@ index 26dce5c..26d1648 100644
# bazel: pybind_library: native_proto_caster
pybind11_protobuf/native_proto_caster.h
# bazel: pybind_library: enum_type_caster
@@ -79,10 +81,12 @@ target_link_libraries(
@@ -82,10 +84,12 @@ target_link_libraries(
absl::optional
protobuf::libprotobuf
pybind11::pybind11
Expand All @@ -47,7 +47,7 @@ index 26dce5c..26d1648 100644
PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
${pybind11_INCLUDE_DIRS})

@@ -106,7 +110,7 @@ target_link_libraries(
@@ -112,7 +116,7 @@ target_link_libraries(
absl::optional
protobuf::libprotobuf
pybind11::pybind11
Expand Down
48 changes: 48 additions & 0 deletions patches/pybind11_protobuf_84653a5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2139dc0..1942ad0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ include(CTest)
# ============================================================================
# Find Python

-find_package(Python COMPONENTS Interpreter Development)
+find_package(Python3 COMPONENTS Interpreter Development.Module)

# ============================================================================
# Build dependencies
@@ -87,8 +87,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}
@@ -116,10 +118,11 @@ target_link_libraries(
absl::optional
protobuf::libprotobuf
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})

@@ -143,7 +146,7 @@ target_link_libraries(
absl::optional
protobuf::libprotobuf
pybind11::pybind11
- ${Python_LIBRARIES})
+ Python3::Module)

target_include_directories(
pybind11_wrapped_proto_caster

0 comments on commit 576c631

Please sign in to comment.