From 934b6770859f18efecb2322131b3819f81094cea Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Tue, 6 Apr 2021 09:56:29 -0500 Subject: [PATCH] Fix building with Visual Studio 2019 This lets CMake use the best generator for that system, which increases the portability of the library and removing the need for workarounds in different environments --- binding.gyp | 1 - script/build.sh | 21 +++++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/binding.gyp b/binding.gyp index 93e0322e..4b3902d1 100644 --- a/binding.gyp +++ b/binding.gyp @@ -72,7 +72,6 @@ }], ['OS == "win"', { - 'msbuild_toolset': 'v141', 'libraries': [ '<(PRODUCT_DIR)/../libzmq/lib/libzmq', 'ws2_32.lib', diff --git a/script/build.sh b/script/build.sh index 046ddd48..fed81ea3 100755 --- a/script/build.sh +++ b/script/build.sh @@ -12,22 +12,10 @@ if [ -n "${WINDIR}" ]; then # Working directory is NAPI temporary build directory. PATH_PREFIX="${PWD}/libzmq" ARTIFACT="${PATH_PREFIX}/lib/libzmq.lib" - CMAKE_GENERATOR="Visual Studio 15 2017" - TOOLSET_VERSION="141" - - # In Travis CI, Node paths are: - # - C:\ProgramData\nvs\node\\x64\node.exe - # - C:\ProgramData\nvs\node\\x86\node.exe - if [[ "${NODE}" != *"x86"* ]]; then - # Target Windows x64 platform. - CMAKE_GENERATOR="${CMAKE_GENERATOR} Win64" - fi else # Working directory is project root. PATH_PREFIX="${PWD}/build/libzmq" ARTIFACT="${PATH_PREFIX}/lib/libzmq.a" - CMAKE_GENERATOR="Unix Makefiles" - export MACOSX_DEPLOYMENT_TARGET=10.9 fi @@ -57,7 +45,7 @@ else echo > "${SRC_DIR}/builds/cmake/Modules/ClangFormat.cmake" fi - cmake -G "${CMAKE_GENERATOR}" \ + cmake \ "${BUILD_OPTIONS}" \ -DCMAKE_INSTALL_PREFIX="${PATH_PREFIX}" \ -DCMAKE_INSTALL_LIBDIR=lib \ @@ -73,9 +61,10 @@ else --config Release \ --target install \ -- -verbosity:Minimal -maxcpucount - mv \ - "${PATH_PREFIX}/lib/libzmq-v${TOOLSET_VERSION}-mt-s-${ZMQ_VERSION//./_}.lib" \ - "${PATH_PREFIX}/lib/libzmq.lib" + + BuilFile=$(find $PATH_PREFIX/lib/*.lib -type f) + mv "$BuilFile" "${PATH_PREFIX}/lib/libzmq.lib" + else cmake \ --build .\