vcpkg/ports/srpc/protobuf.patch
Dennis 561d171d79
[grpc/protobuf] Update grpc to 1.60.0 and update protobuf to 3.25.1 (#35781)
Resolves https://github.com/microsoft/vcpkg/issues/35566

This pr includes https://github.com/microsoft/vcpkg/pull/31159 and
https://github.com/microsoft/vcpkg/pull/35399

Ports changed in this pr:

Most of these changes stem from the fact that protobuf now depends on
abseil and requires c++14 while ports consume protobuf using
`target_link_libraries(lib ${Protobuf_LIBRARIES})` instead of
`target_link_libraries(lib PUBLIC protobuf::libprotobuf)`.

* **abseil** Updated to 03/04/2024 to address MSVC build issue in
openvino
* **arcus** Updated to 4.13.2
* **braft** Patched to use `find_package(Protobuf` instead of custom
FindProtobuf module. also link with `PUBLIC protobuf::libprotobuf)`.
* **brpc** Patch several `target_link_library` calls to include `PUBLIC`
instead of nothing. Patch some warnings that are treated as errors by
some OSX compiler. Patch usage of changed protobuf features most
importantly removal of `SetLogHandler`, tbd whether this patch is
acceptable with upstream.
* **cld3** Use CONFIG to find protobuf to propagate dependent abseil
libs and cxx14 correctly.
* **ecal** Use CONFIG to find protobuf. Use PUBLIC when linking it.
* **gamenetworkingsockets** Add `-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=on`
for protobuf.
* **gz-transport12** Update to fix usage of removed protobuf features.
* **ignition-msgs1/5/6** Remove protobuf version check which is confused
by the duplicate versioning scheme (v25.1 vs. 3.25.1 vs 4.x). Why are we
even maintaining this no longer maintained major version of this port? I
would welcome a more strict policy on removing ports/adding them to
ci.baseline.txt
* **ignition-transport4/8/9** Same as above + cherry-pick a protobuf
deprecation patch.
* **libprotobuf-mutator** Cherry-pick two commits to address altered
protobuf functionality. Add CONFIG and PUBLIC to protobuf handling in
CMake.
* **marble** Explicitly set protobuf to not found since it is not part
of the vcpkg.json but is made available transitively but another
dependency.
* **mysql-connector-cpp** Several CMake changes and removal of
protobuf::SetLogHandler patch.
* **openvino** Find protobuf using CONFIG
* **osgearth** Link libraries using PUBLIC and link with
protobuf::libprotobuf instead of Protobuf_LIBRARIES
* **paraview** Find protobuf using CONFIG and remove version check
* **pulsar-client-cpp** Add protobuf linkage to PULSAR_OBJECT_LIB.
Simplify protoc patch. Remove -Werror.
* **shogun** Update and patch as much as possible. Users are required to
override bitsery version to 4.x to use shogun since it does not support
5.x provided by vcpkg. Therefore add shogun to ci.baseline.txt.
* **srpc** Update and fix static crt linkage. Patch protobuf linkage and
remove hardcoded `-std=c++11` flag. Protobuf requires c++14 and CMake
does not recognize the hardcoded c++11 flag and will therefore not add a
c++14 flag when the compiler uses c++14 by default.
* **upb** Update to align version with protobuf/grpc and use new github
repo. Patch usual CMake mess (they do not support CMake officially)
which should probably be `unofficial-upbConfig.cmake` but I didn't dig
into downstream implications so I kept it at `upbConfig.cmake` as
before.
* **utf8-range** Update to allign version with protobuf.
2024-06-21 13:39:50 -07:00

149 lines
4.8 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c1aafc..97854a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,11 +58,10 @@ else ()
endif ()
check_include_file_cxx("workflow/Workflow.h" WORKFLOW_INSTALLED)
-if (NOT WORKFLOW_INSTALLED)
+if (0)
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/workflow/workflow-config.cmake.in")
message( FATAL_ERROR "\nWorkflow" ${THIRD_PARTY_FATAL_MESSAGE} )
endif ()
-else ()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/workflow/workflow-config.cmake.in")
message("Workflow third_party FOUND. Use for source code dependencies.")
set(WORKFLOW_INSTALLED 0)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3b47ee6..15c8009 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,7 +16,7 @@ set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
if (WIN32)
find_package(Protobuf REQUIRED CONFIG)
else ()
- find_package(Protobuf 3.5.0 REQUIRED)
+ find_package(Protobuf CONFIG REQUIRED)
endif ()
if (WIN32)
@@ -59,8 +59,8 @@ if (WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /wd4200")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /Zc:__cplusplus /std:c++14")
else ()
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pipe -std=gnu90")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++11 -fno-exceptions")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pipe")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -fno-exceptions")
endif ()
add_subdirectory(generator)
@@ -100,6 +100,7 @@ if (WIN32)
)
add_dependencies(${PROJECT_NAME} LINK_HEADERS)
+ target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
target_compile_definitions(
${PROJECT_NAME} PRIVATE
@@ -118,7 +119,6 @@ if (WIN32)
else ()
set(STATIC_LIB_NAME ${PROJECT_NAME}-static)
set(SHARED_LIB_NAME ${PROJECT_NAME}-shared)
- get_filename_component(Protobuf_LIB_DIR ${Protobuf_LIBRARY} DIRECTORY)
link_directories(${OPENSSL_LINK_DIR} ${WORKFLOW_LIB_DIR} ${Protobuf_LIB_DIR})
add_library(
@@ -143,8 +143,10 @@ else ()
$<TARGET_OBJECTS:http>
)
+ target_link_libraries(${SHARED_LIB_NAME} PUBLIC protobuf::libprotobuf)
+ target_link_libraries(${STATIC_LIB_NAME} PUBLIC protobuf::libprotobuf)
if (APPLE)
- target_link_libraries(${SHARED_LIB_NAME}
+ target_link_libraries(${SHARED_LIB_NAME} PUBLIC
OpenSSL::SSL
OpenSSL::Crypto
pthread
diff --git a/src/compress/CMakeLists.txt b/src/compress/CMakeLists.txt
index 818b505..c0d1dde 100644
--- a/src/compress/CMakeLists.txt
+++ b/src/compress/CMakeLists.txt
@@ -51,3 +51,4 @@ else ()
)
endif()
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
diff --git a/src/generator/CMakeLists.txt b/src/generator/CMakeLists.txt
index c2d72d7..674c5d0 100644
--- a/src/generator/CMakeLists.txt
+++ b/src/generator/CMakeLists.txt
@@ -8,6 +8,7 @@ set(SRC
)
add_executable(${PROJECT_NAME} ${SRC})
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
if (WIN32)
target_compile_definitions(
${PROJECT_NAME} PRIVATE
diff --git a/src/http/CMakeLists.txt b/src/http/CMakeLists.txt
index 64c0377..1cf1dfc 100644
--- a/src/http/CMakeLists.txt
+++ b/src/http/CMakeLists.txt
@@ -11,6 +11,7 @@ set(SRC
)
add_library(${PROJECT_NAME} OBJECT ${SRC})
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
if (WIN32)
target_compile_definitions(
${PROJECT_NAME} PRIVATE
diff --git a/src/message/CMakeLists.txt b/src/message/CMakeLists.txt
index 952607f..f947540 100644
--- a/src/message/CMakeLists.txt
+++ b/src/message/CMakeLists.txt
@@ -15,6 +15,7 @@ set(SRC
)
add_library(${PROJECT_NAME} OBJECT ${SRC})
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
if (WIN32)
target_compile_definitions(
${PROJECT_NAME} PRIVATE
diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt
index f0041a4..a9d9a65 100644
--- a/src/module/CMakeLists.txt
+++ b/src/module/CMakeLists.txt
@@ -22,6 +22,7 @@ set(SRC
)
add_library(${PROJECT_NAME} OBJECT ${SRC})
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
if (WIN32)
target_compile_definitions(
diff --git a/src/thrift/CMakeLists.txt b/src/thrift/CMakeLists.txt
index 1d1d61c..dc66723 100644
--- a/src/thrift/CMakeLists.txt
+++ b/src/thrift/CMakeLists.txt
@@ -7,4 +7,4 @@ set(SRC
)
add_library(${PROJECT_NAME} OBJECT ${SRC})
-
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)
diff --git a/srpc-config.cmake.in b/srpc-config.cmake.in
index 54b4323..1cdb97f 100644
--- a/srpc-config.cmake.in
+++ b/srpc-config.cmake.in
@@ -3,7 +3,6 @@
set(SRPC_VERSION "@srpc_VERSION@")
set_and_check(SRPC_INCLUDE_DIR "@PACKAGE_CONFIG_INC_DIR@")
set_and_check(SRPC_LIB_DIR "@PACKAGE_CONFIG_LIB_DIR@")
-set_and_check(SRPC_BIN_DIR "@PACKAGE_CONFIG_BIN_DIR@")
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/srpc-targets.cmake")
include ("${CMAKE_CURRENT_LIST_DIR}/srpc-targets.cmake")