vcpkg/ports/grpc/00009-use-system-upb.patch

140 lines
3.4 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
2020-08-23 13:25:20 +08:00
index a337149f1f..6baab5d37b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
2020-08-23 13:25:20 +08:00
@@ -84,6 +84,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library")
set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package")
+set(gRPC_UPB_PROVIDER "module" CACHE STRING "Provider of upb library")
+set_property(CACHE gRPC_UPB_PROVIDER PROPERTY STRINGS "module" "package")
+
set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package")
set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE")
2020-08-23 13:25:20 +08:00
@@ -1807,7 +1810,6 @@ target_link_libraries(grpc
${_gRPC_ALLTARGETS_LIBRARIES}
gpr
address_sorting
- upb
absl::optional
absl::strings
absl::inlined_vector
2020-08-23 13:25:20 +08:00
@@ -1887,7 +1889,6 @@ target_link_libraries(grpc_csharp_ext
grpc
gpr
address_sorting
- upb
)
2020-08-23 13:25:20 +08:00
@@ -2409,7 +2410,6 @@ target_link_libraries(grpc_unsecure
${_gRPC_ALLTARGETS_LIBRARIES}
gpr
address_sorting
- upb
absl::optional
absl::strings
absl::inlined_vector
2020-08-23 13:25:20 +08:00
@@ -2606,7 +2606,6 @@ target_link_libraries(grpc++
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
2020-08-23 13:25:20 +08:00
@@ -2876,7 +2875,6 @@ target_link_libraries(grpc++_alts
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
2020-08-23 13:25:20 +08:00
@@ -2945,7 +2943,6 @@ target_link_libraries(grpc++_error_details
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
2020-08-23 13:25:20 +08:00
@@ -3019,7 +3016,6 @@ target_link_libraries(grpc++_reflection
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
2020-08-23 13:25:20 +08:00
@@ -3300,7 +3296,6 @@ target_link_libraries(grpc++_unsecure
grpc_unsecure
gpr
address_sorting
- upb
)
foreach(_hdr
2020-08-23 13:25:20 +08:00
@@ -3642,7 +3637,6 @@ target_link_libraries(grpcpp_channelz
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
2020-08-23 13:25:20 +08:00
@@ -3669,6 +3663,7 @@ endif()
endif()
+if (gRPC_UPB_PROVIDER STREQUAL "module")
add_library(upb
third_party/upb/upb/decode.c
third_party/upb/upb/encode.c
2020-08-23 13:25:20 +08:00
@@ -3719,7 +3714,7 @@ if(gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
-
+endif()
add_executable(check_epollexclusive
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
2020-08-23 13:25:20 +08:00
index 3623f4aa5e..df6ced560e 100644
--- a/cmake/gRPCConfig.cmake.in
+++ b/cmake/gRPCConfig.cmake.in
2020-08-23 13:25:20 +08:00
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
@_gRPC_FIND_CARES@
@_gRPC_FIND_ABSL@
2020-08-23 13:25:20 +08:00
@_gRPC_FIND_RE2@
+@_gRPC_FIND_UPB@
# Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)
diff --git a/cmake/upb.cmake b/cmake/upb.cmake
2020-08-22 16:16:03 +08:00
index 2c0ab84e67..07dd613a78 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -12,9 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated")
+if (gRPC_UPB_PROVIDER STREQUAL "module")
set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb)
set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}")
-set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated")
set(_gRPC_UPB_LIBRARIES upb)
+
+elseif(gRPC_UPB_PROVIDER STREQUAL "package")
+ find_package(upb CONFIG REQUIRED)
+ set(_gRPC_UPB_LIBRARIES upb::upb)
+ set(_gRPC_UPB_INCLUDE_DIR)
+ set(upb ${_gRPC_UPB_LIBRARIES})
+ set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()")
+endif()