2023-10-06 21:15:38 -07:00
|
|
|
extern crate rustc_version;
|
|
|
|
use rustc_version::{version_meta, Channel};
|
|
|
|
|
2021-10-09 15:57:17 -07:00
|
|
|
fn main() {
|
|
|
|
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
|
|
|
{
|
|
|
|
if is_x86_feature_detected!("avx") {
|
|
|
|
println!("cargo:rustc-cfg=build_target_feature_avx");
|
|
|
|
}
|
|
|
|
if is_x86_feature_detected!("avx2") {
|
|
|
|
println!("cargo:rustc-cfg=build_target_feature_avx2");
|
|
|
|
}
|
|
|
|
}
|
2023-10-06 21:15:38 -07:00
|
|
|
|
|
|
|
// Copied and adapted from
|
|
|
|
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example
|
|
|
|
// Licensed under Apache-2.0 + MIT
|
|
|
|
match version_meta().unwrap().channel {
|
|
|
|
Channel::Stable => {
|
|
|
|
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
|
|
|
|
}
|
|
|
|
Channel::Beta => {
|
|
|
|
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
|
|
|
|
}
|
|
|
|
Channel::Nightly => {
|
|
|
|
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION");
|
|
|
|
}
|
|
|
|
Channel::Dev => {
|
|
|
|
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION");
|
|
|
|
}
|
|
|
|
}
|
2021-10-09 15:57:17 -07:00
|
|
|
}
|