use std::{env, error::Error, fs, path::PathBuf};
fn main() -> Result<(), Box<dyn Error>> {
let out = &PathBuf::from(env::var("OUT_DIR")?);
let linker_script = fs::read_to_string("defmt.x.in")?;
fs::write(out.join("defmt.x"), linker_script)?;
println!("cargo:rustc-link-search={}", out.display());
let target = env::var("TARGET")?;
match &target[..] {
"avr-gnu-base"
| "msp430-none-elf"
| "riscv32i-unknown-none-elf"
| "riscv32imc-unknown-none-elf"
| "thumbv4t-none-eabi"
| "thumbv6m-none-eabi" => {
println!("cargo:rustc-cfg=no_cas");
}
_ => {}
}
Ok(())
}