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

141 lines
3.7 KiB
Diff
Raw Normal View History

2020-10-20 10:15:04 +08:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c848b50605..7822c4f713 100644
2020-10-20 10:15:04 +08:00
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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")
@@ -2037,7 +2040,6 @@ target_link_libraries(grpc
2020-10-20 10:15:04 +08:00
${_gRPC_ALLTARGETS_LIBRARIES}
gpr
address_sorting
- upb
absl::optional
absl::strings
absl::statusor
@@ -2122,7 +2124,6 @@ target_link_libraries(grpc_csharp_ext
2020-10-20 10:15:04 +08:00
grpc
gpr
address_sorting
- upb
)
@@ -2590,7 +2591,6 @@ target_link_libraries(grpc_unsecure
2020-10-20 10:15:04 +08:00
${_gRPC_ALLTARGETS_LIBRARIES}
gpr
address_sorting
- upb
absl::optional
absl::strings
absl::statusor
@@ -2792,7 +2792,6 @@ target_link_libraries(grpc++
2020-10-20 10:15:04 +08:00
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
@@ -3040,7 +3039,6 @@ target_link_libraries(grpc++_alts
2020-10-20 10:15:04 +08:00
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
@@ -3104,7 +3102,6 @@ target_link_libraries(grpc++_error_details
2020-10-20 10:15:04 +08:00
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
@@ -3174,7 +3171,6 @@ target_link_libraries(grpc++_reflection
2020-10-20 10:15:04 +08:00
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
@@ -3454,7 +3450,6 @@ target_link_libraries(grpc++_unsecure
2020-10-20 10:15:04 +08:00
grpc_unsecure
gpr
address_sorting
- upb
)
foreach(_hdr
@@ -3773,7 +3768,6 @@ target_link_libraries(grpcpp_channelz
2020-10-20 10:15:04 +08:00
grpc
gpr
address_sorting
- upb
)
foreach(_hdr
@@ -3799,6 +3793,7 @@ endif()
2020-10-20 10:15:04 +08:00
endif()
+if (gRPC_UPB_PROVIDER STREQUAL "module")
add_library(upb
third_party/upb/upb/decode_fast.c
2020-10-20 10:15:04 +08:00
third_party/upb/upb/decode.c
@@ -3857,7 +3852,7 @@ if(gRPC_INSTALL)
2020-10-20 10:15:04 +08:00
)
endif()
-
+endif()
add_executable(check_epollexclusive
test/build/check_epollexclusive.c
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
2020-10-28 11:33:33 +08:00
index 3623f4aa5e..df6ced560e 100644
2020-10-20 10:15:04 +08:00
--- a/cmake/gRPCConfig.cmake.in
+++ b/cmake/gRPCConfig.cmake.in
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
@_gRPC_FIND_CARES@
@_gRPC_FIND_ABSL@
@_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-10-28 11:33:33 +08:00
index f2a0e508c3..ecce7ba300 100644
2020-10-20 10:15:04 +08:00
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -12,9 +12,20 @@
# 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" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated")
2020-10-20 10:15:04 +08:00
+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" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-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()