forked from aldanor/hdf5-rust
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.rs
21 lines (20 loc) · 864 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::env;
fn main() {
let print_feature = |key: &str| println!("cargo:rustc-cfg=feature=\"{}\"", key);
let print_cfg = |key: &str| println!("cargo:rustc-cfg={}", key);
for (key, _) in env::vars() {
match key.as_str() {
// public features
"DEP_HDF5_HAVE_DIRECT" => print_feature("have-direct"),
"DEP_HDF5_HAVE_PARALLEL" => print_feature("have-parallel"),
"DEP_HDF5_HAVE_THREADSAFE" => print_feature("have-threadsafe"),
// internal config flags
"DEP_HDF5_MSVC_DLL_INDIRECTION" => print_cfg("msvc_dll_indirection"),
// public version features
key if key.starts_with("DEP_HDF5_VERSION_") => {
print_feature(&key.trim_start_matches("DEP_HDF5_VERSION_").replace('_', "."));
}
_ => continue,
}
}
}