-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
35 lines (26 loc) · 1019 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
28
29
30
31
32
33
34
35
use std::env;
use std::path::PathBuf;
fn main() {
let link_type;
{
link_type = "dylib";
// When using an already built version, build all possible paths to look for ...
let dir = env::var("MTKAHYPAR_DIR").map(PathBuf::from).ok();
let include_dir = dir.clone().map(|dir| dir.join("include"));
let lib_dir = dir.clone().map(|dir| dir.join("lib"));
let lib64_dir = dir.map(|dir| dir.join("lib64"));
// ... and include them for the library search.
if let Some(dir) = include_dir {
println!("cargo:include-dir={}", dir.display());
}
if let Some(dir) = lib64_dir {
println!("cargo:rustc-link-search={}", dir.display());
}
if let Some(dir) = lib_dir {
println!("cargo:rustc-link-search={}", dir.display());
}
println!("rerun-if-env-changed=MTKAHYPAR_DIR");
}
// Finally, link the library.
println!("cargo:rustc-link-lib={}=mtkahypar", link_type);
}