blob: b44d98f3a07f3cb9250e0a3ced9d354cd522baa3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use std::env;
use std::path::PathBuf;
use stm32_metapac_gen::*;
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let data_dir = PathBuf::from("../stm32-data/data");
println!("cwd: {:?}", env::current_dir());
let chip_name = env::vars_os()
.map(|(a, _)| a.to_string_lossy().to_string())
.find(|x| x.starts_with("CARGO_FEATURE_STM32"))
.expect("No stm32xx Cargo feature enabled")
.strip_prefix("CARGO_FEATURE_")
.unwrap()
.to_ascii_uppercase();
gen(Options {
out_dir: out_dir.clone(),
data_dir: data_dir.clone(),
chips: vec![chip_name.clone()],
});
println!(
"cargo:rustc-link-search={}/src/chips/{}",
out_dir.display(),
chip_name.to_ascii_lowercase()
);
println!("cargo:rerun-if-changed=build.rs");
}
|