forked from bodil/im-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
27 lines (24 loc) · 870 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
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
extern crate rustc_version;
use rustc_version::{version_meta, Channel};
use std::env;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
match version_meta().unwrap().channel {
Channel::Nightly => {
println!("cargo:rustc-cfg=has_specialisation");
}
_ => (),
}
let pkgname = env::var("CARGO_PKG_NAME").expect("Cargo didn't set the CARGO_PKG_NAME env var!");
let test_rc = env::var("IM_TEST_RC").is_ok();
match pkgname.as_str() {
"im" => if !test_rc {
println!("cargo:rustc-cfg=threadsafe")
},
"im-rc" => {}
_ => panic!("unexpected package name!"),
}
}