diff options
Diffstat (limited to 'build.rs')
| -rw-r--r-- | build.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..829bb31 --- /dev/null +++ b/build.rs @@ -0,0 +1,26 @@ +use std::process::Command; +use std::path::Path; + +fn main() { + println!("cargo:rerun-if-changed=wrv32em-common.dts"); + + let out_dir = std::env::var("OUT_DIR").unwrap(); + let output = Path::new(&out_dir).join("wrv32em-common.dtb"); + + let status = Command::new("dtc") + .args([ + "-I", "dts", + "-O", "dtb", + "-o", + output.to_str().unwrap(), + "wrv32em-common.dts", + ]) + .status() + .expect("failed to run dtc"); + + if !status.success() { + panic!("dtc failed"); + } + + println!("cargo:rustc-env=DTB_PATH={}", output.display()); +}
\ No newline at end of file |
