Merge with new build technique

This commit is contained in:
jaby 2023-10-09 22:38:28 +02:00
commit 9e235a310c
12 changed files with 392 additions and 389 deletions

View File

@ -1,19 +0,0 @@
@echo off
rem build_all [clean]
set build_type=build
IF NOT "%~1" == "" (
set build_type=%~1
)
mkdir bin\
cd src\Tools\
call build_all.bat update
call build_all.bat %build_type%
cd ..\Library\
call run_make.bat %build_type% release
cd ..\..\
PAUSE

View File

@ -1,82 +1,87 @@
{ {
"folders": [ "folders": [
{ {
"path": ".", "path": ".",
"name": "PoolBox" "name": "PoolBox"
} }
], ],
"tasks": { "tasks": {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "build", "label": "build",
"type": "shell", "type": "shell",
"command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})", "windows": { // v re-export for WSL v re-export for WSL
"group": { "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})",
"kind": "build", },
"isDefault": true "linux": {
}, "command": "make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile}",
"options": { },
"env": { "group": {
"PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}" "kind": "build",
} "isDefault": true
} },
}, "options": {
{ "env": {
"label": "read memory map", "PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}"
"type": "shell", }
"command": "psxreadmap.exe ${input:output memory map} application/bin/PSX-${input:build profile}/PoolBox.elf", }
"problemMatcher": [], },
"options": { {
"env": { "label": "read memory map",
"PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}" "type": "shell",
} "command": "psxreadmap.exe ${input:output memory map} application/bin/PSX-${input:build profile}/PoolBox.elf",
} "problemMatcher": [],
} "options": {
], "env": {
"inputs": [ "PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}"
{ }
"id": "build profile", }
"type": "pickString", }
"options": ["debug", "release"], ],
"default": "release", "inputs": [
"description": "The build profile for PoolBox" {
}, "id": "build profile",
{ "type": "pickString",
"id": "project", "options": ["debug", "release"],
"type": "pickString", "default": "release",
"options": ["all", "assets", "application", "cd"], "description": "The build profile for PoolBox"
"default": "all", },
"description": "Project to build" {
}, "id": "project",
{ "type": "pickString",
"id": "target", "options": ["all", "assets", "application", "cd"],
"type": "pickString", "default": "all",
"options": ["all", "clean", "rebuild"], "description": "Project to build"
"default": "all", },
"description": "the build target" {
}, "id": "target",
{ "type": "pickString",
"id": "output memory map", "options": ["all", "clean", "rebuild"],
"type": "pickString", "default": "all",
"options": ["", "-o application/bin/PoolBox.map"], "description": "the build target"
"default": "", },
"description": "Output a memory map" {
} "id": "output memory map",
] "type": "pickString",
}, "options": ["", "-o application/bin/PoolBox.map"],
"settings": { "default": "",
"C_Cpp.default.includePath": [ "description": "Output a memory map"
"${env:JABY_ENGINE_PATH}/include" }
], ]
"C_Cpp.default.compilerPath": "", },
"C_Cpp.default.cStandard": "c17", "settings": {
"C_Cpp.default.cppStandard": "c++20", "C_Cpp.default.includePath": [
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86", "${env:JABY_ENGINE_PATH}/include"
"C_Cpp.default.compilerArgs": [ ],
], "C_Cpp.default.compilerPath": "",
"C_Cpp.default.defines": [ "C_Cpp.default.cStandard": "c17",
"JABYENGINE_PAL" "C_Cpp.default.cppStandard": "c++20",
], "C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
} "C_Cpp.default.compilerArgs": [
],
"C_Cpp.default.defines": [
"JABYENGINE_PAL"
],
}
} }

View File

@ -1,76 +1,72 @@
{ {
"folders": [ "folders": [
{ {
"name": "JabyEngine", "name": "JabyEngine",
"path": ".", "path": ".",
}, },
{ {
"name": "Include", "name": "Include",
"path": "..\\..\\include" "path": "..\\..\\include"
}, },
{ {
"name": "Root", "name": "Root",
"path": "..\\.." "path": "..\\.."
} }
], ],
"tasks": { "tasks": {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "make", "label": "make",
"type": "shell", "type": "shell",
"command": "./run_make.bat ${input:target} ${input:build cfg}", "windows": {
"group": "build" "command": "wsl make ${input:target} BUILD_PROFILE=${input:build cfg}",
}, },
{ "linux": {
"label": "Build Libary and Tools", "command": "make ${input:target} BUILD_PROFILE=${input:build cfg}",
"type": "shell", },
"command": "./build_all.bat ${input:target}", "group": "build"
"group": "build", }
"options": { ],
"cwd": "../.." "inputs": [
} {
}, "id": "build cfg",
], "type": "pickString",
"inputs": [ "options": ["debug", "release"],
{ "default": "release",
"id": "build cfg", "description": "build configuration"
"type": "pickString", },
"options": ["debug", "release"], {
"default": "release", "id": "target",
"description": "build configuration" "type": "pickString",
}, "options": ["all", "clean", "rebuild"],
{ "default": "all",
"id": "target", "description": "build target",
"type": "pickString", }
"options": ["build", "clean", "rebuild"], ]
"default": "build", },
"description": "build target", "settings": {
} "cmake.configureOnOpen": false,
] "C_Cpp.default.includePath": [
}, "include",
"settings": { "../../include"
"cmake.configureOnOpen": false, ],
"C_Cpp.default.includePath": [ "C_Cpp.default.compilerPath": "",
"include", "C_Cpp.default.cStandard": "c17",
"../../include" "C_Cpp.default.cppStandard": "c++20",
], "C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
"C_Cpp.default.compilerPath": "", "C_Cpp.default.compilerArgs": [
"C_Cpp.default.cStandard": "c17", ],
"C_Cpp.default.cppStandard": "c++20", "C_Cpp.default.defines": [
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86", "JABYENGINE_PAL",
"C_Cpp.default.compilerArgs": [ "__friends=public"
], ],
"C_Cpp.default.defines": [ "files.exclude": {
"JABYENGINE_PAL", "**/*.o": true,
"__friends=public" "**/*.dep": true
], },
"files.exclude": { "files.associations": {
"**/*.o": true, "stdio.h": "c"
"**/*.dep": true }
}, }
"files.associations": {
"stdio.h": "c"
}
}
} }

View File

@ -1,11 +0,0 @@
@echo off
rem run_make.bat build|clean|rebuild debug|release
IF %1 == build (
set make_target=all
) else (
set make_target=%1
)
@echo make %make_target% BUILD_PROFILE=%2
wsl make %make_target% BUILD_PROFILE=%2

View File

@ -1,4 +0,0 @@
set bin_linux_projects=%bin_projects% %bin_linux_projects%
set clean_projects_linux=%clean_projects% %clean_projects_linux%
set bin_projects=
set clean_projects=

View File

@ -1,4 +0,0 @@
set bin_projects=psxcdgen psxcdgen_ex psxcdread psxreadmap wslpath
set bin_linux_projects=cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay wslpath
set clean_projects=cdtypes
set clean_projects_linux=tool_helper

View File

@ -1,4 +0,0 @@
set bin_projects=%bin_projects% %bin_linux_projects%
set clean_projects=%clean_projects% %clean_projects_linux%
set bin_linux_projects=
set clean_projects_linux=

View File

@ -1,92 +1,110 @@
{ {
"folders": [ "folders": [
{ {
"path": "." "path": "."
} }
], ],
"settings": {}, "settings": {
"tasks": { },
"version": "2.0.0", "tasks": {
"tasks": [ "version": "2.0.0",
{ "tasks": [
"label": "all", {
"type": "shell", "label": "all",
"command": "./build_all.bat ${input:cargo cmd}", "type": "shell",
"group": { "windows": {
"kind": "build" "command": "./build_all.bat ${input:cargo cmd}"
} },
}, "linux": {
{ "command": "./build_all.sh ${input:cargo cmd}"
"label": "cargo", },
"type": "shell", "group": {
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}", "kind": "build"
"group": { },
"kind": "build", "options": {
}, "env": {
"options": { "win_tools": "psxcdgen_ex psxcdread psxreadmap wslpath",
"env": { "linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay",
"CARGO_RUN_ARGS": "${input:cargo run args}" "clean_tools": "cdtypes tool_helper"
} }
} }
}, },
{ {
"label": "cargo test", "label": "cargo",
"type": "shell", "type": "shell",
"command": "./run_cargo ${input:project} test release ${input:cargo target}" "windows": {
}, "command": "./run_cargo.bat ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
{ },
"label": "run test make", "linux": {
"type": "shell", "command": "./run_cargo.sh ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
"command": "wsl make -f Test.mk test_${input:project}", },
"group": { "group": {
"kind": "build", "kind": "build",
}, },
"options": { "options": {
"cwd": "${workspaceFolder}/Tests" "env": {
}, "CARGO_RUN_ARGS": "${input:cargo run args}"
"dependsOn": ["cargo test"], }
"dependsOrder": "sequence" }
} },
], {
"inputs": [ "label": "cargo test",
{ "type": "shell",
"id": "build cfg", "command": "./run_cargo ${input:project} test release ${input:cargo target}"
"type": "pickString", },
"options": ["debug", "release"], {
"default": "release", "label": "run test make",
"description": "build configuration" "type": "shell",
}, "command": "wsl make -f Test.mk test_${input:project}",
{ "group": {
"id": "project", "kind": "build",
"type": "pickString", },
"options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"], "options": {
"description": "project to build" "cwd": "${workspaceFolder}/Tests"
}, },
{ "dependsOn": ["cargo test"],
"id": "cargo cmd", "dependsOrder": "sequence"
"type":"pickString", }
"options": ["build", "check", "update", "clean", "run"], ],
"default": "build", "inputs": [
"description": "cargo command to run" {
}, "id": "build cfg",
{ "type": "pickString",
"id": "cargo target", "options": ["debug", "release"],
"type": "pickString", "default": "release",
"options": ["windows", "linux"], "description": "build configuration"
"description": "The target for the tool to build" },
}, {
{ "id": "project",
"id": "cargo run args", "type": "pickString",
"type": "pickString", "options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"],
"options": [ "description": "project to build"
"", },
"--help", {
"--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml", "id": "cargo cmd",
"--wsl -o Planschbecken.bin ../../../examples/PoolBox/application/bin/PSX-release/PoolBox.elf" "type":"pickString",
], "options": ["build", "check", "update", "clean", "run"],
"default": "", "default": "build",
"description": "Argument options to pass to cargo run" "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,39 +1,20 @@
@echo off @echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
rem build_all [clean] [recommended|windows|linux] rem build_all {build|check|clean}
call .config_build_all/recommended.bat if %1 == clean (
IF NOT "%~2" == "" ( for %%a in (%clean_tools%) do (
set config_path=.config_build_all/%~2.bat call .\run_cargo %%a %1 release windows
IF exist "!config_path!" ( cd %cur_dir%
call !config_path! )
) ELSE ( )
@echo "Configuration !config_path! not found"
exit -1 for %%a in (%win_tools%) do (
) call .\run_cargo %%a %1 release windows
) cd %cur_dir%
)
set projects=%bin_projects%
set linux_projects=%bin_linux_projects% for %%a in (%linux_tools%) do (
set build_type=build call .\run_cargo %%a %1 release linux
set cur_dir=%cd% cd %cur_dir%
IF NOT "%~1" == "" (
IF "%~1" == "clean" (
set build_type=clean
set projects=%projects% %clean_projects%
set linux_projects=%linux_projects% %clean_projects_linux%
) ELSE (
set build_type=%~1
)
)
for %%a in (%projects%) do (
call .\run_cargo %%a %build_type% release windows
cd %cur_dir%
)
for %%a in (%linux_projects%) do (
call .\run_cargo %%a %build_type% release linux
cd %cur_dir%
) )

12
src/Tools/build_all.sh Normal file
View File

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

View File

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

38
src/Tools/run_cargo.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# run_cargo.sh project {build|check|clean|test} {debug|release}
target=x86_64-unknown-linux-gnu
if [ -n "${CARGO_RUN_ARGS}" ]; then
run_args=-- ${CARGO_RUN_ARGS}
fi
cd $1
if [ $2 = build ]; then
echo "cargo build $1 --$3"
$HOME/.cargo/bin/cargo build --$3 --target=$target
if [ $? = 0 ]; then
cp target/$target/$3/$1 ../../../bin
echo "1 File(s) copied"
fi
exit $?
elif [ $2 = run ]; then
echo "cargo run $1 --$3"
$HOME/.cargo/bin/cargo run --$3 --target=$target
exit $?
elif [ $2 = check ]; then
echo "cargo check $1 --$3"
$HOME/.cargo/bin/cargo check --$3 --target=$target $run_args
exit $?
elif [ $2 = clean ]; then
echo "cargo clean $1"
$HOME/.cargo/bin/cargo clean
exit $?
else
echo "Unkown cargo command $2 for project $1"
fi