-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.rs
32 lines (27 loc) · 881 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
use git2::{DescribeFormatOptions, DescribeOptions, Repository};
#[rustversion::nightly]
fn is_nightly() -> bool {
true
}
#[rustversion::not(nightly)]
fn is_nightly() -> bool {
false
}
fn main() {
if cfg!(target_arch = "aarch64") && is_nightly() {
println!("cargo:rustc-cfg=feature=\"neon\"");
}
if let Ok(repo) = Repository::open_from_env() {
let describe = repo
.describe(DescribeOptions::new().show_commit_oid_as_fallback(true))
.expect("Could not get description for git repo.");
let desc = describe
.format(Some(DescribeFormatOptions::new().dirty_suffix("-dirty")))
.expect("Could not format description for git repo.");
println!(
"cargo:rustc-env=MAYBE_FINALFRONTIER_GIT_DESC={} {}",
env!("CARGO_PKG_VERSION"),
desc
);
}
}