jabyengine/src/Tools/run_cargo.bat

64 lines
1.3 KiB
Batchfile

@echo off
setlocal EnableDelayedExpansion
rem run_cargo.bat project {build|check|clean} {debug|release} [linux|windows]
set org_dir=%cd%
set target=x86_64-pc-windows-msvc
set wsl=
IF %4 == linux (
wsl --shell-type login ./run_cargo.sh %1 %2 %3
exit /B %ERRORLEVEL%
)
IF defined CARGO_RUN_ARGS set run_args=-- %CARGO_RUN_ARGS%
cd %1
IF %2 == build (
echo cargo build %1 --%3
%wsl%cargo build --%3 --target=%target%
IF %ERRORLEVEL% == 0 (
xcopy target\%target%\%3\%1.exe %org_dir%\..\..\bin /y
)
exit /B %ERRORLEVEL%
)
IF %2 == run (
echo cargo run %1 --%3
%wsl%cargo run --%3 --target=%target% %run_args%
exit /B %ERRORLEVEL%
)
IF %2 == check (
echo cargo check %1 --%3
%wsl%cargo check --%3 --target=%target%
exit /B %ERRORLEVEL%
)
IF %2 == clean (
echo cargo clean %1
%wsl%cargo clean
rem We do not delete the bin folder anymore - is kinda to much
rem @del %org_dir%\..\..\bin\%1%bin_ext%
exit /B %ERRORLEVEL%
)
IF %2 == update (
echo cargo update %1
%wsl%cargo update
exit /B %ERRORLEVEL%
)
IF %2 == tree (
%wsl%cargo tree
exit /B %ERRORLEVEL%
)
echo "Unkown cargo command "%2" for project "%1"