refactor: build.rs is more concise

This commit is contained in:
cscherr 2025-07-31 16:21:25 +02:00
parent 368d790c63
commit 416dd1660d
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7

View file

@ -30,17 +30,16 @@ fn main() {
let mut cmd = std::process::Command::new("ceedling.bat");
#[cfg(not(target_os = "windows"))]
let mut cmd = std::process::Command::new("ceedling");
cmd.arg("release");
let arch = env("CARGO_CFG_TARGET_ARCH");
let pw = env("CARGO_CFG_TARGET_POINTER_WIDTH");
let os = env("CARGO_CFG_TARGET_OS");
if arch == "arm" && pw == "32" && os == "none" && !cfg!(test) {
if arch == "arm" && pw == "32" && os == "none" {
cmd.env("CC", "arm-none-eabi-gcc")
.env("AR", "arm-none-eabi-ar")
.env("CC_FLAGS", "-march=armv6-m");
} else if os == "linux" || os == "windows" || cfg!(test) {
} else if os == "linux" || os == "windows" {
cmd.env("CC", "gcc").env("AR", "ar");
} else {
panic!("Unsupported build target")
@ -48,6 +47,7 @@ fn main() {
println!("Cwd: {}", std::env::current_dir().unwrap().display());
let status = cmd
.arg("release")
.current_dir("./algorithms-c")
.status()
.expect("could not make c stuff");