You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
|
|
extern crate rustc_version;
|
|
|
|
use rustc_version::{version, version_meta, Channel};
|
|
|
|
|
|
|
|
use config_struct::{Error, StructOptions};
|
|
|
|
|
|
|
|
fn main() -> Result<(), Error> {
|
|
|
|
// Assert we haven't travelled back in time
|
|
|
|
assert!(version().unwrap().major >= 1);
|
|
|
|
|
|
|
|
// Set cfg flags depending on release channel
|
|
|
|
match version_meta().unwrap().channel {
|
|
|
|
Channel::Stable => {
|
|
|
|
println!("cargo:rustc-cfg=stable");
|
|
|
|
}
|
|
|
|
Channel::Beta => {
|
|
|
|
println!("cargo:rustc-cfg=beta");
|
|
|
|
}
|
|
|
|
Channel::Nightly => {
|
|
|
|
println!("cargo:rustc-cfg=nightly");
|
|
|
|
}
|
|
|
|
Channel::Dev => {
|
|
|
|
println!("cargo:rustc-cfg=dev");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config_struct::create_struct(
|
|
|
|
"build/config.toml",
|
|
|
|
"src/config/build_cfg.rs",
|
|
|
|
&StructOptions::default())?;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|