-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.rs
35 lines (31 loc) · 968 Bytes
/
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
use std::path::PathBuf;
use std::{env, fs};
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out_dir.display());
fs::copy("ld/loader.x", out_dir.join("loader.x")).unwrap();
println!("cargo:rerun-if-changed=ld/loader.x");
#[cfg(feature = "esp32")]
let chip = "esp32";
#[cfg(feature = "esp32s2")]
let chip = "esp32s2";
#[cfg(feature = "esp32s3")]
let chip = "esp32s3";
#[cfg(feature = "esp32c2")]
let chip = "esp32c2";
#[cfg(feature = "esp32c3")]
let chip = "esp32c3";
#[cfg(feature = "esp32c6")]
let chip = "esp32c6";
#[cfg(feature = "esp32h2")]
let chip = "esp32h2";
{
fs::copy(
format!("ld/{}.x", chip),
out_dir.join(format!("{}.x", chip)),
)
.unwrap();
println!("cargo:rerun-if-changed=ld/{}.x", chip);
println!("cargo:rustc-link-arg=-Tld/{}.x", chip);
}
}