fix(alg): build.rs complications
This commit is contained in:
parent
00ced8e548
commit
3331e89179
2 changed files with 18 additions and 5 deletions
13
crates/algorithms/.cargo/config.toml
Executable file
13
crates/algorithms/.cargo/config.toml
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
[build]
|
||||||
|
target = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
[alias]
|
||||||
|
abuild = "build --target thumbv6m-none-eabi"
|
||||||
|
atest = "test --target x86_64-unknown-linux-gnu"
|
||||||
|
abench = "bench --target x86_64-unknown-linux-gnu"
|
||||||
|
acheck = "check --target x86_64-unknown-linux-gnu"
|
||||||
|
aclippy = "clippy --target thumbv6m-none-eabi"
|
||||||
|
cflash = "flash --chip STM32L053R8"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
DEFMT_LOG = "trace" # sets the log level to trace
|
|
@ -17,7 +17,7 @@ fn main() {
|
||||||
.status()
|
.status()
|
||||||
.expect("could not cleanup old algorithms-c files");
|
.expect("could not cleanup old algorithms-c files");
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(not(target_os = "windows"))]
|
||||||
{
|
{
|
||||||
std::process::Command::new("ceedling")
|
std::process::Command::new("ceedling")
|
||||||
.arg("clobber")
|
.arg("clobber")
|
||||||
|
@ -28,7 +28,7 @@ fn main() {
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let mut cmd = std::process::Command::new("ceedling.bat");
|
let mut cmd = std::process::Command::new("ceedling.bat");
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(not(target_os = "windows"))]
|
||||||
let mut cmd = std::process::Command::new("ceedling");
|
let mut cmd = std::process::Command::new("ceedling");
|
||||||
cmd.arg("release");
|
cmd.arg("release");
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ fn main() {
|
||||||
let pw = env("CARGO_CFG_TARGET_POINTER_WIDTH");
|
let pw = env("CARGO_CFG_TARGET_POINTER_WIDTH");
|
||||||
let os = env("CARGO_CFG_TARGET_OS");
|
let os = env("CARGO_CFG_TARGET_OS");
|
||||||
|
|
||||||
if arch == "arm" && pw == "32" && os == "none" {
|
if arch == "arm" && pw == "32" && os == "none" && !cfg!(test) {
|
||||||
cmd.env("CC", "arm-none-eabi-gcc")
|
cmd.env("CC", "arm-none-eabi-gcc")
|
||||||
.env("AR", "arm-none-eabi-ar")
|
.env("AR", "arm-none-eabi-ar")
|
||||||
.env("CC_FLAGS", "-march=armv6-m");
|
.env("CC_FLAGS", "-march=armv6-m");
|
||||||
} else if os == "linux" || os == "windows" {
|
} else if os == "linux" || os == "windows" || cfg!(test) {
|
||||||
cmd.env("CC", "gcc").env("AR", "ar");
|
cmd.env("CC", "gcc").env("AR", "ar");
|
||||||
} else {
|
} else {
|
||||||
panic!("Unsupported build target")
|
panic!("Unsupported build target")
|
||||||
|
@ -52,7 +52,7 @@ fn main() {
|
||||||
.status()
|
.status()
|
||||||
.expect("could not make c stuff");
|
.expect("could not make c stuff");
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
panic!("make returned an error")
|
panic!("ceedling returned an error")
|
||||||
}
|
}
|
||||||
let cwd = std::env::current_dir().unwrap().display().to_string();
|
let cwd = std::env::current_dir().unwrap().display().to_string();
|
||||||
let libpath_s = format!("{cwd}/algorithms-c/build/artifacts/release/libalgorithms.a");
|
let libpath_s = format!("{cwd}/algorithms-c/build/artifacts/release/libalgorithms.a");
|
||||||
|
|
Loading…
Add table
Reference in a new issue