-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
33 lines (28 loc) · 1.41 KB
/
build.rs
File metadata and controls
33 lines (28 loc) · 1.41 KB
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
use std::{env, fs::File, io::Write, path::PathBuf};
fn main() {
// put in .cargo/config.toml
//println!("cargo:rustc-link-arg-bins=--nmagic");
//println!("cargo:rustc-link-arg-bins=-Tlink.x");
//println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
// Put `memory.x` in our output directory and ensure it's
// on the linker search path.
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory_stm32f469ni.x")) // TODO: Change this based on features or similar
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
// By default, Cargo will re-run a build script whenever
// any file in the project changes. By specifying `memory.x`
// here, we ensure the build script is only re-run when
// `memory.x` is changed.
println!("cargo:rerun-if-changed=memory_stm32f469ni.x");
println!("cargo:rerun-if-changed=pas_co2_stm32f469.slint");
let config = slint_build::CompilerConfiguration::new()
.embed_resources(slint_build::EmbedResourcesKind::EmbedForSoftwareRenderer)
.with_style("native".into());
//slint_build::compile_with_config("ui/display_mock.slint", config).unwrap();
slint_build::compile_with_config("pas_co2_stm32f469.slint", config).unwrap();
slint_build::print_rustc_flags().unwrap();
println!("cargo:EMBED_TEXTURES=1");
}