Skip to content

Commit 4c0c943

Browse files
committed
Add Build Tools 2022 support and update safe PATH in build script and docs
1 parent ef2b378 commit 4c0c943

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ VSNASM/
3030
VSYASM/
3131
libass*
3232
testbuild.bat
33+
run_temp_*
3334

3435
#*/build/.vs
3536
build_mingw/*

build_msvc.cmd

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ setlocal EnableExtensions
44
:: 1. DETECT VISUAL STUDIO (with parameter hint)
55
:: =====================================================================
66
:: Usage (without parameter defaults to VS2022)
7-
:: build_msvc.bat 2022
8-
:: build_msvc.bat 2026
9-
:: build_msvc.bat 2026v143
7+
:: build_msvc.bat VS2022
8+
:: build_msvc.bat BT2022
9+
:: build_msvc.bat VS2026
10+
:: build_msvc.bat VS2026v143
1011

1112
set "HINT=%1"
1213
set "VS_TOOLSET="
1314

15+
set "BT2022_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
1416
set "VS2022_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat"
1517
set "VS2026_PATH=C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvarsall.bat"
1618

17-
if "%HINT%"=="2026v143" goto :try_2026v143
18-
if "%HINT%"=="2026" goto :try_2026
19-
if "%HINT%"=="2022" goto :try_2022
19+
if "%HINT%"=="VS2026v143" goto :try_2026v143
20+
if "%HINT%"=="VS2026" goto :try_2026
21+
if "%HINT%"=="BT2022" goto :try_2022BT
22+
if "%HINT%"=="VS2022" goto :try_2022
2023

2124
:try_2022
2225
if exist "%VS2022_PATH%" (
@@ -26,6 +29,14 @@ if exist "%VS2022_PATH%" (
2629
goto :found_vs
2730
)
2831

32+
:try_2022BT
33+
if exist "%BT2022_PATH%" (
34+
set "VCVARS=%BT2022_PATH%"
35+
set "VS_GEN=Visual Studio 17 2022"
36+
echo [INFO] Selected Visual Studio Build Tools 2022
37+
goto :found_vs
38+
)
39+
2940
:try_2026
3041
if exist "%VS2026_PATH%" (
3142
set "VCVARS=%VS2026_PATH%"
@@ -50,7 +61,7 @@ if not defined VCVARS (
5061
)
5162

5263
:found_vs
53-
set "SAFE_PATH=C:\Windows\System32;C:\Windows;C:\Program Files\Meson;%LocalAppData%\Microsoft\WinGet\Links"
64+
set "SAFE_PATH=C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows;C:\Program Files\Meson;%LocalAppData%\Microsoft\WinGet\Links;C:\Program Files\WinGet\Links"
5465

5566
:: 2. BUILD 64-BIT (x64)
5667
echo ============================================================
@@ -115,6 +126,7 @@ echo if not exist "libass" ( echo [ERROR] libass folder not found! ^& exit /b 1
115126
echo cd libass >> "%TFILE%"
116127
echo set CC=cl >> "%TFILE%"
117128
echo set CXX=cl >> "%TFILE%"
129+
echo meson wrap update-db >> "%TFILE%"
118130
echo meson setup %BDIR% --wrap-mode=forcefallback -Ddefault_library=static -Dbuildtype=release -Dasm=enabled -Db_vscrt=static_from_buildtype --prefix=%PREFIX% --wipe ^|^| exit /b 1 >> "%TFILE%"
119131
echo meson compile -C %BDIR% ^|^| exit /b 1 >> "%TFILE%"
120132
echo meson install -C %BDIR% ^|^| exit /b 1 >> "%TFILE%"

docs/BUILD.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ These all co-exist and mess up each other's paths and environment variables, and
7878
7979
Open a standard CMD and run (Isolate PATH to avoid MSYS2/MinGW conflicts):
8080
```cmd
81-
set PATH=C:\Windows\System32;C:\Windows;C:\Program Files\Meson;%LocalAppData%\Microsoft\WinGet\Links
81+
set PATH=C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows;C:\Program Files\Meson;%LocalAppData%\Microsoft\WinGet\Links;C:\Program Files\WinGet\Links
8282
```
8383

8484
And these (adjust path for your version) (default: 64-bit)
@@ -135,6 +135,7 @@ When you want non-standard choice (VS 2026 with v143 toolset with specific versi
135135
cd libass
136136
set CC=cl
137137
set CXX=cl
138+
meson wrap update-db
138139
meson setup build/x64 --wrap-mode=forcefallback -Ddefault_library=static -Dbuildtype=release -Dasm=enabled -Db_vscrt=static_from_buildtype -Dc_std=c11 -Dcpp_std=c++17 --prefix=C:/lib64
139140
meson compile -C build/x64
140141
meson install -C build/x64

0 commit comments

Comments
 (0)