-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
57 lines (49 loc) · 1.46 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
fn main() {
let mut os: &str = "";
let mut arch: Option<&str> = None;
if cfg!(target_os = "macos") {
os = "mac";
};
if cfg!(target_os = "linux") && cfg!(target_arch = "x86_64") {
os = "linux";
arch = Some("x64");
};
if cfg!(target_os = "linux") && cfg!(target_arch = "x86") {
os = "linux";
arch = Some("x86");
};
if cfg!(target_os = "linux") && cfg!(target_arch = "arm") {
os = "linux";
arch = Some("armv7");
};
if cfg!(target_os = "linux") && cfg!(target_arch = "aarch64") {
os = "linux";
arch = Some("armv8");
};
if cfg!(target_os = "windows") {
os = "windows";
arch = Some("x64");
};
let paths = [
{
if let Some(a) = arch {
std::fs::canonicalize(format!("./vendored/camera/{}/{}", os, a))
} else {
std::fs::canonicalize(format!("./vendored/camera/{}", os))
}
},
{
if let Some(a) = arch {
std::fs::canonicalize(format!("./vendored/efw/{}/{}", os, a))
} else {
std::fs::canonicalize(format!("./vendored/efw/{}", os))
}
},
];
for path in paths {
if let Some(s_path) = path.unwrap().as_os_str().to_str() {
println!("cargo:rustc-link-search={}", &s_path);
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", &s_path);
}
}
}