Skip to content

Commit 774fd4e

Browse files
committed
add support for Visual Studio 2026, remove unsupported Visual Studio 2015
1 parent 0cd0ef0 commit 774fd4e

File tree

6 files changed

+220
-214
lines changed

6 files changed

+220
-214
lines changed

BUILDING

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ On Unix variants:
2525

2626
On Windows:
2727

28-
* Microsoft Visual Studio 2022, 2019, 2017, or 2015
28+
* Microsoft Visual Studio 2026, 2022, 2019, or 2017
2929

3030

3131
GETTING STARTED
@@ -370,10 +370,8 @@ where <machine type> is one of the following:
370370
* ti3nt (32-bit Intel threaded)
371371
* i3nt (32-bit Intel non-threaded)
372372

373-
If you're using Visual Studio 2022 or 2019, install "Desktop
374-
development with C++" on the "Workloads" tabs and the "C++ 20[xx]
375-
Redistributable MSMs" on the "Individual components" tab under the
376-
"Compilers, build tools, and runtimes" section. The `build.bat` script
373+
If you're using Visual Studio 2026, 2022 or 2019, install "Desktop
374+
development with C++" on the "Workloads" tab. The `build.bat` script
377375
will use `c\vs.bat` to find and set up Microsoft Visual Studio
378376
command-line tools automatically for <machine type>; supply `/keepvs`
379377
if you have set up command-line tools already so that `c\vs.bat`

build.bat

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
1-
@echo off
2-
setlocal
3-
4-
set M=%1
5-
set WORKAREA=%M%
6-
set LINKAS=dll
7-
set RUNTIMEAS=dll
8-
set SRCDIR=%~dp0
9-
set MAKETARGET=all-dlls
10-
set SKIPVS=no
11-
set SKIPSUBMODULE=no
12-
set USEPB=yes
13-
14-
if "%WORKAREA%"=="" goto needargument
15-
16-
:argloop
17-
shift
18-
set ARG=%1
19-
if defined ARG (
20-
if "%ARG%"=="/dll" set LINKAS=dll && goto argloop
21-
if "%ARG%"=="/exe" set LINKAS=exe && goto argloop
22-
if "%ARG%"=="/MD" set RUNTIMEAS=dll && goto argloop
23-
if "%ARG%"=="/MT" set RUNTIMEAS=static && goto argloop
24-
if "%ARG%"=="/only" set MAKETARGET=build && goto argloop
25-
if "%ARG%"=="/kernel" set MAKETARGET=kernel && goto argloop
26-
if "%ARG%"=="/none" set MAKETARGET=none && goto argloop
27-
if "%ARG%"=="/config" set MAKETARGET=none && goto argloop
28-
if "%ARG%"=="/force" set USEPB=no && goto argloop
29-
if "%ARG%"=="/test-one" set MAKETARGET=test-one && goto argloop
30-
if "%ARG%"=="/test-some-fast" set MAKETARGET=test-some-fast && goto argloop
31-
if "%ARG%"=="/test-some" set MAKETARGET=test-some && goto argloop
32-
if "%ARG%"=="/test" set MAKETARGET=test && goto argloop
33-
if "%ARG%"=="/test-more" set MAKETARGET=test-more && goto argloop
34-
if "%ARG%"=="/keepvs" set SKIPVS=yes && goto argloop
35-
if "%ARG%"=="/as-is" set SKIPSUBMODULE=yes && goto argloop
36-
echo Unrecognized argument %ARG%
37-
exit /B 1
38-
)
39-
40-
if "%M%"=="pb" set VSCONFIG=x86
41-
if "%M%"=="i3nt" set VSCONFIG=x86
42-
if "%M%"=="ti3nt" set VSCONFIG=x86
43-
if "%M%"=="a6nt" set VSCONFIG=x86_amd64
44-
if "%M%"=="ta6nt" set VSCONFIG=x86_amd64
45-
if "%M%"=="arm64nt" set VSCONFIG=x64_arm64
46-
if "%M%"=="tarm64nt" set VSCONFIG=x64_arm64
47-
if "%VSCONFIG%"=="" (
48-
echo Unrecognized machine type %M%
49-
exit /B 1
50-
)
51-
52-
if %SKIPSUBMODULE%==yes goto postsubmodule
53-
if not exist .git goto postsubmodule
54-
where git > NUL 2>&1
55-
if %ERRORLEVEL% neq 0 goto postsubmodule
56-
git submodule update --init --depth 1
57-
:postsubmodule
58-
59-
if not exist %WORKAREA% mkdir %WORKAREA%
60-
61-
echo srcdir=%SRCDIR% > %WORKAREA%\Mf-config
62-
echo m=%M% >> %WORKAREA%\Mf-config
63-
echo linkAs=%LINKAS% >> %WORKAREA%\Mf-config
64-
echo runtimeAs=%RUNTIMEAS% >> %WORKAREA%\Mf-config
65-
echo enableFrompb=%USEPB% >> %WORKAREA%\Mf-config
66-
67-
echo workarea=%WORKAREA% > Makefile
68-
echo !include %WORKAREA%\Mf-config >> Makefile
69-
type "%SRCDIR%\makefiles\Makefile.nt" >> Makefile
70-
71-
copy /y "%SRCDIR%\makefiles\buildmain.zuo" main.zuo > NUL
72-
copy /y "%SRCDIR%\makefiles\workmain.zuo" %WORKAREA%\main.zuo > NUL
73-
74-
echo Configured for %M%
75-
76-
if %MAKETARGET%==none goto donebuilding
77-
78-
if %SKIPVS%==yes goto donevs
79-
echo Configuring VS for %VSCONFIG%
80-
call "%SRCDIR%/c/vs.bat" %VSCONFIG%
81-
:donevs
82-
83-
nmake /nologo %MAKETARGET%
84-
85-
goto donebuilding
86-
87-
:needargument
88-
89-
echo Please supply the machine name as an argument
90-
exit /B 1
91-
92-
:donebuilding
1+
@echo off
2+
setlocal
3+
4+
set M=%1
5+
set WORKAREA=%M%
6+
set LINKAS=dll
7+
set RUNTIMEAS=dll
8+
set SRCDIR=%~dp0
9+
set MAKETARGET=all-dlls
10+
set SKIPVS=no
11+
set SKIPSUBMODULE=no
12+
set USEPB=yes
13+
14+
if "%WORKAREA%"=="" goto needargument
15+
16+
:argloop
17+
shift
18+
set ARG=%1
19+
if defined ARG (
20+
if "%ARG%"=="/dll" set LINKAS=dll && goto argloop
21+
if "%ARG%"=="/exe" set LINKAS=exe && goto argloop
22+
if "%ARG%"=="/MD" set RUNTIMEAS=dll && goto argloop
23+
if "%ARG%"=="/MT" set RUNTIMEAS=static && goto argloop
24+
if "%ARG%"=="/only" set MAKETARGET=build && goto argloop
25+
if "%ARG%"=="/kernel" set MAKETARGET=kernel && goto argloop
26+
if "%ARG%"=="/none" set MAKETARGET=none && goto argloop
27+
if "%ARG%"=="/config" set MAKETARGET=none && goto argloop
28+
if "%ARG%"=="/force" set USEPB=no && goto argloop
29+
if "%ARG%"=="/test-one" set MAKETARGET=test-one && goto argloop
30+
if "%ARG%"=="/test-some-fast" set MAKETARGET=test-some-fast && goto argloop
31+
if "%ARG%"=="/test-some" set MAKETARGET=test-some && goto argloop
32+
if "%ARG%"=="/test" set MAKETARGET=test && goto argloop
33+
if "%ARG%"=="/test-more" set MAKETARGET=test-more && goto argloop
34+
if "%ARG%"=="/keepvs" set SKIPVS=yes && goto argloop
35+
if "%ARG%"=="/as-is" set SKIPSUBMODULE=yes && goto argloop
36+
echo Unrecognized argument %ARG%
37+
exit /B 1
38+
)
39+
40+
if "%M%"=="pb" set VSCONFIG=x86
41+
if "%M%"=="i3nt" set VSCONFIG=x86
42+
if "%M%"=="ti3nt" set VSCONFIG=x86
43+
if "%M%"=="a6nt" set VSCONFIG=x86_amd64
44+
if "%M%"=="ta6nt" set VSCONFIG=x86_amd64
45+
if "%M%"=="arm64nt" set VSCONFIG=x64_arm64
46+
if "%M%"=="tarm64nt" set VSCONFIG=x64_arm64
47+
if "%VSCONFIG%"=="" (
48+
echo Unrecognized machine type %M%
49+
exit /B 1
50+
)
51+
52+
if %SKIPSUBMODULE%==yes goto postsubmodule
53+
if not exist .git goto postsubmodule
54+
where git > NUL 2>&1
55+
if %ERRORLEVEL% neq 0 goto postsubmodule
56+
git submodule update --init --depth 1
57+
:postsubmodule
58+
59+
if not exist %WORKAREA% mkdir %WORKAREA%
60+
61+
echo srcdir=%SRCDIR% > %WORKAREA%\Mf-config
62+
echo m=%M% >> %WORKAREA%\Mf-config
63+
echo linkAs=%LINKAS% >> %WORKAREA%\Mf-config
64+
echo runtimeAs=%RUNTIMEAS% >> %WORKAREA%\Mf-config
65+
echo enableFrompb=%USEPB% >> %WORKAREA%\Mf-config
66+
67+
echo workarea=%WORKAREA% > Makefile
68+
echo !include %WORKAREA%\Mf-config >> Makefile
69+
type "%SRCDIR%\makefiles\Makefile.nt" >> Makefile
70+
71+
copy /y "%SRCDIR%\makefiles\buildmain.zuo" main.zuo > NUL
72+
copy /y "%SRCDIR%\makefiles\workmain.zuo" %WORKAREA%\main.zuo > NUL
73+
74+
echo Configured for %M%
75+
76+
if %MAKETARGET%==none goto donebuilding
77+
78+
if %SKIPVS%==yes goto donevs
79+
echo Configuring VS for %VSCONFIG%
80+
call "%SRCDIR%/c/vs.bat" %VSCONFIG%
81+
:donevs
82+
83+
nmake /nologo %MAKETARGET%
84+
85+
goto donebuilding
86+
87+
:needargument
88+
89+
echo Please supply the machine name as an argument
90+
exit /B 1
91+
92+
:donebuilding

c/vs.bat

Lines changed: 78 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,78 @@
1-
@echo off
2-
set Applications=%ProgramFiles(x86)%
3-
if not "%Applications%" == "" goto win64
4-
set Applications=%ProgramFiles%
5-
:win64
6-
7-
:: Set up Visual Studio command line environment variables given a
8-
:: machine type, e.g., amd64 or x86.
9-
10-
:: Visual Studio 2022 Enterprise
11-
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build
12-
if exist "%BATDIR%\vcvarsall.bat" goto found
13-
14-
:: Visual Studio 2022 Professional
15-
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build
16-
if exist "%BATDIR%\vcvarsall.bat" goto found
17-
18-
:: Visual Studio 2022 Community
19-
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build
20-
if exist "%BATDIR%\vcvarsall.bat" goto found
21-
22-
:: Visual Studio 2019 Enterprise
23-
set BATDIR=%Applications%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build
24-
if exist "%BATDIR%\vcvarsall.bat" goto found
25-
26-
:: Visual Studio 2019 Professional
27-
set BATDIR=%Applications%\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build
28-
if exist "%BATDIR%\vcvarsall.bat" goto found
29-
30-
:: Visual Studio 2019 Community
31-
set BATDIR=%Applications%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
32-
if exist "%BATDIR%\vcvarsall.bat" goto found
33-
34-
:: Visual Studio 2019 BuildTools
35-
set BATDIR=%Applications%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build
36-
if exist "%BATDIR%\vcvarsall.bat" goto found
37-
38-
:: Visual Studio 2017 Enterprise
39-
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
40-
if exist "%BATDIR%\vcvarsall.bat" goto found
41-
42-
:: Visual Studio 2017 Professional
43-
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build
44-
if exist "%BATDIR%\vcvarsall.bat" goto found
45-
46-
:: Visual Studio 2017 Community
47-
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
48-
if exist "%BATDIR%\vcvarsall.bat" goto found
49-
50-
:: Visual Studio 2017 BuildTools
51-
set BATDIR=%Applications%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
52-
if exist "%BATDIR%\vcvarsall.bat" goto found
53-
54-
:: Visual Studio 2015
55-
set BATDIR=%VS140COMNTOOLS%..\..\VC
56-
if exist "%BATDIR%\vcvarsall.bat" goto found
57-
58-
echo Visual Studio 2022, 2019, 2017, or 2015 must be installed.
59-
exit 1
60-
61-
:found
62-
63-
:: Clear environment variables that we might otherwise inherit
64-
set INCLUDE=
65-
set LIB=
66-
set LIBPATH=
67-
68-
:: Visual Studio 2017's vcvarsall.bat changes the directory to %USERPROFILE%\Source if the directory exists. See https://developercommunity.visualstudio.com/content/problem/26780/vsdevcmdbat-changes-the-current-working-directory.html
69-
set VSCMD_START_DIR=%CD%
70-
"%BATDIR%\vcvarsall.bat" %1
1+
@echo off
2+
set Applications=%ProgramFiles(x86)%
3+
if not "%Applications%" == "" goto win64
4+
set Applications=%ProgramFiles%
5+
:win64
6+
7+
:: Set up Visual Studio command line environment variables given a
8+
:: machine type, e.g., amd64 or x86.
9+
10+
:: Visual Studio 2026 Enterprise
11+
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build
12+
if exist "%BATDIR%\vcvarsall.bat" goto found
13+
14+
:: Visual Studio 2026 Professional
15+
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\18\Professional\VC\Auxiliary\Build
16+
if exist "%BATDIR%\vcvarsall.bat" goto found
17+
18+
:: Visual Studio 2026 Community
19+
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build
20+
if exist "%BATDIR%\vcvarsall.bat" goto found
21+
22+
:: Visual Studio 2022 Enterprise
23+
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build
24+
if exist "%BATDIR%\vcvarsall.bat" goto found
25+
26+
:: Visual Studio 2022 Professional
27+
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build
28+
if exist "%BATDIR%\vcvarsall.bat" goto found
29+
30+
:: Visual Studio 2022 Community
31+
set BATDIR=%ProgramW6432%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build
32+
if exist "%BATDIR%\vcvarsall.bat" goto found
33+
34+
:: Visual Studio 2019 Enterprise
35+
set BATDIR=%Applications%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build
36+
if exist "%BATDIR%\vcvarsall.bat" goto found
37+
38+
:: Visual Studio 2019 Professional
39+
set BATDIR=%Applications%\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build
40+
if exist "%BATDIR%\vcvarsall.bat" goto found
41+
42+
:: Visual Studio 2019 Community
43+
set BATDIR=%Applications%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
44+
if exist "%BATDIR%\vcvarsall.bat" goto found
45+
46+
:: Visual Studio 2019 BuildTools
47+
set BATDIR=%Applications%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build
48+
if exist "%BATDIR%\vcvarsall.bat" goto found
49+
50+
:: Visual Studio 2017 Enterprise
51+
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
52+
if exist "%BATDIR%\vcvarsall.bat" goto found
53+
54+
:: Visual Studio 2017 Professional
55+
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build
56+
if exist "%BATDIR%\vcvarsall.bat" goto found
57+
58+
:: Visual Studio 2017 Community
59+
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
60+
if exist "%BATDIR%\vcvarsall.bat" goto found
61+
62+
:: Visual Studio 2017 BuildTools
63+
set BATDIR=%Applications%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
64+
if exist "%BATDIR%\vcvarsall.bat" goto found
65+
66+
echo Visual Studio 2026, 2022, 2019, or 2017 must be installed.
67+
exit 1
68+
69+
:found
70+
71+
:: Clear environment variables that we might otherwise inherit
72+
set INCLUDE=
73+
set LIB=
74+
set LIBPATH=
75+
76+
:: Visual Studio 2017's vcvarsall.bat changes the directory to %USERPROFILE%\Source if the directory exists. See https://developercommunity.visualstudio.com/content/problem/26780/vsdevcmdbat-changes-the-current-working-directory.html
77+
set VSCMD_START_DIR=%CD%
78+
"%BATDIR%\vcvarsall.bat" %1

0 commit comments

Comments
 (0)