@@ -15,7 +15,7 @@ if /i "%1"=="/?" goto help
1515set config = Release
1616set target = Build
1717set target_arch = x64
18- set target_env = vs2015
18+ set target_env =
1919set noprojgen =
2020set nobuild =
2121set sign =
@@ -164,18 +164,18 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64
164164
165165@ rem Look for Visual Studio 2017
166166:vs-set-2017
167- if " %target_env% " NEQ " vs2017" goto vs-set-2015
167+ if defined target_env if " %target_env% " NEQ " vs2017" goto vs-set-2015
168168echo Looking for Visual Studio 2017
169169@ rem check if VS2017 is already setup, and for the requested arch
170170if " _%VisualStudioVersion% _" == " _15.0_" if " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto found_vs2017
171+ @ rem need to clear VSINSTALLDIR for vcvarsall to work as expected
171172set " VSINSTALLDIR = "
172173call tools\msvs\vswhere_usability_wrapper.cmd
173174if " _%VCINSTALLDIR% _" == " __" goto vs-set-2015
174- @ rem need to clear VSINSTALLDIR for vcvarsall to work as expected
175175set vcvars_call = " %VCINSTALLDIR% \Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
176176echo calling: %vcvars_call%
177177call %vcvars_call%
178-
178+ if errorlevel 1 goto vs-set-2015
179179:found_vs2017
180180echo Found MSVS version %VisualStudioVersion%
181181set GYP_MSVS_VERSION = 2017
@@ -184,11 +184,10 @@ goto msbuild-found
184184
185185@ rem Look for Visual Studio 2015
186186:vs-set-2015
187- if " %target_env% " NEQ " vs2015" goto msbuild-not-found
187+ if defined target_env if " %target_env% " NEQ " vs2015" goto msbuild-not-found
188188echo Looking for Visual Studio 2015
189189if not defined VS140COMNTOOLS goto msbuild-not-found
190190if not exist " %VS140COMNTOOLS% \..\..\vc\vcvarsall.bat" goto msbuild-not-found
191- echo Found Visual Studio 2015
192191if defined msi (
193192 echo Looking for WiX installation for Visual Studio 2015...
194193 if not exist " %WIX% \SDK\VS2015" (
@@ -201,6 +200,8 @@ if defined msi (
201200call " %VS140COMNTOOLS% \..\..\vc\vcvarsall.bat"
202201SET VCVARS_VER = 140
203202if not defined VCINSTALLDIR goto msbuild-not-found
203+ @ rem Visual C++ Build Tools 2015 does not define VisualStudioVersion
204+ echo Found MSVS version 14.0
204205set GYP_MSVS_VERSION = 2015
205206set PLATFORM_TOOLSET = v140
206207goto msbuild-found
0 commit comments