vcpkg/ports/grpc/00009-use-system-upb.patch
JonLiu1993 756f184553
[gRPC] update to v1.41.0 (#20835)
* [gRPC] update to v1.41.0

* update version

* [upb] Update to 2021-10-19

* Update pacth

* [upb] Fix upstream bug

* Replace depreciate functions

* version

* fix code

* version

* revert patch format

* update version

* Fix review advise

* update version

* Remove extra spaces

* update version

* update version

* Remove space in patch file

* change patch format from CRLF to CF

* update version

* revert patch format

* update version

* revert patch format

* update version

* Remove unnecessary additional

* update version

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
2021-11-11 11:34:39 -08:00

79 lines
2.6 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c3146b..ae06ea3 100644
--- 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")
@@ -1504,7 +1507,6 @@ target_link_libraries(gpr
absl::synchronization
absl::time
absl::optional
- upb
)
if(_gRPC_PLATFORM_ANDROID)
target_link_libraries(gpr
@@ -3927,6 +3929,7 @@ endif()
endif()
+if (gRPC_UPB_PROVIDER STREQUAL "module")
add_library(upb
third_party/upb/upb/decode_fast.c
third_party/upb/upb/decode.c
@@ -3984,7 +3987,7 @@ if(gRPC_INSTALL)
)
endif()
-
+endif()
add_executable(check_epollexclusive
test/build/check_epollexclusive.c
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
index 3623f4a..df6ced5 100644
--- 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
index f2a0e50..ac6d397 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -12,9 +12,21 @@
# 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")
+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()
\ No newline at end of file