[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>
This commit is contained in:
Dennis 2022-07-14 23:08:28 +02:00 committed by GitHub
parent a480fb0fa3
commit 0cb819175b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 271 additions and 251 deletions

View File

@ -1,8 +1,21 @@
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index cb17759bba..a3c3598430 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -1032,7 +1032,7 @@ class HPackParser::Parser {
private:
void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) {
- const char* type;
+ const char* type = nullptr;
switch (log_info_.type) {
case LogInfo::kHeaders:
type = "HDR";
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index 0dacbfef3e..0743a1b003 100644 index 2e78b4de9e..77e88cab70 100644
--- a/src/core/lib/slice/slice.cc --- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc +++ b/src/core/lib/slice/slice.cc
@@ -234,6 +234,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p, @@ -181,6 +181,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
size_t len) { size_t len) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get()); uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get());
grpc_slice slice; grpc_slice slice;
@ -10,7 +23,7 @@ index 0dacbfef3e..0743a1b003 100644
if (len <= sizeof(slice.data.inlined.bytes)) { if (len <= sizeof(slice.data.inlined.bytes)) {
slice.refcount = nullptr; slice.refcount = nullptr;
slice.data.inlined.length = len; slice.data.inlined.length = len;
@@ -253,7 +254,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) { @@ -199,7 +200,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) {
} }
grpc_slice grpc_slice_from_cpp_string(std::string str) { grpc_slice grpc_slice_from_cpp_string(std::string str) {
@ -20,10 +33,10 @@ index 0dacbfef3e..0743a1b003 100644
slice.refcount = nullptr; slice.refcount = nullptr;
slice.data.inlined.length = str.size(); slice.data.inlined.length = str.size();
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index c94551545d..3fd9797316 100644 index 4c0220837e..bb5a367107 100644
--- a/src/core/lib/surface/server.cc --- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc
@@ -878,7 +878,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) { @@ -902,7 +902,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) {
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown")); GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
return GRPC_CALL_OK; return GRPC_CALL_OK;
} }

View File

@ -1,13 +0,0 @@
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 18abbda..9789983 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -1052,7 +1052,7 @@ class HPackParser::Parser {
private:
void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) {
- const char* type;
+ const char* type = nullptr;
switch (log_info_.type) {
case LogInfo::kHeaders:
type = "HDR";

View File

@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c3146b..ae06ea3 100644 index a7e591f083..e16e70a224 100644
--- a/CMakeLists.txt --- a/CMakeLists.txt
+++ b/CMakeLists.txt +++ b/CMakeLists.txt
@@ -84,6 +84,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package") @@ -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(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library")
set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package")
@ -12,33 +12,34 @@ index 1c3146b..ae06ea3 100644
set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package")
set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE")
@@ -1504,7 +1507,6 @@ target_link_libraries(gpr @@ -1369,7 +1372,7 @@ target_link_libraries(gpr
absl::synchronization absl::synchronization
absl::time absl::time
absl::optional absl::optional
- upb - upb
+ ${_gRPC_UPB_LIBRARIES}
) )
if(_gRPC_PLATFORM_ANDROID) if(_gRPC_PLATFORM_ANDROID)
target_link_libraries(gpr target_link_libraries(gpr
@@ -3927,6 +3929,7 @@ endif() @@ -3957,6 +3960,7 @@ endif()
endif() endif()
+if (gRPC_UPB_PROVIDER STREQUAL "module") +if (gRPC_UPB_PROVIDER STREQUAL "module")
add_library(upb add_library(upb
third_party/upb/upb/decode_fast.c third_party/upb/third_party/utf8_range/naive.c
third_party/upb/upb/decode.c third_party/upb/third_party/utf8_range/range2-neon.c
@@ -3984,7 +3987,7 @@ if(gRPC_INSTALL) @@ -4018,7 +4022,7 @@ if(gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
) )
endif() endif()
- -
+endif() +endif()
add_executable(check_epollexclusive
test/build/check_epollexclusive.c add_executable(gen_hpack_tables
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
index 3623f4a..df6ced5 100644 index 3623f4aa5e..df6ced560e 100644
--- a/cmake/gRPCConfig.cmake.in --- a/cmake/gRPCConfig.cmake.in
+++ b/cmake/gRPCConfig.cmake.in +++ b/cmake/gRPCConfig.cmake.in
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules) @@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
@ -50,10 +51,10 @@ index 3623f4a..df6ced5 100644
# Targets # Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake) include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)
diff --git a/cmake/upb.cmake b/cmake/upb.cmake diff --git a/cmake/upb.cmake b/cmake/upb.cmake
index f2a0e50..ac6d397 100644 index f2a0e508c3..09751f5ef0 100644
--- a/cmake/upb.cmake --- a/cmake/upb.cmake
+++ b/cmake/upb.cmake +++ b/cmake/upb.cmake
@@ -12,9 +12,21 @@ @@ -12,9 +12,19 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
@ -67,12 +68,9 @@ index f2a0e50..ac6d397 100644
set(_gRPC_UPB_LIBRARIES upb) set(_gRPC_UPB_LIBRARIES upb)
+ +
+
+elseif(gRPC_UPB_PROVIDER STREQUAL "package") +elseif(gRPC_UPB_PROVIDER STREQUAL "package")
+ find_package(upb CONFIG REQUIRED) + find_package(upb CONFIG REQUIRED)
+ set(_gRPC_UPB_LIBRARIES upb::upb) + 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_UPB_INCLUDE_DIR)
+ set(upb ${_gRPC_UPB_LIBRARIES})
+ set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()") + set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()")
+endif() +endif()
\ No newline at end of file

View File

@ -1,33 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 497470c..9c07732 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2196,6 +2196,8 @@ target_link_libraries(grpc
${_gRPC_UPB_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::flat_hash_map
+ absl::time
+ absl::synchronization
absl::inlined_vector
absl::bind_front
absl::hash
@@ -2753,6 +2755,8 @@ target_link_libraries(grpc_unsecure
${_gRPC_UPB_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::flat_hash_map
+ absl::time
+ absl::synchronization
absl::inlined_vector
absl::bind_front
absl::statusor
diff --git a/cmake/abseil-cpp.cmake b/cmake/abseil-cpp.cmake
index c89ba26..81212b9 100644
--- a/cmake/abseil-cpp.cmake
+++ b/cmake/abseil-cpp.cmake
@@ -35,3 +35,6 @@ elseif(gRPC_ABSL_PROVIDER STREQUAL "package")
find_package(absl REQUIRED CONFIG)
endif()
set(_gRPC_FIND_ABSL "if(NOT TARGET absl::strings)\n find_package(absl CONFIG)\nendif()")
+ if (gRPC_ABSL_SYNC_ENABLE)
+ add_definitions(-DGPR_ABSEIL_SYNC=1)
+ endif()

View File

@ -1,28 +0,0 @@
diff --git a/cmake/upb.cmake b/cmake/upb.cmake
index 59d6813..1ce8bce 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -24,8 +24,21 @@ 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_LIBRARIES upb)
set(_gRPC_UPB_INCLUDE_DIR)
- set(upb ${_gRPC_UPB_LIBRARIES})
+ add_library(upb STATIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c
+ )
+ set_target_properties(upb PROPERTIES OUTPUT_NAME grpc_upbdefs)
+ target_include_directories(upb PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated")
+ target_link_libraries(upb PUBLIC upb::all_libs)
+ if(gRPC_INSTALL)
+ install(TARGETS upb EXPORT gRPCTargets
+ RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
+ )
+ endif()
set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()")
endif()

View File

@ -7,7 +7,7 @@ index 54b4b23..83fab3b 100644
"${gRPC_CORE_VERSION}" "${gRPC_CORE_VERSION}"
"gpr openssl absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_hash absl_inlined_vector absl_memory absl_optional absl_random_random absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant" "gpr openssl absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_hash absl_inlined_vector absl_memory absl_optional absl_random_random absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant"
- "-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz" - "-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz"
+ "-lgrpc -lgrpc_upbdefs -laddress_sorting -lre2 -lupb_fastdecode -lupb_json -lupb_pb -lupb_handlers -lupb_textformat -lupb_reflection -lupb -lcares -lz" + "-lgrpc -laddress_sorting -lre2 -ldescriptor_upb_proto -lupb_fastdecode -lupb_json -lupb_reflection -lupb_textformat -lupb_utf8_range -lupb -lcares -lz"
"" ""
"grpc.pc") "grpc.pc")

View File

@ -5,8 +5,8 @@ endif()
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO grpc/grpc REPO grpc/grpc
REF 591d56e1300b6d11948e1b821efac785a295989c # v1.44.0 REF v1.46.3
SHA512 b24f82768eed95b017a499ffb539af1f59d6916ab2da5ffb1de344ea7b0b7df536d1bb29a9bcb273bd84bc1f11b62383dc6c7df62e50d57621228f5aeeca6d5d SHA512 e80322b65c6f8d64dc91bce9f612119191e8d329cac2fbc5da6dad9a2a7ccaa7a501470ed483e555c3ba596e8aff796fbda2747f09e9c4329aed3de4d9b6b666
HEAD_REF master HEAD_REF master
PATCHES PATCHES
00001-fix-uwp.patch 00001-fix-uwp.patch
@ -14,13 +14,10 @@ vcpkg_from_github(
00003-undef-base64-macro.patch 00003-undef-base64-macro.patch
00004-link-gdi32-on-windows.patch 00004-link-gdi32-on-windows.patch
00005-fix-uwp-error.patch 00005-fix-uwp-error.patch
00006-fix-uwp-error.patch
00009-use-system-upb.patch 00009-use-system-upb.patch
00010-add-feature-absl-sync.patch
00011-fix-csharp_plugin.patch 00011-fix-csharp_plugin.patch
snprintf.patch snprintf.patch
00012-fix-use-cxx17.patch 00012-fix-use-cxx17.patch
00013-build-upbdefs.patch
00014-pkgconfig-upbdefs.patch 00014-pkgconfig-upbdefs.patch
) )
@ -40,7 +37,6 @@ endif()
vcpkg_check_features( vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES FEATURES
absl-sync gRPC_ABSL_SYNC_ENABLE
codegen gRPC_BUILD_CODEGEN codegen gRPC_BUILD_CODEGEN
) )
@ -90,11 +86,8 @@ else()
configure_file("${CMAKE_CURRENT_LIST_DIR}/gRPCTargets-vcpkg-tools.cmake" "${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-vcpkg-tools.cmake" @ONLY) configure_file("${CMAKE_CURRENT_LIST_DIR}/gRPCTargets-vcpkg-tools.cmake" "${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-vcpkg-tools.cmake" @ONLY)
endif() endif()
# Ignore the C# extension DLL in bin/ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/include")
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_pdbs() vcpkg_copy_pdbs()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)

View File

@ -1,7 +1,6 @@
{ {
"name": "grpc", "name": "grpc",
"version-semver": "1.44.0", "version-semver": "1.46.3",
"port-version": 1,
"description": "An RPC library and framework", "description": "An RPC library and framework",
"homepage": "https://github.com/grpc/grpc", "homepage": "https://github.com/grpc/grpc",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -38,7 +37,7 @@
], ],
"features": { "features": {
"absl-sync": { "absl-sync": {
"description": "Use abseil synchronization module" "description": "Deprecated."
}, },
"codegen": { "codegen": {
"description": "Build code generator machinery" "description": "Build code generator machinery"

View File

@ -0,0 +1,137 @@
diff --git a/cmake/make_cmakelists.py b/cmake/make_cmakelists.py
index d64c14f..12226cf 100755
--- a/cmake/make_cmakelists.py
+++ b/cmake/make_cmakelists.py
@@ -316,10 +316,132 @@ class Converter(object):
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id")
endif()
+ if (MSVC)
+ add_compile_options(/wd4146 /wd4703 -D_CRT_SECURE_NO_WARNINGS)
+ endif()
+
enable_testing()
+ set(CMAKE_CXX_STANDARD 11)
+
+ if (VCPKG_UPB_BUILD_CODEGEN)
+ find_package(absl CONFIG REQUIRED)
+ find_package(protobuf CONFIG REQUIRED)
+
+ if (ABSL_USE_CXX17)
+ message(STATUS "Found absl uses CXX17, enable CXX17 feature.")
+ set(CMAKE_CXX_STANDARD 17)
+ endif()
+ endif()
+
+ add_library(descriptor_upb_proto)
+
+ add_library(utf8_range
+ ../third_party/utf8_range/naive.c
+ ../third_party/utf8_range/range2-neon.c
+ ../third_party/utf8_range/range2-sse.c
+ ../third_party/utf8_range/utf8_range.h
+ )
+
%(toplevel)s
+ set(UPB_DESCRIPTOR_PROTO "${VCPKG_UPB_HOST_INCLUDE_DIR}/google/protobuf/descriptor.proto")
+ if (VCPKG_UPB_BUILD_CODEGEN)
+ set(UPB_CODEGEN_TARGETS protoc-gen-upb protoc-gen-upbdefs)
+
+ add_executable(protoc-gen-upbdefs
+ ../upbc/common.h
+ ../upbc/common.cc
+ ../upbc/protoc-gen-upbdefs.cc
+ )
+ target_link_libraries(protoc-gen-upbdefs PRIVATE
+ absl::flat_hash_map
+ absl::strings
+ protobuf::libprotobuf
+ protobuf::libprotoc
+ )
+
+ add_executable(protoc-gen-upb
+ ../upbc/common.h
+ ../upbc/common.cc
+ ../upbc/protoc-gen-upb.cc
+ )
+ target_link_libraries(protoc-gen-upb PRIVATE
+ mini_table
+ port
+ upb
+ absl::flat_hash_map
+ absl::flat_hash_set
+ absl::strings
+ protobuf::libprotobuf
+ protobuf::libprotoc
+ )
+
+ set(PROTOC_PROGRAM "\$<TARGET_FILE:protobuf::protoc>")
+ set(PROTOC_GEN_UPB_PROGRAM "\$<TARGET_FILE:protoc-gen-upb>")
+ set(PROTOC_GEN_UPBDEFS_PROGRAM "\$<TARGET_FILE:protoc-gen-upbdefs>")
+ else()
+ find_program(PROTOC_PROGRAM protoc)
+ find_program(PROTOC_GEN_UPB_PROGRAM protoc-gen-upb)
+ find_program(PROTOC_GEN_UPBDEFS_PROGRAM protoc-gen-upbdefs)
+ endif()
+
+ set(UPB_DESCRIPTOR_SOURCES
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upb.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upb.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upbdefs.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upbdefs.c"
+ )
+
+ add_custom_command(
+ OUTPUT ${UPB_DESCRIPTOR_SOURCES}
+ DEPENDS "${UPB_DESCRIPTOR_PROTO}"
+ COMMAND
+ "${PROTOC_PROGRAM}"
+ "-I${VCPKG_UPB_HOST_INCLUDE_DIR}"
+ "--plugin=protoc-gen-upb=${PROTOC_GEN_UPB_PROGRAM}"
+ "--plugin=protoc-gen-upbdefs=${PROTOC_GEN_UPBDEFS_PROGRAM}"
+ "--upb_out=${CMAKE_CURRENT_BINARY_DIR}"
+ "--upbdefs_out=${CMAKE_CURRENT_BINARY_DIR}"
+ "${UPB_DESCRIPTOR_PROTO}"
+ )
+
+ target_sources(descriptor_upb_proto PRIVATE ${UPB_DESCRIPTOR_SOURCES})
+
+ set_target_properties(reflection PROPERTIES OUTPUT_NAME upb_reflection)
+ set_target_properties(fastdecode PROPERTIES OUTPUT_NAME upb_fastdecode)
+ set_target_properties(textformat PROPERTIES OUTPUT_NAME upb_textformat)
+ set_target_properties(json PROPERTIES OUTPUT_NAME upb_json)
+ set_target_properties(utf8_range PROPERTIES OUTPUT_NAME upb_utf8_range)
+ set_target_properties(mini_table PROPERTIES OUTPUT_NAME upb_mini_table)
+
+ install(
+ DIRECTORY ../upb
+ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.inc"
+ PATTERN "*.int.h"
+ )
+ target_include_directories(upb PUBLIC $<INSTALL_INTERFACE:include>)
+ install(TARGETS
+ upb
+ utf8_range
+ fastdecode
+ json
+ port
+ table
+ descriptor_upb_proto
+ reflection
+ textformat
+ mini_table_internal
+ mini_table
+ ${UPB_CODEGEN_TARGETS}
+ EXPORT upb-config
+ )
+ install(EXPORT upb-config NAMESPACE upb:: DESTINATION share/upb)
+
""")
data = {}

View File

@ -0,0 +1,13 @@
diff --git a/upb/json_decode.c b/upb/json_decode.c
index c4698f0..20226f5 100644
--- a/upb/json_decode.c
+++ b/upb/json_decode.c
@@ -1217,7 +1217,7 @@ static void jsondec_struct(jsondec* d, upb_Message* msg,
static void jsondec_wellknownvalue(jsondec* d, upb_Message* msg,
const upb_MessageDef* m) {
upb_MessageValue val;
- const upb_FieldDef* f;
+ const upb_FieldDef* f = 0;
upb_Message* submsg;
switch (jsondec_peek(d)) {

View File

@ -1,25 +0,0 @@
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index b4f43f9..c90968f 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -137,4 +137,20 @@ add_library(table INTERFACE)
target_link_libraries(table INTERFACE
port)
+add_library(all_libs INTERFACE)
+target_link_libraries(all_libs
+ INTERFACE
+ upb
+ fastdecode
+ utf8_range
+ json
+ port
+ table
+ descriptor_upb_proto
+ reflection
+ textformat
+)
+set_target_properties(reflection PROPERTIES OUTPUT_NAME upb_reflection)
+set_target_properties(fastdecode PROPERTIES OUTPUT_NAME upb_fastdecode)
+set_target_properties(textformat PROPERTIES OUTPUT_NAME upb_textformat)

View File

@ -1,41 +0,0 @@
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index c90968f..50637ec 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -8,7 +8,7 @@ else()
cmake_policy(VERSION 3.12)
endif()
-cmake_minimum_required (VERSION 3.0)
+cmake_minimum_required (VERSION 3.14)
cmake_policy(SET CMP0048 NEW)
project(upb)
@@ -154,3 +154,27 @@ set_target_properties(reflection PROPERTIES OUTPUT_NAME upb_reflection)
set_target_properties(fastdecode PROPERTIES OUTPUT_NAME upb_fastdecode)
set_target_properties(textformat PROPERTIES OUTPUT_NAME upb_textformat)
+install(
+ DIRECTORY ../upb
+ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.inc"
+ PATTERN "*.int.h"
+)
+target_include_directories(upb PUBLIC $<INSTALL_INTERFACE:include>)
+install(TARGETS
+ upb
+ utf8_range
+ fastdecode
+ json
+ port
+ table
+ descriptor_upb_proto
+ reflection
+ textformat
+ all_libs
+ EXPORT upb-config
+)
+install(EXPORT upb-config NAMESPACE upb:: DESTINATION share/upb)

View File

@ -1,33 +0,0 @@
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 6b4c50d..b4f43f9 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -66,6 +66,10 @@ endif()
enable_testing()
add_library(port INTERFACE)
+add_library(descriptor_upb_proto INTERFACE)
+add_library(utf8_range
+ ../third_party/utf8_range/utf8_range.c
+ ../third_party/utf8_range/utf8_range.h)
add_library(upb
../upb/decode.c
../upb/decode_internal.h
@@ -84,7 +88,7 @@ add_library(upb
target_link_libraries(upb
fastdecode
port
- /third_party/utf8_range)
+ utf8_range)
add_library(fastdecode
../upb/decode.h
../upb/decode_internal.h
@@ -96,7 +100,7 @@ add_library(fastdecode
target_link_libraries(fastdecode
port
table
- /third_party/utf8_range)
+ utf8_range)
add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE)
target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
table

View File

@ -1,28 +0,0 @@
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index a6b432f..003615e 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -59,6 +59,10 @@ elseif(UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id")
endif()
+if (MSVC)
+ add_compile_options(/wd4146 /wd4703 -D_CRT_SECURE_NO_WARNINGS)
+endif()
+
enable_testing()
add_library(port INTERFACE)
diff --git a/upb/json_decode.c b/upb/json_decode.c
index bb33744..1fadd26 100644
--- a/upb/json_decode.c
+++ b/upb/json_decode.c
@@ -1160,7 +1160,7 @@ static void jsondec_struct(jsondec *d, upb_msg *msg, const upb_msgdef *m) {
static void jsondec_wellknownvalue(jsondec *d, upb_msg *msg,
const upb_msgdef *m) {
upb_msgval val;
- const upb_fielddef *f;
+ const upb_fielddef *f = NULL;
upb_msg *submsg;
switch (jsondec_peek(d)) {

View File

@ -3,24 +3,55 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO protocolbuffers/upb REPO protocolbuffers/upb
REF 160625a9728b4031a21ad1e1c0146ea2c3a851eb # 2021-10-19 REF bef53686ec702607971bd3ea4d4fefd80c6cc6e8 # 2022-04-04
SHA512 13b205dd4278600e6ec05c829dc6c7e449747cccb118a3b83abc0ab5ef0ab180feb364ac84da8075471697fbba798ed3d9d763934d7fe9a64ac0560f5f9d3e83 SHA512 3801625827a5511ab28e047d7111e6f43d522872eef929b61d7a64fdb9fff7a058af45fd55bd409610c07c735f50a2f6f45ad611bb5e4ee86cd656b89f0a8278
HEAD_REF master HEAD_REF master
PATCHES PATCHES
fix-uwp.patch 0001-make-cmakelists-py.patch
fix-cmakelists.patch 0002-fix-uwp.patch
add-all-libs-target.patch
add-cmake-install.patch
) )
vcpkg_find_acquire_program(PYTHON3)
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "${SOURCE_PATH}/cmake/make_cmakelists.py" "cmake/CMakeLists.txt"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME make_cmakelists)
vcpkg_replace_string("${SOURCE_PATH}/cmake/CMakeLists.txt" "/third_party/utf8_range)" "utf8_range)")
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
codegen VCPKG_UPB_BUILD_CODEGEN
)
if(NOT VCPKG_UPB_BUILD_CODEGEN)
vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf" "${CURRENT_HOST_INSTALLED_DIR}/tools/upb")
endif()
vcpkg_cmake_configure( vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/cmake" SOURCE_PATH "${SOURCE_PATH}/cmake"
OPTIONS ${FEATURE_OPTIONS}
"-DVCPKG_UPB_HOST_INCLUDE_DIR=${CURRENT_HOST_INSTALLED_DIR}/include"
) )
vcpkg_cmake_install() vcpkg_cmake_install(ADD_BIN_TO_PATH)
vcpkg_cmake_config_fixup() vcpkg_cmake_config_fixup()
if (VCPKG_UPB_BUILD_CODEGEN)
vcpkg_copy_tools(
AUTO_CLEAN
TOOL_NAMES
protoc-gen-upbdefs
protoc-gen-upb
)
else()
configure_file("${CMAKE_CURRENT_LIST_DIR}/upb-config-vcpkg-tools.cmake" "${CURRENT_PACKAGES_DIR}/share/upb/upb-config-vcpkg-tools.cmake" @ONLY)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/upb/fuzz" "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_pdbs() vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -0,0 +1,10 @@
file(GLOB UPB_PLUGINS "${_IMPORT_PREFIX}/../@HOST_TRIPLET@/tools/upb/protoc-gen-upb*")
foreach(PLUGIN ${UPB_PLUGINS})
get_filename_component(PLUGIN_NAME "${PLUGIN}" NAME_WE)
add_executable(upb::${PLUGIN_NAME} IMPORTED)
set_property(TARGET upb::${PLUGIN_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(upb::${PLUGIN_NAME} PROPERTIES
IMPORTED_LOCATION_RELEASE "${PLUGIN}"
)
endforeach()

View File

@ -1,9 +1,17 @@
{ {
"name": "upb", "name": "upb",
"version-date": "2021-10-19", "version-date": "2022-04-04",
"description": "μpb (often written 'upb') is a small protobuf implementation written in C.", "description": "μpb (often written 'upb') is a small protobuf implementation written in C.",
"homepage": "https://github.com/protocolbuffers/upb/", "homepage": "https://github.com/protocolbuffers/upb/",
"license": "BSD-2-Clause",
"dependencies": [ "dependencies": [
{
"name": "upb",
"host": true,
"features": [
"codegen"
]
},
{ {
"name": "vcpkg-cmake", "name": "vcpkg-cmake",
"host": true "host": true
@ -12,5 +20,14 @@
"name": "vcpkg-cmake-config", "name": "vcpkg-cmake-config",
"host": true "host": true
} }
] ],
"features": {
"codegen": {
"description": "Build code generator machinery",
"dependencies": [
"abseil",
"protobuf"
]
}
}
} }

View File

@ -2689,8 +2689,8 @@
"port-version": 0 "port-version": 0
}, },
"grpc": { "grpc": {
"baseline": "1.44.0", "baseline": "1.46.3",
"port-version": 1 "port-version": 0
}, },
"grppi": { "grppi": {
"baseline": "0.4.0", "baseline": "0.4.0",
@ -7309,7 +7309,7 @@
"port-version": 0 "port-version": 0
}, },
"upb": { "upb": {
"baseline": "2021-10-19", "baseline": "2022-04-04",
"port-version": 0 "port-version": 0
}, },
"urdfdom": { "urdfdom": {

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "dabbbee8a5b79662990efb664c6975e2ea548599",
"version-semver": "1.46.3",
"port-version": 0
},
{ {
"git-tree": "6b15dbb6b2a6f81d7ae885b5b8f273b729b8d0ba", "git-tree": "6b15dbb6b2a6f81d7ae885b5b8f273b729b8d0ba",
"version-semver": "1.44.0", "version-semver": "1.44.0",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "de1d8718e4ea42428b87f4275352c4f3bbb6ac11",
"version-date": "2022-04-04",
"port-version": 0
},
{ {
"git-tree": "7c61b435b6136ae6539c3991b9f6b81bfd6811dc", "git-tree": "7c61b435b6136ae6539c3991b9f6b81bfd6811dc",
"version-date": "2021-10-19", "version-date": "2021-10-19",