Skip to content

Commit 00d2f7c

Browse files
refackaddaleax
authored andcommitted
build,windows: check for VS version and arch
PR-URL: #13485 Fixes: #13398 Reviewed-By: James M Snell <[email protected]>
1 parent 52f5e3f commit 00d2f7c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vcbuild.bat

+8-5
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,16 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64
166166
:vs-set-2017
167167
if "%target_env%" NEQ "vs2017" goto vs-set-2015
168168
echo Looking for Visual Studio 2017
169-
if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2017
169+
@rem check if VS2017 is already setup, and for the requested arch
170+
if "_%VisualStudioVersion%_" == "_15.0_" if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2017
171+
set "VSINSTALLDIR="
170172
call tools\msvs\vswhere_usability_wrapper.cmd
171173
if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015
174+
@rem need to clear VSINSTALLDIR for vcvarsall to work as expected
172175
set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
173176
echo calling: %vcvars_call%
174177
call %vcvars_call%
178+
175179
:found_vs2017
176180
echo Found MSVS version %VisualStudioVersion%
177181
set GYP_MSVS_VERSION=2017
@@ -193,10 +197,9 @@ if defined msi (
193197
goto wix-not-found
194198
)
195199
)
196-
if "%VCVARS_VER%" NEQ "140" (
197-
call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat"
198-
SET VCVARS_VER=140
199-
)
200+
@rem VS2015 vsvarsall is quick, so run anyway
201+
call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat"
202+
SET VCVARS_VER=140
200203
if not defined VCINSTALLDIR goto msbuild-not-found
201204
set GYP_MSVS_VERSION=2015
202205
set PLATFORM_TOOLSET=v140

0 commit comments

Comments
 (0)