-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.rs
39 lines (39 loc) · 1.69 KB
/
build.rs
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
32
33
34
35
36
37
38
39
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out.display());
let device_file = if env::var_os("CARGO_FEATURE_IMXRT1011").is_some() {
"src/imxrt1011.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1015").is_some() {
"src/imxrt1015.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1021").is_some() {
"src/imxrt1021.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1051").is_some() {
"src/imxrt1051.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1052").is_some() {
"src/imxrt1052.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1061").is_some() {
"src/imxrt1061.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1062").is_some() {
"src/imxrt1062.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1064").is_some() {
"src/imxrt1064.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1176_CM4").is_some() {
"src/imxrt1176_cm4.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1176_CM7").is_some() {
"src/imxrt1176_cm7.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1189_CM33").is_some() {
"src/imxrt1189_cm33.x"
} else if env::var_os("CARGO_FEATURE_IMXRT1189_CM7").is_some() {
"src/imxrt1189_cm7.x"
} else {
panic!("No device features selected");
};
fs::copy(device_file, out.join("device.x")).unwrap();
println!("cargo:rerun-if-changed={}", device_file);
}
println!("cargo:rerun-if-changed=build.rs");
}