mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-08 01:41:38 +08:00
0cb819175b
* 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>
138 lines
4.3 KiB
Diff
138 lines
4.3 KiB
Diff
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 = {}
|