Skip to content

Commit 906ef04

Browse files
committed
Improve install script installation handling.
1 parent 320d8a5 commit 906ef04

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

install_script.bat

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ REM Defined cript variables
55
set NASMDL=http://www.nasm.us/pub/nasm/releasebuilds
66
set NASMVERSION=2.14.02
77
set VSWHEREDL=https://github.com/Microsoft/vswhere/releases/download
8-
set VSWHEREVERSION=2.6.7
8+
set VSWHEREVERSION=2.8.4
99

1010
REM Store current directory and ensure working directory is the location of current .bat
1111
set CALLDIR=%CD%
@@ -16,8 +16,8 @@ set ERROR=0
1616
REM Check if being called from another instance
1717
if not "%~1"=="" (
1818
set MSVC_VER=%~1
19-
set VSINSTANCEDIR=%2
2019
set ISINSTANCE=1
20+
echo Installing VS%~1 customisations into %2
2121
goto MSVCCALL
2222
)
2323

@@ -80,21 +80,21 @@ if not exist "%SCRIPTDIR%\vswhere.exe" (
8080

8181
:VSwhereDetection
8282
REM Use vswhere to list detected installs
83-
for /f "usebackq tokens=1* delims=: " %%i in (`"%SCRIPTDIR%\vswhere.exe" -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
84-
for /f "delims=" %%a in ('echo %%j ^| find "2019"') do (
83+
for /f "usebackq tokens=* delims=" %%i in (`"%SCRIPTDIR%\vswhere.exe" -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
84+
for /f "delims=" %%a in ('echo %%i ^| find "2019"') do (
8585
if not "%%a"=="" (
8686
echo Visual Studio 2019 environment detected...
87-
call "%~0" "16" "%%j"
87+
call "%~0" "16" "%%i"
8888
if not ERRORLEVEL 1 (
8989
set MSVC16=1
9090
set MSVCFOUND=1
9191
)
9292
)
9393
)
94-
for /f "delims=" %%a in ('echo %%j ^| find "2017"') do (
94+
for /f "delims=" %%a in ('echo %%i ^| find "2017"') do (
9595
if not "%%a"=="" (
9696
echo Visual Studio 2017 environment detected...
97-
call "%~0" "15" "%%j"
97+
call "%~0" "15" "%%i"
9898
if not ERRORLEVEL 1 (
9999
set MSVC15=1
100100
set MSVCFOUND=1
@@ -104,26 +104,24 @@ for /f "usebackq tokens=1* delims=: " %%i in (`"%SCRIPTDIR%\vswhere.exe" -prerel
104104
)
105105

106106
REM Try and use vswhere to detect legacy installs
107-
for /f "usebackq tokens=1* delims=: " %%i in (`"%SCRIPTDIR%\vswhere.exe" -legacy`) do (
108-
if /i "%%i"=="installationPath" (
109-
for /f "delims=" %%a in ('echo %%j ^| find "2015"') do (
110-
if not "%%a"=="" (
111-
echo Visual Studio 2015 environment detected...
112-
call "%~0" "13" "%%j"
113-
if not ERRORLEVEL 1 (
114-
set MSVC13=1
115-
set MSVCFOUND=1
116-
)
107+
for /f "usebackq tokens=* delims=" %%i in (`"%SCRIPTDIR%\vswhere.exe" -legacy -property installationPath`) do (
108+
for /f "delims=" %%a in ('echo %%i ^| find "2015"') do (
109+
if not "%%a"=="" (
110+
echo Visual Studio 2015 environment detected...
111+
call "%~0" "13" "%%i"
112+
if not ERRORLEVEL 1 (
113+
set MSVC13=1
114+
set MSVCFOUND=1
117115
)
118116
)
119-
for /f "delims=" %%a in ('echo %%j ^| find "2013"') do (
120-
if not "%%a"=="" (
121-
echo Visual Studio 2013 environment detected...
122-
call "%~0" "12" "%%j"
123-
if not ERRORLEVEL 1 (
124-
set MSVC12=1
125-
set MSVCFOUND=1
126-
)
117+
)
118+
for /f "delims=" %%a in ('echo %%i ^| find "2013"') do (
119+
if not "%%a"=="" (
120+
echo Visual Studio 2013 environment detected...
121+
call "%~0" "12" "%%i"
122+
if not ERRORLEVEL 1 (
123+
set MSVC12=1
124+
set MSVCFOUND=1
127125
)
128126
)
129127
)
@@ -223,13 +221,13 @@ if "%SYSARCH%"=="32" (
223221
)
224222
REM Call the required vcvars file in order to setup up build locations
225223
if "%MSVC_VER%"=="16" (
226-
set VCVARS=%VSINSTANCEDIR%\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
224+
set VCVARS=%2\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
227225
) else if "%MSVC_VER%"=="15" (
228-
set VCVARS=%VSINSTANCEDIR%\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
226+
set VCVARS=%2\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
229227
) else if "%MSVC_VER%"=="14" (
230-
set VCVARS=%VSINSTANCEDIR%\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat
228+
set VCVARS=%2\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat
231229
) else if "%MSVC_VER%"=="12" (
232-
set VCVARS=%VSINSTANCEDIR%\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat
230+
set VCVARS=%2\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat
233231
) else (
234232
echo Error: Invalid MSVC version!
235233
goto Terminate

0 commit comments

Comments
 (0)