44 lines
1.6 KiB
Batchfile
44 lines
1.6 KiB
Batchfile
@echo off
|
|
rem ---------------------------------------------------------------------------
|
|
rem Command-line build wrapper.
|
|
rem
|
|
rem Sets up the MSVC x64 environment (the piece Visual Studio configures for you
|
|
rem automatically) and then drives the exact same CMake presets that Visual
|
|
rem Studio uses, so both build paths stay in sync.
|
|
rem
|
|
rem Usage: build.cmd [preset]
|
|
rem preset defaults to "release-msvc". Other options: debug-msvc,
|
|
rem release-clang-cl, debug-clang-cl (must match a name in CMakePresets.json).
|
|
rem ---------------------------------------------------------------------------
|
|
setlocal
|
|
|
|
set "PRESET=%~1"
|
|
if "%PRESET%"=="" set "PRESET=release-msvc"
|
|
set "CONFIGURE_PRESET=build-%PRESET%"
|
|
|
|
cd /d "%~dp0"
|
|
|
|
rem --- Locate Visual Studio (or the C++ Build Tools) ---
|
|
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
if not exist "%VSWHERE%" (
|
|
echo [ERROR] vswhere.exe not found. Install Visual Studio 2022 or the C++ Build Tools.
|
|
exit /b 1
|
|
)
|
|
|
|
set "VSINSTALL="
|
|
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSINSTALL=%%i"
|
|
if not defined VSINSTALL (
|
|
echo [ERROR] No Visual Studio installation with the C++ toolset was found.
|
|
exit /b 1
|
|
)
|
|
|
|
rem --- Import the MSVC x64 developer environment ---
|
|
call "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" || exit /b 1
|
|
|
|
rem --- Configure and build using the shared presets ---
|
|
cmake --preset %CONFIGURE_PRESET% || exit /b 1
|
|
cmake --build --preset %PRESET% || exit /b 1
|
|
|
|
echo.
|
|
echo [OK] Built preset "%PRESET%". Plugin deployed to SKSE\Plugins\.
|