diff options
| author | Phil Christensen <philc@microsoft.com> | 2018-12-19 14:57:09 -0800 |
|---|---|---|
| committer | Phil Christensen <philc@microsoft.com> | 2018-12-19 14:57:09 -0800 |
| commit | d5656ef104ce531a1c75d286147ba323b76aa427 (patch) | |
| tree | 2d613dcb4d3cf4f503def59b60c80284568e317a | |
| parent | 224300c2387cb959bbbec5623f5fa017142d3733 (diff) | |
| download | vcpkg-d5656ef104ce531a1c75d286147ba323b76aa427.tar.gz vcpkg-d5656ef104ce531a1c75d286147ba323b76aa427.zip | |
[grpc] update patch for uwp
| -rw-r--r-- | ports/grpc/fix-uwp.patch | 257 | ||||
| -rw-r--r-- | ports/grpc/portfile.cmake | 2 |
2 files changed, 149 insertions, 110 deletions
diff --git a/ports/grpc/fix-uwp.patch b/ports/grpc/fix-uwp.patch index f479e4c59..81b79d1e0 100644 --- a/ports/grpc/fix-uwp.patch +++ b/ports/grpc/fix-uwp.patch @@ -1,109 +1,148 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a59fd818e3..774ee2f725 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -89,6 +89,9 @@ if(UNIX) - endif() - if(WIN32) - set(_gRPC_PLATFORM_WINDOWS ON) -+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") -+ set(_gRPC_PLATFORM_UWP ON) -+ endif() - endif() - - set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) -@@ -155,6 +158,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) - # ``.proto`` files - # - function(protobuf_generate_grpc_cpp) -+ if(_gRPC_PLATFORM_UWP) -+ return() -+ endif() -+ - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files") - return() -@@ -189,6 +196,7 @@ function(protobuf_generate_grpc_cpp) - endforeach() - endfunction() - -+if(NOT _gRPC_PLATFORM_UWP) - add_custom_target(plugins - DEPENDS - grpc_cpp_plugin -@@ -218,6 +226,8 @@ add_custom_target(tools_cxx - add_custom_target(tools - DEPENDS tools_c tools_cxx) - -+endif() -+ - if (gRPC_BUILD_TESTS) - add_custom_target(buildtests_c) - add_dependencies(buildtests_c algorithm_test) -@@ -3661,7 +3671,6 @@ foreach(_hdr - DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" - ) - endforeach() --endif (gRPC_BUILD_CODEGEN) - - - if (gRPC_INSTALL) -@@ -3671,6 +3680,7 @@ if (gRPC_INSTALL) - ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} - ) - endif() -+endif (gRPC_BUILD_CODEGEN) - - if (gRPC_BUILD_TESTS) - -@@ -3793,7 +3803,7 @@ foreach(_hdr - DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" - ) - endforeach() --endif (gRPC_BUILD_CODEGEN) -+ - - - if (gRPC_INSTALL) -@@ -3803,6 +3813,7 @@ if (gRPC_INSTALL) - ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} - ) - 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 55efe0e9dd..f538f26edf 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; - } - +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b39e6f8..5d35293 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -90,6 +90,9 @@ if(UNIX)
+ endif()
+ if(WIN32)
+ set(_gRPC_PLATFORM_WINDOWS ON)
++ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
++ set(_gRPC_PLATFORM_UWP ON)
++ endif()
+ endif()
+
+ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+@@ -107,6 +110,9 @@ if (MSVC)
+ add_definitions(/wd4267)
+ # TODO(jtattermusch): needed to build boringssl with VS2017, revisit later
+ add_definitions(/wd4987 /wd4774 /wd4819 /wd4996 /wd4619)
++ if(_gRPC_PLATFORM_UWP)
++ add_definitions(-DGRPC_ARES=0)
++ endif()
+ endif()
+
+ if (gRPC_USE_PROTO_LITE)
+@@ -177,6 +183,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
+ # ``.proto`` files
+ #
+ function(protobuf_generate_grpc_cpp)
++ if(_gRPC_PLATFORM_UWP)
++ return()
++ endif()
++
+ if(NOT ARGN)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files")
+ return()
+@@ -211,6 +221,7 @@ function(protobuf_generate_grpc_cpp)
+ endforeach()
+ endfunction()
+
++if(NOT _gRPC_PLATFORM_UWP)
+ add_custom_target(plugins
+ DEPENDS
+ grpc_cpp_plugin
+@@ -240,6 +251,8 @@ add_custom_target(tools_cxx
+ add_custom_target(tools
+ DEPENDS tools_c tools_cxx)
+
++endif()
++
+ if (gRPC_BUILD_TESTS)
+ add_custom_target(buildtests_c)
+ add_dependencies(buildtests_c algorithm_test)
+@@ -3805,7 +3818,6 @@ foreach(_hdr
+ DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
+ )
+ endforeach()
+-endif (gRPC_BUILD_CODEGEN)
+
+
+ if (gRPC_INSTALL)
+@@ -3815,6 +3827,7 @@ if (gRPC_INSTALL)
+ ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
+ )
+ endif()
++endif (gRPC_BUILD_CODEGEN)
+
+ if (gRPC_BUILD_TESTS)
+
+@@ -3935,7 +3948,7 @@ foreach(_hdr
+ DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
+ )
+ endforeach()
+-endif (gRPC_BUILD_CODEGEN)
++
+
+
+ if (gRPC_INSTALL)
+@@ -3945,6 +3958,7 @@ if (gRPC_INSTALL)
+ ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
+ )
+ endif()
++endif (gRPC_BUILD_CODEGEN)
+
+ if (gRPC_BUILD_TESTS)
+
+@@ -4916,7 +4930,6 @@ foreach(_hdr
+ DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
+ )
+ endforeach()
+-endif (gRPC_BUILD_CODEGEN)
+
+
+ if (gRPC_INSTALL)
+@@ -4926,6 +4939,7 @@ if (gRPC_INSTALL)
+ ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
+ )
+ endif()
++endif (gRPC_BUILD_CODEGEN)
+
+ if (gRPC_BUILD_TESTS)
+
+diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc
+index 7e4b3c9..da67bde 100644
+--- a/src/core/lib/iomgr/resource_quota.cc
++++ b/src/core/lib/iomgr/resource_quota.cc
+@@ -936,7 +936,7 @@ void grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size,
+ void grpc_resource_user_free(grpc_resource_user* resource_user, size_t size) {
+ gpr_mu_lock(&resource_user->mu);
+ grpc_resource_quota* resource_quota = resource_user->resource_quota;
+- gpr_atm prior = gpr_atm_no_barrier_fetch_add(&resource_quota->used, -size);
++ gpr_atm prior = gpr_atm_no_barrier_fetch_add(&resource_quota->used, -static_cast<gpr_atm>(size));
+ GPR_ASSERT(prior >= static_cast<long>(size));
+ bool was_zero_or_negative = resource_user->free_pool <= 0;
+ resource_user->free_pool += static_cast<int64_t>(size);
+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;
+ }
+
diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index c73a7492d..77db34226 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -81,4 +81,4 @@ SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_copy_pdbs() -#
\ No newline at end of file +##
\ No newline at end of file |
