@@ -74,6 +74,7 @@ if /i "%1"=="x86" set target_arch=x86&goto arg-ok
7474if /i " %1 " == " x64" set target_arch = x64& goto arg-ok
7575if /i " %1 " == " arm64" set target_arch = arm64& goto arg-ok
7676if /i " %1 " == " vs2017" set target_env = vs2017& goto arg-ok
77+ if /i " %1 " == " vs2019" set target_env = vs2019& goto arg-ok
7778if /i " %1 " == " noprojgen" set noprojgen = 1& goto arg-ok
7879if /i " %1 " == " projgen" set projgen = 1& goto arg-ok
7980if /i " %1 " == " nobuild" set nobuild = 1& goto arg-ok
@@ -174,6 +175,7 @@ set "node_exe=%config%\node.exe"
174175set " node_gyp_exe = " %node_exe% " deps\npm\node_modules\node-gyp\bin\node-gyp"
175176set " npm_exe = " %~dp0 %node_exe% " %~dp0 deps\npm\bin\npm-cli.js"
176177if " %target_env% " == " vs2017" set " node_gyp_exe = %node_gyp_exe% --msvs_version=2017"
178+ if " %target_env% " == " vs2019" set " node_gyp_exe = %node_gyp_exe% --msvs_version=2019"
177179
178180if " %config% " == " Debug" set configure_flags = %configure_flags% --debug
179181if defined nosnapshot set configure_flags = %configure_flags% --without-snapshot
@@ -229,9 +231,9 @@ if %target_arch%==x86 if %msvs_host_arch%==x86 set vcvarsall_arg=x86
229231
230232@ rem Look for Visual Studio 2017
231233:vs-set-2017
232- if defined target_env if " %target_env% " NEQ " vs2017" goto msbuild-not-found
234+ if defined target_env if " %target_env% " NEQ " vs2017" goto vs-set-2019
233235echo Looking for Visual Studio 2017
234- call tools\msvs\vswhere_usability_wrapper.cmd
236+ call tools\msvs\vswhere_usability_wrapper.cmd " [15.0,16.0) "
235237if " _%VCINSTALLDIR% _" == " __" goto msbuild-not-found
236238if defined msi (
237239 echo Looking for WiX installation for Visual Studio 2017...
@@ -262,6 +264,41 @@ set GYP_MSVS_VERSION=2017
262264set PLATFORM_TOOLSET = v141
263265goto msbuild-found
264266
267+ @ rem Look for Visual Studio 2019
268+ :vs-set-2019
269+ if defined target_env if " %target_env% " NEQ " vs2019" goto msbuild-not-found
270+ echo Looking for Visual Studio 2019
271+ call tools\msvs\vswhere_usability_wrapper.cmd " [16.0,17.0)"
272+ if " _%VCINSTALLDIR% _" == " __" goto msbuild-not-found
273+ if defined msi (
274+ echo Looking for WiX installation for Visual Studio 2019...
275+ if not exist " %WIX% \SDK\VS2017" (
276+ echo Failed to find WiX install for Visual Studio 2019
277+ echo VS2019 support for WiX is only present starting at version 3.11
278+ goto msbuild-not-found
279+ )
280+ if not exist " %VCINSTALLDIR% \..\MSBuild\Microsoft\WiX" (
281+ echo Failed to find the WiX Toolset Visual Studio 2019 Extension
282+ goto msbuild-not-found
283+ )
284+ )
285+ @ rem check if VS2019 is already setup, and for the requested arch
286+ if " _%VisualStudioVersion% _" == " _16.0_" if " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto found_vs2019
287+ @ rem need to clear VSINSTALLDIR for vcvarsall to work as expected
288+ set " VSINSTALLDIR = "
289+ @ rem prevent VsDevCmd.bat from changing the current working directory
290+ set " VSCMD_START_DIR = %CD% "
291+ set vcvars_call = " %VCINSTALLDIR% \Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
292+ echo calling: %vcvars_call%
293+ call %vcvars_call%
294+ if errorlevel 1 goto msbuild-not-found
295+ if defined DEBUG_HELPER @ ECHO ON
296+ :found_vs2019
297+ echo Found MSVS version %VisualStudioVersion%
298+ set GYP_MSVS_VERSION = 2019
299+ set PLATFORM_TOOLSET = v142
300+ goto msbuild-found
301+
265302:msbuild-not-found
266303echo Failed to find a suitable Visual Studio installation.
267304echo Try to run in a " Developer Command Prompt" or consult
0 commit comments