-
-
Notifications
You must be signed in to change notification settings - Fork 180
/
build.rs
24 lines (20 loc) · 913 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
use rustc_version::{version, version_meta, Channel};
use std::env;
fn main() {
println!("cargo::rustc-check-cfg=cfg(ptrace_supported)");
println!("cargo::rustc-check-cfg=cfg(tarpaulin_include)");
println!("cargo::rustc-check-cfg=cfg(tarpaulin)");
println!("cargo::rustc-check-cfg=cfg(nightly)");
assert!(version().expect("Couldn't get compiler version").major >= 1);
let channel = version_meta()
.expect("Couldn't get compiler metadata")
.channel;
if channel == Channel::Nightly {
println!("cargo:rustc-cfg=nightly");
}
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("CARGO_CFG_TARGET_ARCH not set");
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS not set");
if target_os == "linux" && (target_arch == "x86_64" || target_arch == "x86") {
println!("cargo:rustc-cfg=ptrace_supported");
}
}