2026-04-16 10:01:49 -05:00
|
|
|
@echo off
|
|
|
|
|
setlocal EnableDelayedExpansion
|
2026-08-19 15:50:53 -05:00
|
|
|
REM Build the BackstageInjection DLL for Windows x64 using cargo (GNU target).
|
|
|
|
|
REM The GNU toolchain is required: the reflective loader manually maps the image
|
|
|
|
|
REM without the MSVC CRT bootstrapping, and the MSVC CRT's TLS/CFG machinery
|
|
|
|
|
REM fast-fails (0xC0000409) under a manual map. See
|
|
|
|
|
REM BackstageInjection-Rust/build.rs and protocol/README.md. Requires the
|
|
|
|
|
REM x86_64-pc-windows-gnu target and a mingw-w64 gcc for the cc crate.
|
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 15:50:53 -05:00
|
|
|
set "TARGET=x86_64-pc-windows-gnu"
|
2026-08-19 14:37:43 -05:00
|
|
|
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
|