vcpkg/ports/grpc/fix-uwp.patch

110 lines
2.9 KiB
Diff
Raw Normal View History

2018-05-18 11:15:15 +08:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f58ee19..dda72e9 100644
2018-05-18 11:15:15 +08:00
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,9 @@ if(UNIX)
2018-05-18 11:15:15 +08:00
endif()
if(WIN32)
set(_gRPC_PLATFORM_WINDOWS ON)
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
2018-05-18 11:15:15 +08:00
+ set(_gRPC_PLATFORM_UWP ON)
+ endif()
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
@@ -152,6 +155,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
2018-05-18 11:15:15 +08:00
# ``.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()
@@ -186,6 +193,7 @@ function(protobuf_generate_grpc_cpp)
2018-05-18 11:15:15 +08:00
endforeach()
endfunction()
+if(NOT _gRPC_PLATFORM_UWP)
2018-06-30 10:19:10 +08:00
add_custom_target(plugins
DEPENDS
grpc_cpp_plugin
@@ -215,6 +223,8 @@ add_custom_target(tools_cxx
add_custom_target(tools
DEPENDS tools_c tools_cxx)
2018-05-18 11:15:15 +08:00
+endif()
+
2018-05-18 11:15:15 +08:00
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)
2018-05-18 11:15:15 +08:00
if (gRPC_INSTALL)
@@ -3605,6 +3614,7 @@ if (gRPC_INSTALL)
2018-06-30 10:19:10 +08:00
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
2018-05-18 11:15:15 +08:00
)
endif()
+endif (gRPC_BUILD_CODEGEN)
2018-05-18 11:15:15 +08:00
if (gRPC_BUILD_TESTS)
2018-06-30 10:19:10 +08:00
@@ -3725,7 +3735,7 @@ foreach(_hdr
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
2018-05-18 11:15:15 +08:00
)
endforeach()
-endif (gRPC_BUILD_CODEGEN)
+
2018-05-18 11:15:15 +08:00
2018-06-30 10:19:10 +08:00
if (gRPC_INSTALL)
@@ -3735,6 +3745,7 @@ if (gRPC_INSTALL)
2018-06-30 10:19:10 +08:00
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
2018-05-18 11:15:15 +08:00
endif()
+endif (gRPC_BUILD_CODEGEN)
2018-05-18 11:15:15 +08:00
if (gRPC_BUILD_TESTS)
2018-06-30 10:19:10 +08:00
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) {
2018-05-18 11:15:15 +08:00
static void init_mu(void) { gpr_mu_init(&g_mu); }
2018-05-18 11:15:15 +08:00
+#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;
}
2018-05-18 11:15:15 +08:00