Introduce Linux counter parts
This commit is contained in:
parent
c85d50a022
commit
1eb6f2e0bd
|
@ -4,31 +4,24 @@
|
|||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {},
|
||||
"settings": {
|
||||
},
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "cpp_out",
|
||||
"type": "shell",
|
||||
"windows": {
|
||||
"command": "wsl --shell-type login cargo ${input:cargo cmd} --target=x86_64-unknown-linux-gnu --${input:build cfg}"
|
||||
},
|
||||
"linux": {
|
||||
"command": "$HOME/.cargo/bin/cargo ${input:cargo cmd} --${input:build cfg}"
|
||||
},
|
||||
"group": "build",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/cpp_out"
|
||||
}
|
||||
},
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,39 +1,20 @@
|
|||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
rem build_all [clean] [recommended|windows|linux]
|
||||
rem build_all {build|check|clean}
|
||||
|
||||
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
|
||||
if %1 == clean (
|
||||
for %%a in (%clean_tools%) do (
|
||||
call .\run_cargo %%a %1 release windows
|
||||
cd %cur_dir%
|
||||
)
|
||||
)
|
||||
|
||||
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
|
||||
for %%a in (%win_tools%) do (
|
||||
call .\run_cargo %%a %1 release windows
|
||||
cd %cur_dir%
|
||||
)
|
||||
|
||||
for %%a in (%linux_projects%) do (
|
||||
call .\run_cargo %%a %build_type% release linux
|
||||
for %%a in (%linux_tools%) do (
|
||||
call .\run_cargo %%a %1 release linux
|
||||
cd %cur_dir%
|
||||
)
|
|
@ -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
|
||||
source run_cargo.sh $prj $1 release
|
||||
done
|
|
@ -1,30 +1,25 @@
|
|||
@echo off
|
||||
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 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 --shell-type login
|
||||
wsl --shell-type login ./run_cargo.sh %1 %2 %3
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
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 (
|
||||
IF %2 == 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
|
||||
IF %ERRORLEVEL% == 0 (
|
||||
xcopy target\%target%\%3\%1.exe %org_dir%\..\..\bin /y
|
||||
)
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
|
|
@ -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"
|
||||
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"
|
||||
cargo run --$3 --target=$target
|
||||
|
||||
exit $?
|
||||
elif [ $2 = check ]; then
|
||||
echo "cargo check $1 --$3"
|
||||
cargo check --$3 --target=$target $run_args
|
||||
|
||||
exit $?
|
||||
elif [ $2 = clean ]; then
|
||||
echo "cargo clean $1"
|
||||
cargo clean
|
||||
|
||||
exit $?
|
||||
else
|
||||
echo "Unkown cargo command $2 for project $1"
|
||||
fi
|
Loading…
Reference in New Issue