diff --git a/build_all.bat b/build_all.bat deleted file mode 100644 index 87792541..00000000 --- a/build_all.bat +++ /dev/null @@ -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 \ No newline at end of file diff --git a/examples/PoolBox/PoolBox.code-workspace b/examples/PoolBox/PoolBox.code-workspace index 0bcf8bd0..b7db6d9b 100644 --- a/examples/PoolBox/PoolBox.code-workspace +++ b/examples/PoolBox/PoolBox.code-workspace @@ -1,82 +1,87 @@ -{ - "folders": [ - { - "path": ".", - "name": "PoolBox" - } - ], - "tasks": { - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "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})", - "group": { - "kind": "build", - "isDefault": true - }, - "options": { - "env": { - "PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}" - } - } - }, - { - "label": "read memory map", - "type": "shell", - "command": "psxreadmap.exe ${input:output memory map} application/bin/PSX-${input:build profile}/PoolBox.elf", - "problemMatcher": [], - "options": { - "env": { - "PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}" - } - } - } - ], - "inputs": [ - { - "id": "build profile", - "type": "pickString", - "options": ["debug", "release"], - "default": "release", - "description": "The build profile for PoolBox" - }, - { - "id": "project", - "type": "pickString", - "options": ["all", "assets", "application", "cd"], - "default": "all", - "description": "Project to build" - }, - { - "id": "target", - "type": "pickString", - "options": ["all", "clean", "rebuild"], - "default": "all", - "description": "the build target" - }, - { - "id": "output memory map", - "type": "pickString", - "options": ["", "-o application/bin/PoolBox.map"], - "default": "", - "description": "Output a memory map" - } - ] - }, - "settings": { - "C_Cpp.default.includePath": [ - "${env:JABY_ENGINE_PATH}/include" - ], - "C_Cpp.default.compilerPath": "", - "C_Cpp.default.cStandard": "c17", - "C_Cpp.default.cppStandard": "c++20", - "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", - "C_Cpp.default.compilerArgs": [ - ], - "C_Cpp.default.defines": [ - "JABYENGINE_PAL" - ], - } +{ + "folders": [ + { + "path": ".", + "name": "PoolBox" + } + ], + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "windows": { // v re-export for WSL v re-export for WSL + "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})", + }, + "linux": { + "command": "make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile}", + }, + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "env": { + "PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}" + } + } + }, + { + "label": "read memory map", + "type": "shell", + "command": "psxreadmap.exe ${input:output memory map} application/bin/PSX-${input:build profile}/PoolBox.elf", + "problemMatcher": [], + "options": { + "env": { + "PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}" + } + } + } + ], + "inputs": [ + { + "id": "build profile", + "type": "pickString", + "options": ["debug", "release"], + "default": "release", + "description": "The build profile for PoolBox" + }, + { + "id": "project", + "type": "pickString", + "options": ["all", "assets", "application", "cd"], + "default": "all", + "description": "Project to build" + }, + { + "id": "target", + "type": "pickString", + "options": ["all", "clean", "rebuild"], + "default": "all", + "description": "the build target" + }, + { + "id": "output memory map", + "type": "pickString", + "options": ["", "-o application/bin/PoolBox.map"], + "default": "", + "description": "Output a memory map" + } + ] + }, + "settings": { + "C_Cpp.default.includePath": [ + "${env:JABY_ENGINE_PATH}/include" + ], + "C_Cpp.default.compilerPath": "", + "C_Cpp.default.cStandard": "c17", + "C_Cpp.default.cppStandard": "c++20", + "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", + "C_Cpp.default.compilerArgs": [ + ], + "C_Cpp.default.defines": [ + "JABYENGINE_PAL" + ], + } } \ No newline at end of file diff --git a/src/Library/Library.code-workspace b/src/Library/Library.code-workspace index 1833c689..b0557255 100644 --- a/src/Library/Library.code-workspace +++ b/src/Library/Library.code-workspace @@ -1,76 +1,72 @@ -{ - "folders": [ - { - "name": "JabyEngine", - "path": ".", - }, - { - "name": "Include", - "path": "..\\..\\include" - }, - { - "name": "Root", - "path": "..\\.." - } - ], - "tasks": { - "version": "2.0.0", - "tasks": [ - { - "label": "make", - "type": "shell", - "command": "./run_make.bat ${input:target} ${input:build cfg}", - "group": "build" - }, - { - "label": "Build Libary and Tools", - "type": "shell", - "command": "./build_all.bat ${input:target}", - "group": "build", - "options": { - "cwd": "../.." - } - }, - ], - "inputs": [ - { - "id": "build cfg", - "type": "pickString", - "options": ["debug", "release"], - "default": "release", - "description": "build configuration" - }, - { - "id": "target", - "type": "pickString", - "options": ["build", "clean", "rebuild"], - "default": "build", - "description": "build target", - } - ] - }, - "settings": { - "cmake.configureOnOpen": false, - "C_Cpp.default.includePath": [ - "include", - "../../include" - ], - "C_Cpp.default.compilerPath": "", - "C_Cpp.default.cStandard": "c17", - "C_Cpp.default.cppStandard": "c++20", - "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", - "C_Cpp.default.compilerArgs": [ - ], - "C_Cpp.default.defines": [ - "JABYENGINE_PAL", - "__friends=public" - ], - "files.exclude": { - "**/*.o": true, - "**/*.dep": true - }, - "files.associations": { - "stdio.h": "c" - } - } +{ + "folders": [ + { + "name": "JabyEngine", + "path": ".", + }, + { + "name": "Include", + "path": "..\\..\\include" + }, + { + "name": "Root", + "path": "..\\.." + } + ], + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "label": "make", + "type": "shell", + "windows": { + "command": "wsl make ${input:target} BUILD_PROFILE=${input:build cfg}", + }, + "linux": { + "command": "make ${input:target} BUILD_PROFILE=${input:build cfg}", + }, + "group": "build" + } + ], + "inputs": [ + { + "id": "build cfg", + "type": "pickString", + "options": ["debug", "release"], + "default": "release", + "description": "build configuration" + }, + { + "id": "target", + "type": "pickString", + "options": ["all", "clean", "rebuild"], + "default": "all", + "description": "build target", + } + ] + }, + "settings": { + "cmake.configureOnOpen": false, + "C_Cpp.default.includePath": [ + "include", + "../../include" + ], + "C_Cpp.default.compilerPath": "", + "C_Cpp.default.cStandard": "c17", + "C_Cpp.default.cppStandard": "c++20", + "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", + "C_Cpp.default.compilerArgs": [ + ], + "C_Cpp.default.defines": [ + "JABYENGINE_PAL", + "__friends=public" + ], + "files.exclude": { + "**/*.o": true, + "**/*.dep": true + }, + "files.associations": { + "stdio.h": "c" + } + } } \ No newline at end of file diff --git a/src/Library/run_make.bat b/src/Library/run_make.bat deleted file mode 100644 index 4453913e..00000000 --- a/src/Library/run_make.bat +++ /dev/null @@ -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 diff --git a/src/Tools/.config_build_all/linux.bat b/src/Tools/.config_build_all/linux.bat deleted file mode 100644 index 901cc3fc..00000000 --- a/src/Tools/.config_build_all/linux.bat +++ /dev/null @@ -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= \ No newline at end of file diff --git a/src/Tools/.config_build_all/recommended.bat b/src/Tools/.config_build_all/recommended.bat deleted file mode 100644 index 8d991c09..00000000 --- a/src/Tools/.config_build_all/recommended.bat +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/Tools/.config_build_all/windows.bat b/src/Tools/.config_build_all/windows.bat deleted file mode 100644 index c940a9cc..00000000 --- a/src/Tools/.config_build_all/windows.bat +++ /dev/null @@ -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= \ No newline at end of file diff --git a/src/Tools/Tools.code-workspace b/src/Tools/Tools.code-workspace index 2fb9ea1b..f45ceabe 100644 --- a/src/Tools/Tools.code-workspace +++ b/src/Tools/Tools.code-workspace @@ -1,92 +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" - } - }, - { - "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" + } + ] + } } \ No newline at end of file diff --git a/src/Tools/build_all.bat b/src/Tools/build_all.bat index 819747ff..fd823904 100644 --- a/src/Tools/build_all.bat +++ b/src/Tools/build_all.bat @@ -1,39 +1,20 @@ -@echo off -setlocal EnableDelayedExpansion -rem build_all [clean] [recommended|windows|linux] - -call .config_build_all/recommended.bat -IF NOT "%~2" == "" ( - set config_path=.config_build_all/%~2.bat - IF exist "!config_path!" ( - call !config_path! - ) ELSE ( - @echo "Configuration !config_path! not found" - exit -1 - ) -) - -set projects=%bin_projects% -set linux_projects=%bin_linux_projects% -set build_type=build -set cur_dir=%cd% - -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% +@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% ) \ No newline at end of file diff --git a/src/Tools/build_all.sh b/src/Tools/build_all.sh new file mode 100644 index 00000000..03d49384 --- /dev/null +++ b/src/Tools/build_all.sh @@ -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 \ No newline at end of file diff --git a/src/Tools/run_cargo.bat b/src/Tools/run_cargo.bat index edc29ee8..4dc7601a 100644 --- a/src/Tools/run_cargo.bat +++ b/src/Tools/run_cargo.bat @@ -1,63 +1,58 @@ -@echo off -setlocal EnableDelayedExpansion -rem run_cargo.bat project {build|check|clean|test} {debug|release} [linux|windows] - -set org_dir=%cd% -set bin_ext=.exe -set target=x86_64-pc-windows-msvc -set wsl= - -IF %4 == linux ( - set bin_ext= - 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 %2 == build set run_build=1 -IF %2 == test set run_build=1 - -cd %1 -IF defined run_build ( - echo cargo build %1 --%3 - %wsl%cargo build --%3 --target=%target% - - IF %2 == build IF %ERRORLEVEL% == 0 ( - xcopy target\%target%\%3\%1%bin_ext% %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" \ No newline at end of file diff --git a/src/Tools/run_cargo.sh b/src/Tools/run_cargo.sh new file mode 100644 index 00000000..260c6ab4 --- /dev/null +++ b/src/Tools/run_cargo.sh @@ -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 \ No newline at end of file