]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | use std::env; |
2 | use std::lazy::SyncLazy; | |
3 | use std::path::PathBuf; | |
4 | ||
5 | pub static CARGO_TARGET_DIR: SyncLazy<PathBuf> = SyncLazy::new(|| match env::var_os("CARGO_TARGET_DIR") { | |
6 | Some(v) => v.into(), | |
7 | None => env::current_dir().unwrap().join("target"), | |
8 | }); | |
9 | ||
10 | pub static TARGET_LIB: SyncLazy<PathBuf> = SyncLazy::new(|| { | |
11 | if let Some(path) = option_env!("TARGET_LIBS") { | |
12 | path.into() | |
13 | } else { | |
14 | let mut dir = CARGO_TARGET_DIR.clone(); | |
15 | if let Some(target) = env::var_os("CARGO_BUILD_TARGET") { | |
16 | dir.push(target); | |
17 | } | |
18 | dir.push(env!("PROFILE")); | |
19 | dir | |
20 | } | |
21 | }); | |
22 | ||
23 | #[must_use] | |
24 | pub fn is_rustc_test_suite() -> bool { | |
25 | option_env!("RUSTC_TEST_SUITE").is_some() | |
26 | } |