mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
5f6a2ed8cf
* abseil: Update to 20220623.1 * upb: Update to 2022-06-21 * grpc: Update to 1.49.0 * grpc: Adjust SHA512 for v1.49.0 * abseil: Add license field
142 lines
4.5 KiB
Diff
142 lines
4.5 KiB
Diff
diff --git a/cmake/make_cmakelists.py b/cmake/make_cmakelists.py
|
|
index d64c14f6..ad3597c3 100755
|
|
--- a/cmake/make_cmakelists.py
|
|
+++ b/cmake/make_cmakelists.py
|
|
@@ -316,10 +316,136 @@ 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)
|
|
+ set_target_properties(extension_registry PROPERTIES OUTPUT_NAME upb_extension_registry)
|
|
+ set_target_properties(collections PROPERTIES OUTPUT_NAME upb_collections)
|
|
+
|
|
+ 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
|
|
+ extension_registry
|
|
+ collections
|
|
+ ${UPB_CODEGEN_TARGETS}
|
|
+ EXPORT upb-config
|
|
+ )
|
|
+ install(EXPORT upb-config NAMESPACE upb:: DESTINATION share/upb)
|
|
+
|
|
""")
|
|
|
|
data = {}
|