Created batch files for building tools

This commit is contained in:
jaby 2022-08-21 14:46:07 +02:00
parent 37a7c582e7
commit 29ce5c4a77
3 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,51 @@
{
"folders": [
{
"path": "."
}
],
"settings": {},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "all",
"type": "shell",
"command": "./build_all.bat ${input:cargo cmd}",
"group": {
"kind": "build"
}
},
{
"label": "cargo",
"type": "shell",
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg}",
"group": {
"kind": "build",
}
}
],
"inputs": [
{
"id": "build cfg",
"type": "pickString",
"options": ["debug", "release"],
"default": "release",
"description": "build configuration"
},
{
"id": "project",
"type": "pickString",
"options": ["cdtypes", "psxcdgen", "psxcdread"],
"description": "project to build"
},
{
"id": "cargo cmd",
"type":"pickString",
"options": ["build", "check", "clean"],
"default": "build",
"description": "cargo command to run"
}
]
}
}

23
src/Tools/build_all.bat Normal file
View File

@ -0,0 +1,23 @@
@echo off
rem build_all [clean]
set bin_projects=psxcdgen psxcdread
set clean_projects=cdtypes
set projects=%bin_projects%
set build_type=build
set cur_dir=%cd%
IF NOT "%~1" == "" (
IF "%~1" == "clean" (
set build_type=clean
set projects=%projects% %clean_projects%
) ELSE (
set build_type=%~1
)
)
for %%a in (%projects%) do (
call run_cargo %%a %build_type% release
cd %cur_dir%
)

31
src/Tools/run_cargo.bat Normal file
View File

@ -0,0 +1,31 @@
@echo off
rem run_cargo.bat project build|check|clean debug|release
set org_dir=%cd%
cd %1
IF %2 == build (
echo cargo build %1 --%3
cargo build --%3
IF %ERRORLEVEL% == 0 (
xcopy target\%3\%1.exe %org_dir%\..\..\bin /y
)
exit /B %ERRORLEVEL%
)
IF %2 == check (
echo cargo check %1 --%3
cargo check --%3
exit /B %ERRORLEVEL%
)
IF %2 == clean (
echo cargo clean %1
cargo clean
exit /B %ERRORLEVEL%
)
echo "Unkown cargo command "%2" for project "%1"