Use new build scripts

This commit is contained in:
Jaby 2023-10-09 21:49:40 +02:00
parent 082baa0657
commit a16d0c10dc
4 changed files with 188 additions and 178 deletions

View File

@ -1,100 +1,110 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "all",
"type": "shell",
"command": "./build_all.bat ${input:cargo cmd}",
"group": {
"kind": "build"
},
"options": {
"env": {
"win_tools": "psxcdgen psxcdgen_ex psxcdread psxreadmap wslpath",
"linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay wslpath",
"clean_tools": "cdtypes tool_helper"
}
}
},
{
"label": "cargo",
"type": "shell",
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
"group": {
"kind": "build",
},
"options": {
"env": {
"CARGO_RUN_ARGS": "${input:cargo run args}"
}
}
},
{
"label": "cargo test",
"type": "shell",
"command": "./run_cargo ${input:project} test release ${input:cargo target}"
},
{
"label": "run test make",
"type": "shell",
"command": "wsl make -f Test.mk test_${input:project}",
"group": {
"kind": "build",
},
"options": {
"cwd": "${workspaceFolder}/Tests"
},
"dependsOn": ["cargo test"],
"dependsOrder": "sequence"
}
],
"inputs": [
{
"id": "build cfg",
"type": "pickString",
"options": ["debug", "release"],
"default": "release",
"description": "build configuration"
},
{
"id": "project",
"type": "pickString",
"options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"],
"description": "project to build"
},
{
"id": "cargo cmd",
"type":"pickString",
"options": ["build", "check", "update", "clean", "run"],
"default": "build",
"description": "cargo command to run"
},
{
"id": "cargo target",
"type": "pickString",
"options": ["windows", "linux"],
"description": "The target for the tool to build"
},
{
"id": "cargo run args",
"type": "pickString",
"options": [
"",
"--help",
"--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml",
"--wsl -o Planschbecken.bin ../../../examples/PoolBox/application/bin/PSX-release/PoolBox.elf"
],
"default": "",
"description": "Argument options to pass to cargo run"
}
]
}
{
"folders": [
{
"path": "."
}
],
"settings": {
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "all",
"type": "shell",
"windows": {
"command": "./build_all.bat ${input:cargo cmd}"
},
"linux": {
"command": "./build_all.sh ${input:cargo cmd}"
},
"group": {
"kind": "build"
},
"options": {
"env": {
"win_tools": "psxcdgen_ex psxcdread psxreadmap wslpath",
"linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay",
"clean_tools": "cdtypes tool_helper"
}
}
},
{
"label": "cargo",
"type": "shell",
"windows": {
"command": "./run_cargo.bat ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
},
"linux": {
"command": "./run_cargo.sh ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
},
"group": {
"kind": "build",
},
"options": {
"env": {
"CARGO_RUN_ARGS": "${input:cargo run args}"
}
}
},
{
"label": "cargo test",
"type": "shell",
"command": "./run_cargo ${input:project} test release ${input:cargo target}"
},
{
"label": "run test make",
"type": "shell",
"command": "wsl make -f Test.mk test_${input:project}",
"group": {
"kind": "build",
},
"options": {
"cwd": "${workspaceFolder}/Tests"
},
"dependsOn": ["cargo test"],
"dependsOrder": "sequence"
}
],
"inputs": [
{
"id": "build cfg",
"type": "pickString",
"options": ["debug", "release"],
"default": "release",
"description": "build configuration"
},
{
"id": "project",
"type": "pickString",
"options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"],
"description": "project to build"
},
{
"id": "cargo cmd",
"type":"pickString",
"options": ["build", "check", "update", "clean", "run"],
"default": "build",
"description": "cargo command to run"
},
{
"id": "cargo target",
"type": "pickString",
"options": ["windows", "linux"],
"description": "The target for the tool to build"
},
{
"id": "cargo run args",
"type": "pickString",
"options": [
"",
"--help",
"--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml",
"--wsl -o Planschbecken.bin ../../../examples/PoolBox/application/bin/PSX-release/PoolBox.elf"
],
"default": "",
"description": "Argument options to pass to cargo run"
}
]
}
}

View File

@ -1,20 +1,20 @@
@echo off
setlocal EnableDelayedExpansion
rem build_all {build|check|clean}
if %1 == clean (
for %%a in (%clean_tools%) do (
call .\run_cargo %%a %1 release windows
cd %cur_dir%
)
)
for %%a in (%win_tools%) do (
call .\run_cargo %%a %1 release windows
cd %cur_dir%
)
for %%a in (%linux_tools%) do (
call .\run_cargo %%a %1 release linux
cd %cur_dir%
@echo off
setlocal EnableDelayedExpansion
rem build_all {build|check|clean}
if %1 == clean (
for %%a in (%clean_tools%) do (
call .\run_cargo %%a %1 release windows
cd %cur_dir%
)
)
for %%a in (%win_tools%) do (
call .\run_cargo %%a %1 release windows
cd %cur_dir%
)
for %%a in (%linux_tools%) do (
call .\run_cargo %%a %1 release linux
cd %cur_dir%
)

View File

@ -2,11 +2,11 @@
# build_all {build|check|clean}
if [ $1 = clean ]; then
all_project=$win_tools $linux_tools $clean_tools
all_project="$win_tools $linux_tools $clean_tools"
else
all_project=$win_tools $linux_tools
all_project="$win_tools $linux_tools"
fi
for prj in ${all_project[@]}; do
source run_cargo.sh $prj $1 release
./run_cargo.sh $prj $1 release
done

View File

@ -1,58 +1,58 @@
@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%
)
@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%
)
echo "Unkown cargo command "%2" for project "%1"