2020-06-03 07:39:24 +00:00
|
|
|
// NOTE: Adapted from cortex-m/build.rs
|
|
|
|
|
use std::env;
|
|
|
|
|
|
2021-01-12 15:30:52 +00:00
|
|
|
extern crate vergen;
|
2021-05-17 08:00:43 +00:00
|
|
|
use vergen::{generate_cargo_keys, ConstantsFlags};
|
2021-01-12 15:30:52 +00:00
|
|
|
|
2020-06-03 07:39:24 +00:00
|
|
|
fn main() {
|
|
|
|
|
let target = env::var("TARGET").unwrap();
|
|
|
|
|
|
|
|
|
|
let target_os = target.split('-').nth(2).unwrap_or("none");
|
|
|
|
|
|
|
|
|
|
// If we're not running on a desktop-class operating system, emit the "baremetal"
|
|
|
|
|
// config setting. This will enable software to do tasks such as
|
|
|
|
|
// managing memory.
|
|
|
|
|
if target_os == "none" {
|
|
|
|
|
println!("cargo:rustc-cfg=baremetal");
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-17 08:00:43 +00:00
|
|
|
generate_cargo_keys(
|
|
|
|
|
ConstantsFlags::SHA, /*| ConstantsFlags::BUILD_TIMESTAMP*/
|
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
2021-01-12 16:24:12 +00:00
|
|
|
// BUILD_TIMESTAMP doesn't work -- it doesn't update because of the below line
|
|
|
|
|
// removing the below line causes a lengthy full-rebuild just to capture a timestamp.
|
|
|
|
|
// so, we're removing the timestamp.
|
2020-06-03 07:39:24 +00:00
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
|
}
|