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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use std::env;
use std::path::Path;
use super::Result;
pub fn is_cross_compiling() -> Result<bool> {
Ok(env::var("TARGET")? != env::var("HOST")?)
}
pub fn include_path<P: AsRef<Path>>(lib_dir_path: P) -> Result<()> {
println!("cargo:rustc-link-lib={}", lib_dir_path.as_ref().display());
Ok(())
}
pub fn link_static<P: AsRef<Path>>(lib_name: &str, lib_dir_path: P) -> Result<()> {
println!("cargo:rustc-link-search={}", lib_dir_path.as_ref().display());
println!("cargo:rustc-link-lib=static={}", lib_name);
Ok(())
}
pub fn link_dylib<P: AsRef<Path>>(lib_name: &str, lib_dir_path: P) -> Result<()> {
println!("cargo:rustc-link-search={}", lib_dir_path.as_ref().display());
println!("cargo:rustc-link-lib=dylib={}", lib_name);
Ok(())
}
pub fn link_lib<P: AsRef<Path>>(lib_name: &str, lib_dir_path: P) -> Result<()> {
println!("cargo:rustc-link-search={}", lib_dir_path.as_ref().display());
println!("cargo:rustc-link-lib={}", lib_name);
Ok(())
}
pub fn link_system_dylib(lib_name: &str) -> Result<()> {
println!("cargo:rustc-link-lib=dylib={}", lib_name);
Ok(())
}
pub fn link_system_lib(lib_name: &str) -> Result<()> {
println!("cargo:rustc-link-lib={}", lib_name);
Ok(())
}
pub fn rerun_if_changed<P: AsRef<Path>>(filepath: P) {
println!("cargo:rerun-if-changed={}", filepath.as_ref().display());
}