2026-04-16 10:01:49 -05:00
|
|
|
@echo off
|
|
|
|
|
setlocal EnableDelayedExpansion
|
2026-08-19 14:37:43 -05:00
|
|
|
REM Build the BackstageInjection DLL for Windows x64 using cargo (MSVC target).
|
|
|
|
|
REM Requires a Rust toolchain with the x86_64-pc-windows-msvc target and MSVC
|
|
|
|
|
REM build tools (auto-detected by the cc crate via vswhere).
|
2026-04-16 10:01:49 -05:00
|
|
|
|
2026-06-12 09:14:49 -05:00
|
|
|
set "SCRIPT_DIR=%~dp0"
|
|
|
|
|
for %%I in ("%SCRIPT_DIR%..") do set "ROOT=%%~fI\"
|
2026-08-19 14:37:43 -05:00
|
|
|
set "CRATE_DIR=%ROOT%BackstageInjection-Rust"
|
2026-06-12 09:14:49 -05:00
|
|
|
set "OUT_DIR=%ROOT%Overlord-Server\dist-clients"
|
2026-08-19 14:37:43 -05:00
|
|
|
set "TARGET=x86_64-pc-windows-msvc"
|
|
|
|
|
set "DLL_NAME=BackstageInjection.x64.dll"
|
2026-04-16 10:01:49 -05:00
|
|
|
|
2026-08-19 14:37:43 -05:00
|
|
|
where cargo >nul 2>&1
|
2026-04-16 10:01:49 -05:00
|
|
|
if %ERRORLEVEL% neq 0 (
|
2026-08-19 14:37:43 -05:00
|
|
|
echo ERROR: cargo not found on PATH.
|
|
|
|
|
exit /b 1
|
2026-04-16 10:01:49 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
|
|
|
|
|
|
2026-08-19 14:37:43 -05:00
|
|
|
echo Building BackstageInjection DLL for %TARGET% ...
|
|
|
|
|
cargo build --release --target %TARGET% --manifest-path "%CRATE_DIR%\Cargo.toml"
|
2026-04-16 10:01:49 -05:00
|
|
|
if %ERRORLEVEL% neq 0 goto :error
|
|
|
|
|
|
2026-08-19 14:37:43 -05:00
|
|
|
set "SRC_DLL=%CRATE_DIR%\target\%TARGET%\release\BackstageInjection.dll"
|
|
|
|
|
if not exist "%SRC_DLL%" goto :error
|
|
|
|
|
|
|
|
|
|
copy /y "%SRC_DLL%" "%OUT_DIR%\%DLL_NAME%" >nul
|
|
|
|
|
if %ERRORLEVEL% neq 0 goto :error
|
2026-04-16 10:01:49 -05:00
|
|
|
|
|
|
|
|
echo.
|
2026-08-19 14:37:43 -05:00
|
|
|
echo Built: %OUT_DIR%\%DLL_NAME%
|
2026-04-16 10:01:49 -05:00
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
|
|
:error
|
|
|
|
|
echo.
|
|
|
|
|
echo BUILD FAILED
|
2026-08-19 14:37:43 -05:00
|
|
|
exit /b 1
|