Skip to content

Commit 3361aa5

Browse files
committed
win32: Setup prerelease version of Visual Studio
1 parent df90a64 commit 3361aa5

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

win32/vssetup.cmd

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,31 @@
1010

1111
::- find the latest build tool and its setup batch file.
1212
@set VSDEVCMD=
13-
@for /f "delims=" %%I in ('"%vswhere%" -products * -latest -property installationPath') do @(
13+
@set VSDEV_ARGS=
14+
@set where_opt=
15+
@set arch=
16+
:argloop
17+
@(set arg=%1) & if defined arg (shift) else (goto :argend)
18+
@if "%arg%" == "-prerelease" (
19+
set where_opt=-prerelease
20+
goto :argloop
21+
)
22+
@if /i "%arg%" == "-arch" (
23+
set arch=%1
24+
shift
25+
goto :argloop
26+
)
27+
@if /i "%arg:~0,6%" == "-arch=" (
28+
set arch=%arg:~6%
29+
goto :argloop
30+
)
31+
32+
@set VSDEV_ARGS=%VSDEV_ARGS% %arg%
33+
@goto :argloop
34+
:argend
35+
@if defined VSDEV_ARGS set VSDEV_ARGS=%VSDEV_ARGS:~1%
36+
37+
@for /f "delims=" %%I in ('"%vswhere%" -products * -latest -property installationPath %where_opt%') do @(
1438
set VSDEVCMD=%%I\Common7\Tools\VsDevCmd.bat
1539
)
1640
@if not defined VSDEVCMD (
@@ -19,9 +43,14 @@
1943
)
2044

2145
::- default to the current processor.
22-
@set arch=%PROCESSOR_ARCHITECTURE%
46+
@set host_arch=%PROCESSOR_ARCHITECTURE%
47+
@if not defined arch set arch=%PROCESSOR_ARCHITECTURE%
2348
::- `vsdevcmd.bat` requires arch names to be lowercase
2449
@for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do @(
2550
call set arch=%%arch:%%i=%%i%%
51+
call set host_arch=%%host_arch:%%i=%%i%%
2652
)
27-
@(endlocal && "%VSDEVCMD%" -arch=%arch% -host_arch=%arch% %*)
53+
@if "%arch%" == "x86_64" set arch=amd64
54+
55+
::- chain to `vsdevcmd.bat`
56+
@(endlocal && "%VSDEVCMD%" -arch=%arch% -host_arch=%host_arch% %VSDEV_ARGS%)

0 commit comments

Comments
 (0)