From 90233c965fa68c38d0d31ff8170d3301d8e48425 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 15:22:48 -0800 Subject: [PATCH] Force plugin to link statically on Windows --- packages/grpc-tools/CMakeLists.txt | 3 +++ packages/grpc-tools/build_binaries.ps1 | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/grpc-tools/CMakeLists.txt b/packages/grpc-tools/CMakeLists.txt index e3deadde..85c90dee 100644 --- a/packages/grpc-tools/CMakeLists.txt +++ b/packages/grpc-tools/CMakeLists.txt @@ -18,6 +18,9 @@ add_executable(grpc_node_plugin src/node_plugin.cc ) +if (MSVC) + add_definitions(/MT) +endif (MSVC) target_include_directories(grpc_node_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index 34a38b95..f96e4b98 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -33,8 +33,14 @@ foreach ($Arch in $ArchList) { $Generator = "Visual Studio 14 2015" } - & cmake.exe . - & cmake.exe --build . + & cmake.exe . --config Release + if ($LASTEXITCODE -ne 0) { + throw "cmake failed" + } + & cmake.exe --build . --config Release + if ($LASTEXITCODE -ne 0) { + throw "cmake build failed" + } Copy-Item ($ProtobufBase + "/protoc.exe") -Destination ($Base + "/build/bin/protoc.exe") Copy-Item ($Base + "/grpc_node_plugin.exe") -Destination ($Base + "/build/bin/grpc_node_plugin.exe")