-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
32 lines (29 loc) · 1.21 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
/***************************************************************************************************
* Copyright (c) 2020 by the authors
*
* Author: André Borrmann
* License: Apache License 2.0
**************************************************************************************************/
//! Build Script to copy the required linker script from the dependent `ruspiro-boot` crate to the
//! current build folder
//!
use std::{env, fs, path::Path};
fn main() {
// copy the linker script from the boot crate to the current directory
// so it will be invoked by the linker
match env::var_os("DEP_RUSPIRO_TEST_FRAMEWORK_LINKERSCRIPT") {
Some(source) => {
println!("found test framework dependency");
let ld_source = source.to_str().unwrap().replace("\\", "/");
let src_file = Path::new(&ld_source);
let trg_file = format!(
"{}/{}",
env::current_dir().unwrap().display(),
src_file.file_name().unwrap().to_str().unwrap()
);
println!("Copy linker script from {:?}, to {:?}", src_file, trg_file);
fs::copy(src_file, trg_file).unwrap();
},
_ => ()
}
}