activate devenv in build.bat

This commit is contained in:
jacob 2025-12-06 11:20:51 -06:00
parent fd1ada7fe5
commit dbf20ebd16

View File

@ -15,6 +15,29 @@ if "%--force_meta_build%"=="1" (
echo build_cmd: %program_build_cmd%
::- Try to activate Visual Studio if devenv not detected
:: Taken from wcap: https://github.com/mmozeiko/wcap/blob/aa25ccb806d7a6e1c0bfdcca863aabcd8e9badfa/build.cmd#L21-L29
if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
set HOST_ARCH=x64
) else if "%PROCESSOR_ARCHITECTURE%" equ "ARM64" (
set HOST_ARCH=arm64
)
where /Q cl.exe || (
echo **************************************************************************
echo WARNING: cl.exe not found, attempting to locate Visual Studio installation
set __VSCMD_ARG_NO_LOGO=1
for /f "tokens=*" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath') do set VS=%%i
if "!VS!" equ "" (
echo ERROR: Visual Studio installation not found
exit /b 1
)
echo Visual Studio installation located, activating development environment...
call "!VS!\Common7\Tools\VsDevCmd.bat" -arch=%HOST_ARCH% -host_arch=%HOST_ARCH% -startdir=none -no_logo || exit /b 1
echo Visual studio development environment activated
echo **************************************************************************
)
::- Meta build
:meta_build
if not exist meta.exe (