Changed build files to meson

This commit is contained in:
Jordon Brooks 2025-05-05 14:14:36 +01:00
parent 9d4436cc00
commit 0460ae1a50
Signed by: jordon
GPG key ID: DBD9758CD53E786A
17 changed files with 170 additions and 127 deletions

View file

@ -1,2 +1,71 @@
call .\vendor\bin\premake\premake5.exe vs2022
PAUSE
@echo off
setlocal enabledelayedexpansion
rem ──────────────────────────────────────────────────
rem Defaults (override by passing [backend] [build])
rem ──────────────────────────────────────────────────
set BUILD_DIR=builddir
set BACKEND=ninja
set BUILD=debug
rem ──────────────────────────────────────────────────
rem Recognize help flags
rem ──────────────────────────────────────────────────
if /I "%~1"=="-?" goto usage
if /I "%~1"=="/?" goto usage
if /I "%~1"=="-h" goto usage
if /I "%~1"=="--help" goto usage
rem ──────────────────────────────────────────────────
rem Parse positional arguments
rem ──────────────────────────────────────────────────
if not "%~1"=="" set BACKEND=%~1
if not "%~2"=="" set BUILD=%~2
rem ──────────────────────────────────────────────────
rem Bootstrap Visual Studio if requested
rem ──────────────────────────────────────────────────
if /I "%BACKEND:~0,2%"=="vs" (
echo [INFO] Initializing Visual Studio environment for %BACKEND%...
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to initialize VS environment. Check the vcvarsall.bat path.
exit /b 1
)
)
rem ──────────────────────────────────────────────────
rem Configure or reconfigure with Meson
rem ──────────────────────────────────────────────────
if not exist "%BUILD_DIR%" (
echo [INFO] Creating build directory "%BUILD_DIR%" with backend "%BACKEND%" and build "%BUILD%"...
meson setup "%BUILD_DIR%" --backend=%BACKEND% --buildtype=%BUILD%
) else (
echo [INFO] Reconfiguring "%BUILD_DIR%" with backend "%BACKEND%" and build "%BUILD%"...
meson setup --reconfigure "%BUILD_DIR%" --backend=%BACKEND% --buildtype=%BUILD%
)
if errorlevel 1 (
echo [ERROR] Meson configuration failed.
exit /b 1
)
rem ──────────────────────────────────────────────────
rem Compile
rem ──────────────────────────────────────────────────
echo [INFO] Configuration succeeded—starting build...
meson compile -C "%BUILD_DIR%"
if errorlevel 1 (
echo [ERROR] Build failed.
exit /b 1
)
echo [SUCCESS] Build completed successfully.
exit /b 0
:usage
echo Usage: %~nx0 [backend] [build]
echo.
echo backend ninja (default) ^| vs2022 ^| vs2019 ^| vs2017
echo build debug (default) ^| debugoptimized ^| release ^| relwithdebinfo
exit /b 0