vcpkg/ports/grpc/00009-use-system-upb.patch
Dennis 0cb819175b
[grpc] Update to 1.46.3 (#25071)
* Update gRPC to 1.46.3 and upb to 2022-06-01

* fix(upb): Ensure that protoc-gen-upb has been build before running protobuf_generate. Also add license to vcpkg.json

* fix(upb): Let abseil propagate cxx_std_11. Build upb codegen tools in host triplet

* Revert abseil's cxx_std propagation

* fix(upb): Attempt to fix missing -std=c++11 flag when compiling x64-osx

* Downgrade upb to the version used by gRPC. No longer installed generated descriptor.upb.h files just to use them when compiling target triplet

* Remove absl-sync patch from gRPC since it is always enabled by default now

* Use vcpkg's upb library in gRPC instead of embedded one. Also fix gRPC's pkgconfig patch

* grpc: Remove the upb::all_libs target

* grpc: Adjust versions json

* upb: Adjust versions json

* Set feature absl-sync as deprecated

* version

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2022-07-14 14:08:28 -07:00

77 lines
2.8 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7e591f083..e16e70a224 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,6 +85,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")
@@ -1369,7 +1372,7 @@ target_link_libraries(gpr
absl::synchronization
absl::time
absl::optional
- upb
+ ${_gRPC_UPB_LIBRARIES}
)
if(_gRPC_PLATFORM_ANDROID)
target_link_libraries(gpr
@@ -3957,6 +3960,7 @@ endif()
endif()
+if (gRPC_UPB_PROVIDER STREQUAL "module")
add_library(upb
third_party/upb/third_party/utf8_range/naive.c
third_party/upb/third_party/utf8_range/range2-neon.c
@@ -4018,7 +4022,7 @@ if(gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
-
+endif()
add_executable(gen_hpack_tables
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
index 3623f4aa5e..df6ced560e 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 f2a0e508c3..09751f5ef0 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -12,9 +12,19 @@
# 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::fastdecode upb::json upb::upb upb::utf8_range upb::textformat upb::reflection upb::descriptor_upb_proto)
+ set(_gRPC_UPB_INCLUDE_DIR)
+ set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()")
+endif()