mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 14:58:00 +08:00
[grpc] Update to v1.12.0 [protobuf] Update to v3.6.0.1
This commit is contained in:
parent
a1f0dcd02b
commit
c95b6bfdc4
@ -62,7 +62,7 @@ vcpkg_configure_cmake(
|
||||
-DUSE_SNPE=OFF
|
||||
-DUSE_ZMQ=OFF
|
||||
-DBUILD_TEST=OFF
|
||||
-DPROTOBUF_PROTOC_EXECUTABLE:FILEPATH=${CURRENT_INSTALLED_DIR}/tools/protoc.exe
|
||||
-DPROTOBUF_PROTOC_EXECUTABLE:FILEPATH=${CURRENT_INSTALLED_DIR}/tools/protobuf/protoc.exe
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: google-cloud-cpp
|
||||
Version: 0.1.0
|
||||
Version: 0.1.0-1
|
||||
Build-Depends: grpc, gtest
|
||||
Description: C++ Client Libraries for Google Cloud Platform APIs.
|
||||
|
24
ports/google-cloud-cpp/include-protobuf.patch
Normal file
24
ports/google-cloud-cpp/include-protobuf.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/bigtable/CMakeLists.txt b/bigtable/CMakeLists.txt
|
||||
index 1b8089f..771e1ec 100644
|
||||
--- a/bigtable/CMakeLists.txt
|
||||
+++ b/bigtable/CMakeLists.txt
|
||||
@@ -69,6 +69,10 @@ set(PROTOBUF_IMPORT_DIRS "${PROJECT_THIRD_PARTY_DIR}/googleapis" "${PROJECT_SOUR
|
||||
if(GRPC_ROOT_DIR)
|
||||
list(INSERT PROTOBUF_IMPORT_DIRS 0 "${GRPC_ROOT_DIR}/third_party/protobuf/src")
|
||||
endif(GRPC_ROOT_DIR)
|
||||
+find_path(PROTO_INCLUDE_DIR google/protobuf/descriptor.proto)
|
||||
+if(PROTO_INCLUDE_DIR)
|
||||
+ list(INSERT PROTOBUF_IMPORT_DIRS 0 "${PROTO_INCLUDE_DIR}")
|
||||
+endif()
|
||||
|
||||
# Get the destination directories based on the GNU recommendations.
|
||||
include(GNUInstallDirs)
|
||||
@@ -110,7 +114,7 @@ enable_testing()
|
||||
|
||||
# Capture the compiler version and the git revision into variables, then
|
||||
# generate a config file with the values.
|
||||
-if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/.git)
|
||||
+if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/.git AND 0)
|
||||
execute_process(COMMAND git rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_HEAD_LOG ERROR_VARIABLE GIT_HEAD_LOG)
|
||||
else ()
|
@ -11,6 +11,8 @@ vcpkg_from_github(
|
||||
REF v0.1.0
|
||||
SHA512 3947cc24ca1ed97309f055f17945afe2d6b22ae8f54f86d3395f8c491b7409d4b7bb12206889d04d07f51236e9fd5afd65b904c8c80521a3313588d8069545c2
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include-protobuf.patch"
|
||||
)
|
||||
|
||||
set(GOOGLEAPIS_VERSION 92f10d7033c6fa36e1a5a369ab5aa8bafd564009)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: grpc
|
||||
Version: 1.10.1-3
|
||||
Version: 1.12.0-2
|
||||
Build-Depends: zlib, openssl, protobuf, c-ares (!uwp)
|
||||
Description: An RPC library and framework
|
||||
|
@ -1,22 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8c285e7..cffd93f 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5058,6 +5058,9 @@ endif (gRPC_BUILD_CODEGEN)
|
||||
|
||||
endif (gRPC_BUILD_TESTS)
|
||||
|
||||
+option(gRPC_INSTALL_CSHARP_EXT "" ON)
|
||||
+
|
||||
+if (gRPC_INSTALL_CSHARP_EXT)
|
||||
add_library(grpc_csharp_ext SHARED
|
||||
src/csharp/ext/grpc_csharp_ext.c
|
||||
)
|
||||
@@ -5101,6 +5104,7 @@ if (gRPC_INSTALL)
|
||||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
+endif (gRPC_INSTALL_CSHARP_EXT)
|
||||
|
||||
if (gRPC_BUILD_TESTS)
|
||||
|
@ -1,18 +1,18 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 51f6e17..d33b147 100644
|
||||
index f58ee19..dda72e9 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -84,6 +84,9 @@ if(UNIX)
|
||||
@@ -87,6 +87,9 @@ if(UNIX)
|
||||
endif()
|
||||
if(WIN32)
|
||||
set(_gRPC_PLATFORM_WINDOWS ON)
|
||||
+ if(${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore")
|
||||
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
+ set(_gRPC_PLATFORM_UWP ON)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
@@ -144,6 +147,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
|
||||
@@ -152,6 +155,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
|
||||
# ``.proto`` files
|
||||
#
|
||||
function(protobuf_generate_grpc_cpp)
|
||||
@ -23,7 +23,7 @@ index 51f6e17..d33b147 100644
|
||||
if(NOT ARGN)
|
||||
message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files")
|
||||
return()
|
||||
@@ -178,6 +185,7 @@ function(protobuf_generate_grpc_cpp)
|
||||
@@ -186,6 +193,7 @@ function(protobuf_generate_grpc_cpp)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
@ -31,94 +31,79 @@ index 51f6e17..d33b147 100644
|
||||
add_custom_target(plugins
|
||||
DEPENDS
|
||||
grpc_cpp_plugin
|
||||
@@ -199,6 +207,7 @@ add_custom_target(tools_c
|
||||
gen_legal_metadata_characters
|
||||
gen_percent_encoding_tables
|
||||
)
|
||||
+endif()
|
||||
@@ -215,6 +223,8 @@ add_custom_target(tools_cxx
|
||||
add_custom_target(tools
|
||||
DEPENDS tools_c tools_cxx)
|
||||
|
||||
add_custom_target(tools_cxx
|
||||
DEPENDS
|
||||
@@ -3223,7 +3232,7 @@ if (gRPC_INSTALL)
|
||||
)
|
||||
endif()
|
||||
|
||||
-
|
||||
+if(NOT _gRPC_PLATFORM_UWP)
|
||||
add_library(grpc++_error_details
|
||||
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.cc
|
||||
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.cc
|
||||
@@ -3285,6 +3294,7 @@ if (gRPC_INSTALL)
|
||||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
if (gRPC_BUILD_TESTS)
|
||||
|
||||
@@ -3347,6 +3357,7 @@ endforeach()
|
||||
|
||||
endif (gRPC_BUILD_TESTS)
|
||||
|
||||
+if(NOT _gRPC_PLATFORM_UWP)
|
||||
add_library(grpc++_reflection
|
||||
src/cpp/ext/proto_server_reflection.cc
|
||||
src/cpp/ext/proto_server_reflection_plugin.cc
|
||||
@@ -3409,6 +3420,7 @@ if (gRPC_INSTALL)
|
||||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
if (gRPC_BUILD_TESTS)
|
||||
|
||||
@@ -4197,6 +4209,7 @@ endforeach()
|
||||
|
||||
endif (gRPC_BUILD_TESTS)
|
||||
|
||||
+if(NOT _gRPC_PLATFORM_UWP)
|
||||
add_library(grpc_plugin_support
|
||||
src/compiler/cpp_generator.cc
|
||||
src/compiler/csharp_generator.cc
|
||||
@@ -4236,6 +4249,8 @@ target_link_libraries(grpc_plugin_support
|
||||
${_gRPC_PROTOBUF_LIBRARIES}
|
||||
${_gRPC_ALLTARGETS_LIBRARIES}
|
||||
)
|
||||
+endif()
|
||||
+
|
||||
|
||||
foreach(_hdr
|
||||
include/grpc++/impl/codegen/config_protobuf.h
|
||||
@@ -4248,7 +4263,7 @@ foreach(_hdr
|
||||
if (gRPC_BUILD_TESTS)
|
||||
add_custom_target(buildtests_c)
|
||||
add_dependencies(buildtests_c algorithm_test)
|
||||
@@ -3595,7 +3605,6 @@ foreach(_hdr
|
||||
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
|
||||
)
|
||||
endforeach()
|
||||
-endif (gRPC_BUILD_CODEGEN)
|
||||
|
||||
|
||||
-
|
||||
+if(NOT _gRPC_PLATFORM_UWP)
|
||||
if (gRPC_INSTALL)
|
||||
install(TARGETS grpc_plugin_support EXPORT gRPCTargets
|
||||
RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
|
||||
@@ -4256,6 +4271,7 @@ if (gRPC_INSTALL)
|
||||
@@ -3605,6 +3614,7 @@ if (gRPC_INSTALL)
|
||||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
+endif()
|
||||
+endif (gRPC_BUILD_CODEGEN)
|
||||
|
||||
if (gRPC_BUILD_TESTS)
|
||||
|
||||
@@ -10252,6 +10268,7 @@ target_link_libraries(grpc_cli
|
||||
@@ -3725,7 +3735,7 @@ foreach(_hdr
|
||||
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
|
||||
)
|
||||
endforeach()
|
||||
-endif (gRPC_BUILD_CODEGEN)
|
||||
+
|
||||
|
||||
endif (gRPC_BUILD_TESTS)
|
||||
|
||||
+if(NOT _gRPC_PLATFORM_UWP)
|
||||
add_executable(grpc_cpp_plugin
|
||||
src/compiler/cpp_plugin.cc
|
||||
)
|
||||
@@ -10488,6 +10505,7 @@ if (gRPC_INSTALL)
|
||||
if (gRPC_INSTALL)
|
||||
@@ -3735,6 +3745,7 @@ if (gRPC_INSTALL)
|
||||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
+endif()
|
||||
+endif (gRPC_BUILD_CODEGEN)
|
||||
|
||||
if (gRPC_BUILD_TESTS)
|
||||
|
||||
diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc
|
||||
index 55efe0e..f538f26 100644
|
||||
--- a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc
|
||||
+++ b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc
|
||||
@@ -60,6 +60,8 @@ bool check_bios_data(const char* bios_data_file) {
|
||||
|
||||
static void init_mu(void) { gpr_mu_init(&g_mu); }
|
||||
|
||||
+#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
|
||||
+
|
||||
static bool run_powershell() {
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
sa.nLength = sizeof(sa);
|
||||
@@ -97,8 +99,12 @@ static bool run_powershell() {
|
||||
CloseHandle(h);
|
||||
return true;
|
||||
}
|
||||
+#endif
|
||||
|
||||
bool grpc_alts_is_running_on_gcp() {
|
||||
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
|
||||
+ g_is_on_compute_engine = false;
|
||||
+#else
|
||||
gpr_once_init(&g_once, init_mu);
|
||||
gpr_mu_lock(&g_mu);
|
||||
if (!g_compute_engine_detection_done) {
|
||||
@@ -108,6 +114,7 @@ bool grpc_alts_is_running_on_gcp() {
|
||||
g_compute_engine_detection_done = true;
|
||||
}
|
||||
gpr_mu_unlock(&g_mu);
|
||||
+#endif
|
||||
return g_is_on_compute_engine;
|
||||
}
|
||||
|
||||
|
@ -12,28 +12,31 @@ endif()
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO grpc/grpc
|
||||
REF v1.10.1
|
||||
SHA512 2221d902c60eada6dd1547a63d26bd3b30cb6710247b5e48523bacde498a3691cc177f1dbe9db8a007b8ae341a5b0c8ec999539e26a9bcff480a8d0b02140997
|
||||
REF v1.12.0
|
||||
SHA512 68a8c261ea570790974769d6c0ca8138cf4242b79e9ff74a11b10d35a27f98ff24c03f3d05932ac46811c0ba7d1a094388ae8dbeb495fc8e723ad74695994d49
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/disable-csharp-ext.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch
|
||||
)
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(gRPC_BUILD_CODEGEN OFF)
|
||||
else()
|
||||
set(gRPC_BUILD_CODEGEN ON)
|
||||
endif()
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
set(gRPC_MSVC_STATIC_RUNTIME ON)
|
||||
else()
|
||||
set(gRPC_MSVC_STATIC_RUNTIME OFF)
|
||||
endif()
|
||||
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(cares_CARES_PROVIDER OFF)
|
||||
else()
|
||||
set(cares_CARES_PROVIDER "package")
|
||||
endif()
|
||||
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
@ -44,6 +47,7 @@ vcpkg_configure_cmake(
|
||||
-DgRPC_ZLIB_PROVIDER=package
|
||||
-DgRPC_SSL_PROVIDER=package
|
||||
-DgRPC_PROTOBUF_PROVIDER=package
|
||||
-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG
|
||||
-DgRPC_CARES_PROVIDER=${cares_CARES_PROVIDER}
|
||||
-DgRPC_GFLAGS_PROVIDER=none
|
||||
-DgRPC_BENCHMARK_PROVIDER=none
|
||||
@ -52,17 +56,16 @@ vcpkg_configure_cmake(
|
||||
-DgRPC_INSTALL_LIBDIR:STRING=lib
|
||||
-DgRPC_INSTALL_INCLUDEDIR:STRING=include
|
||||
-DgRPC_INSTALL_CMAKEDIR:STRING=share/grpc
|
||||
-DgRPC_BUILD_CODEGEN=${gRPC_BUILD_CODEGEN}
|
||||
)
|
||||
|
||||
# gRPC runs built executables during the build, so they need access to the installed DLLs.
|
||||
set(ENV{PATH} "$ENV{PATH};${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin")
|
||||
vcpkg_install_cmake(ADD_BIN_TO_PATH)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/grpc")
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright)
|
||||
|
||||
# Install tools and plugins
|
||||
# Install tools
|
||||
file(GLOB TOOLS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.exe")
|
||||
if(TOOLS)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/grpc)
|
||||
@ -70,12 +73,13 @@ if(TOOLS)
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/grpc)
|
||||
endif()
|
||||
|
||||
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
else()
|
||||
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) # Leave the executable files in bin/ and debug/bin
|
||||
file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*.exe" "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe")
|
||||
if(EXES)
|
||||
file(REMOVE ${EXES})
|
||||
endif()
|
||||
|
||||
# Ignore the C# extension DLL in bin/
|
||||
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -1,5 +1,5 @@
|
||||
Source: protobuf
|
||||
Version: 3.5.1-5
|
||||
Version: 3.6.0.1
|
||||
Description: Protocol Buffers - Google's data interchange format
|
||||
|
||||
Feature: zlib
|
||||
|
@ -3,8 +3,8 @@ index 107c1c5..233bcf6 100644
|
||||
--- a/cmake/libprotoc.cmake
|
||||
+++ b/cmake/libprotoc.cmake
|
||||
@@ -73,7 +73,7 @@ set(libprotoc_files
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
|
||||
- ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.cc
|
||||
|
@ -1,54 +1,35 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
set(PROTOBUF_VERSION 3.5.1)
|
||||
set(PROTOC_VERSION 3.5.1)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE_FILE
|
||||
URLS "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz"
|
||||
FILENAME "protobuf-cpp-${PROTOBUF_VERSION}.tar.gz"
|
||||
SHA512 195ccb210229e0a1080dcdb0a1d87b2e421ad55f6b036c56db3183bd50a942c75b4cc84e6af8a10ad88022a247781a06f609a145a461dfbb8f04051b7dd714b3
|
||||
)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION})
|
||||
|
||||
vcpkg_extract_source_archive(${ARCHIVE_FILE})
|
||||
|
||||
# Add a flag that can be set to disable the protobuf compiler
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO google/protobuf
|
||||
REF v3.6.0.1
|
||||
SHA512 63cd799d5d6edbb05a87bc07992271c5bdb9595366d698b4dc5476cc89dc278d1c43186b9e56340958aefea2ce23e15a9c3a550158414add868b56e789ceafe4
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/001-add-compiler-flag.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/export-ParseGeneratorParameter.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/js-embed.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/wire_format_lite_h_fix_error_C4146.patch"
|
||||
)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(TOOL_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}-win32)
|
||||
vcpkg_download_distfile(TOOL_ARCHIVE_FILE
|
||||
URLS "https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-win32.zip"
|
||||
FILENAME "protoc-${PROTOC_VERSION}-win32.zip"
|
||||
SHA512 27b1b82e92d82c35158362435a29f590961b91f68cda21bffe46e52271340ea4587c4e3177668809af0d053b61e6efa69f0f62156ea11393cd9e6eb4474a3049
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${TOOL_PATH})
|
||||
endif()
|
||||
|
||||
|
||||
# Disable the protobuf compiler when targeting UWP
|
||||
if(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME)
|
||||
set(protobuf_BUILD_COMPILER OFF)
|
||||
if(CMAKE_HOST_WIN32 AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
|
||||
set(protobuf_BUILD_PROTOC_BINARIES OFF)
|
||||
elseif(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME)
|
||||
set(protobuf_BUILD_PROTOC_BINARIES OFF)
|
||||
else()
|
||||
set(protobuf_BUILD_COMPILER ON)
|
||||
set(protobuf_BUILD_PROTOC_BINARIES ON)
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
if(NOT protobuf_BUILD_PROTOC_BINARIES AND NOT EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/protobuf)
|
||||
message(FATAL_ERROR "Cross-targetting protobuf requires the x86-windows protoc to be available. Please install protobuf:x86-windows first.")
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(protobuf_BUILD_SHARED_LIBS ON)
|
||||
else()
|
||||
set(protobuf_BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
set(protobuf_MSVC_STATIC_RUNTIME ON)
|
||||
else()
|
||||
set(protobuf_MSVC_STATIC_RUNTIME OFF)
|
||||
@ -68,8 +49,8 @@ vcpkg_configure_cmake(
|
||||
-Dprotobuf_MSVC_STATIC_RUNTIME=${protobuf_MSVC_STATIC_RUNTIME}
|
||||
-Dprotobuf_WITH_ZLIB=${protobuf_WITH_ZLIB}
|
||||
-Dprotobuf_BUILD_TESTS=OFF
|
||||
-Dprotobuf_BUILD_COMPILER=${protobuf_BUILD_COMPILER}
|
||||
-DCMAKE_INSTALL_CMAKEDIR=share/protobuf
|
||||
-DCMAKE_INSTALL_CMAKEDIR:STRING=share/protobuf
|
||||
-Dprotobuf_BUILD_PROTOC_BINARIES=${protobuf_BUILD_PROTOC_BINARIES}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
@ -89,21 +70,28 @@ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake RELEASE_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protoc${CMAKE_EXECUTABLE_SUFFIX}" RELEASE_MODULE "${RELEASE_MODULE}")
|
||||
string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protobuf/protoc${CMAKE_EXECUTABLE_SUFFIX}" RELEASE_MODULE "${RELEASE_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake "${RELEASE_MODULE}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake DEBUG_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}")
|
||||
string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protoc${CMAKE_EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}")
|
||||
string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protobuf/protoc${CMAKE_EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}")
|
||||
endif()
|
||||
|
||||
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
if(protobuf_BUILD_PROTOC_BINARIES)
|
||||
file(INSTALL ${CURRENT_PACKAGES_DIR}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/protobuf)
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/protobuf)
|
||||
else()
|
||||
file(COPY ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/protobuf DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
|
||||
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
else()
|
||||
@ -112,19 +100,16 @@ if(CMAKE_HOST_WIN32)
|
||||
endif()
|
||||
else()
|
||||
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(INSTALL ${CURRENT_PACKAGES_DIR}/bin/protoc DESTINATION ${CURRENT_PACKAGES_DIR}/tools
|
||||
file(INSTALL ${CURRENT_PACKAGES_DIR}/bin/protoc DESTINATION ${CURRENT_PACKAGES_DIR}/tools/protobuf
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ)
|
||||
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h _contents)
|
||||
string(REPLACE "\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" "\#define PROTOBUF_USE_DLLS\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" _contents "${_contents}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h "${_contents}")
|
||||
endif()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright)
|
||||
if(CMAKE_HOST_WIN32)
|
||||
file(INSTALL ${TOOL_PATH}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
||||
endif()
|
||||
vcpkg_copy_pdbs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user