2020-02-08 23:00:49 -06:00
|
|
|
use lazy_static::lazy_static;
|
2020-02-01 04:04:04 -06:00
|
|
|
use std::env;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2020-02-08 23:00:49 -06:00
|
|
|
lazy_static! {
|
|
|
|
pub static ref CARGO_TARGET_DIR: PathBuf = {
|
|
|
|
match env::var_os("CARGO_TARGET_DIR") {
|
|
|
|
Some(v) => v.into(),
|
2020-02-10 09:42:50 -06:00
|
|
|
None => env::current_dir().unwrap().join("target"),
|
2020-02-01 04:04:04 -06:00
|
|
|
}
|
2020-02-08 23:00:49 -06:00
|
|
|
};
|
|
|
|
pub static ref TARGET_LIB: PathBuf = {
|
2020-02-01 04:04:04 -06:00
|
|
|
if let Some(path) = option_env!("TARGET_LIBS") {
|
|
|
|
path.into()
|
|
|
|
} else {
|
2020-02-08 23:00:49 -06:00
|
|
|
let mut dir = CARGO_TARGET_DIR.clone();
|
2020-02-01 04:04:04 -06:00
|
|
|
if let Some(target) = env::var_os("CARGO_BUILD_TARGET") {
|
|
|
|
dir.push(target);
|
|
|
|
}
|
|
|
|
dir.push(env!("PROFILE"));
|
|
|
|
dir
|
|
|
|
}
|
2020-02-08 23:00:49 -06:00
|
|
|
};
|
|
|
|
}
|
2020-02-01 04:04:04 -06:00
|
|
|
|
2020-02-08 23:00:49 -06:00
|
|
|
#[must_use]
|
|
|
|
pub fn is_rustc_test_suite() -> bool {
|
|
|
|
option_env!("RUSTC_TEST_SUITE").is_some()
|
2020-02-01 04:04:04 -06:00
|
|
|
}
|