Build linux under windows with MUSL

This commit is contained in:
Jaby 2022-09-22 19:26:13 +02:00 committed by Jaby
parent 82301cc8a1
commit dc48cb3733
5 changed files with 25 additions and 18 deletions

View File

@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-musl]
linker = "rust-lld"

View File

@ -1,12 +1,10 @@
export PATH := $(HOME)/.cargo/bin/:$(PATH) export PATH := $(HOME)/.cargo/bin/:$(PATH)
test_cpp_out: always test_cpp_out: always
@cargo build --manifest-path ../cpp_out/Cargo.toml --release @echo "Planschbecken" | ./../cpp_out/target/x86_64-unknown-linux-musl/release/cpp_out --name Dino -o "Test_Planschbecken.cpp"
@echo "Planschbecken" | ./../cpp_out/target/release/cpp_out --name Dino -o "Test_Planschbecken.cpp" @echo "Planschbecken" | ./../cpp_out/target/x86_64-unknown-linux-musl/release/cpp_out --name Dino -o "Test_Planschbecken.hpp"
@echo "Planschbecken" | ./../cpp_out/target/release/cpp_out --name Dino -o "Test_Planschbecken.hpp"
test_jaby_engine_fconv: always test_jaby_engine_fconv: always
@cargo build --manifest-path ../jaby_engine_fconv/Cargo.toml --release @./../jaby_engine_fconv/target/x86_64-unknown-linux-musl/release/jaby_engine_fconv -o Test_Planschi.bin Test_PNG2.PNG simple-tim full16
@./../jaby_engine_fconv/target/release/jaby_engine_fconv -o Test_Planschi.bin Test_PNG2.PNG simple-tim full16
always: ; always: ;

View File

@ -33,7 +33,9 @@
}, },
"options": { "options": {
"cwd": "${workspaceFolder}/Tests" "cwd": "${workspaceFolder}/Tests"
} },
"dependsOn": ["cargo"],
"dependsOrder": "sequence"
} }
], ],
"inputs": [ "inputs": [
@ -53,7 +55,7 @@
{ {
"id": "cargo cmd", "id": "cargo cmd",
"type":"pickString", "type":"pickString",
"options": ["build", "run", "check", "clean"], "options": ["build", "check", "clean", "run", "test"],
"default": "build", "default": "build",
"description": "cargo command to run" "description": "cargo command to run"
}, },

View File

@ -21,7 +21,7 @@ pub struct Arguments {
fn convert_full16(input: Input, output: Output) -> Result<(), Error> { fn convert_full16(input: Input, output: Output) -> Result<(), Error> {
match ImageReader::new(Cursor::new(tool_helper::input_to_vec(input)?)).with_guessed_format()?.decode() { match ImageReader::new(Cursor::new(tool_helper::input_to_vec(input)?)).with_guessed_format()?.decode() {
Ok(image) => { Ok(image) => {
println!("Blubb!!");
Ok(()) Ok(())
}, },
Err(error) => Err(Error::from_error(error)) Err(error) => Err(Error::from_error(error))

View File

@ -1,21 +1,26 @@
@echo off @echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
rem run_cargo.bat project build|check|clean debug|release [linux|windows] rem run_cargo.bat project {build|check|clean|test} {debug|release} [linux|windows]
set org_dir=%cd% set org_dir=%cd%
set bin_ext=.exe set bin_ext=.exe
set target=x86_64-pc-windows-msvc
IF "%4" == "linux" ( IF %4 == linux (
set prefix=wsl $HOME/.cargo/bin/
set bin_ext= set bin_ext=
set target=x86_64-unknown-linux-musl
) )
IF %2 == build set run_build=1
IF %2 == test set run_build=1
cd %1 cd %1
IF %2 == build ( IF defined run_build (
echo cargo build %1 --%3 echo cargo build %1 --%3
%prefix%cargo build --%3 %target% cargo build --%3 --target=%target%
IF %ERRORLEVEL% == 0 (
xcopy target\%3\%1%bin_ext% %org_dir%\..\..\bin /y IF %2 == build IF %ERRORLEVEL% == 0 (
xcopy target\%target%\%3\%1%bin_ext% %org_dir%\..\..\bin /y
) )
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
@ -23,21 +28,21 @@ IF %2 == build (
IF %2 == run ( IF %2 == run (
echo cargo run %1 --%3 echo cargo run %1 --%3
%prefix%cargo run --%3 %target% cargo run --%3 --target=%target%
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF %2 == check ( IF %2 == check (
echo cargo check %1 --%3 echo cargo check %1 --%3
%prefix%cargo check --%3 %target% cargo check --%3 --target=%target%
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF %2 == clean ( IF %2 == clean (
echo cargo clean %1 echo cargo clean %1
%prefix%cargo clean cargo clean
rem We do not delete the bin folder anymore - is kinda to much rem We do not delete the bin folder anymore - is kinda to much
rem @del %org_dir%\..\..\bin\%1%bin_ext% rem @del %org_dir%\..\..\bin\%1%bin_ext%