Build tool with musl for now
This commit is contained in:
parent
aa717886b4
commit
92954ce53e
|
@ -0,0 +1,2 @@
|
|||
[target.x86_64-unknown-linux-musl]
|
||||
linker = "rust-lld"
|
|
@ -19,7 +19,7 @@
|
|||
{
|
||||
"label": "cargo",
|
||||
"type": "shell",
|
||||
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg}",
|
||||
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
}
|
||||
|
@ -45,6 +45,12 @@
|
|||
"options": ["build", "run", "check", "clean"],
|
||||
"default": "build",
|
||||
"description": "cargo command to run"
|
||||
},
|
||||
{
|
||||
"id": "cargo target",
|
||||
"type": "pickString",
|
||||
"options": ["windows", "linux"],
|
||||
"description": "The target for the tool to build"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
rem build_all [clean]
|
||||
|
||||
set bin_projects=psxcdgen psxcdread
|
||||
set bin_linux_projects=cpp_out
|
||||
set clean_projects=cdtypes
|
||||
|
||||
set projects=%bin_projects%
|
||||
set linux_projects=%bin_linux_projects%
|
||||
set build_type=build
|
||||
set cur_dir=%cd%
|
||||
|
||||
|
@ -18,6 +20,11 @@ IF NOT "%~1" == "" (
|
|||
)
|
||||
|
||||
for %%a in (%projects%) do (
|
||||
call .\run_cargo %%a %build_type% release
|
||||
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%
|
||||
)
|
|
@ -1,14 +1,22 @@
|
|||
@echo off
|
||||
rem run_cargo.bat project build|check|clean debug|release
|
||||
setlocal EnableDelayedExpansion
|
||||
rem run_cargo.bat project build|check|clean debug|release [linux|windows]
|
||||
|
||||
set org_dir=%cd%
|
||||
set bin_ext=.exe
|
||||
|
||||
IF "%4" == "linux" (
|
||||
set cfg=x86_64-unknown-linux-musl
|
||||
set target=--target=!cfg!
|
||||
set bin_ext=
|
||||
)
|
||||
|
||||
cd %1
|
||||
IF %2 == build (
|
||||
echo cargo build %1 --%3
|
||||
cargo build --%3
|
||||
call:build_rust %1 %2 %3 %4
|
||||
IF %ERRORLEVEL% == 0 (
|
||||
xcopy target\%3\%1.exe %org_dir%\..\..\bin /y
|
||||
xcopy target\%cfg%\%3\%1%bin_ext% %org_dir%\..\..\bin /y
|
||||
)
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
@ -16,14 +24,21 @@ IF %2 == build (
|
|||
|
||||
IF %2 == run (
|
||||
echo cargo run %1 --%3
|
||||
cargo run --%3
|
||||
IF "%4" == "linux" (
|
||||
rem call:build_rust %1 %2 %3 %4
|
||||
IF %ERRORLEVEL% == 0 (
|
||||
wsl $PWD/target/%cfg%/%3/%1
|
||||
)
|
||||
) ELSE (
|
||||
cargo run --%3 %target%
|
||||
)
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
IF %2 == check (
|
||||
echo cargo check %1 --%3
|
||||
cargo check --%3
|
||||
cargo check --%3 %target%
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
@ -31,9 +46,14 @@ IF %2 == check (
|
|||
IF %2 == clean (
|
||||
echo cargo clean %1
|
||||
cargo clean
|
||||
@del %org_dir%\..\..\bin\%1.exe
|
||||
@del %org_dir%\..\..\bin\%1%bin_ext%
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
echo "Unkown cargo command "%2" for project "%1"
|
||||
echo "Unkown cargo command "%2" for project "%1"
|
||||
GOTO:eof
|
||||
|
||||
:build_rust
|
||||
cargo build --%3 %target%
|
||||
GOTO:eof
|
Loading…
Reference in New Issue