-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.rs
42 lines (39 loc) · 1.66 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
use std::env;
use std::path::PathBuf;
fn main() {
let target = env::var("TARGET").unwrap();
let mut bin_dir = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
bin_dir.push("build");
if target.contains("x86_64-pc-windows-msvc") {
bin_dir.push("windows");
} else if target.contains("x86_64-unknown-linux-gnu") {
bin_dir.push("linux");
} else if target.contains("x86_64-apple-darwin") {
bin_dir.push("osx");
} else if target.contains("android") {
if target.contains("aarch64") {
bin_dir.push("android-arm64-v8a");
} else if target.contains("armv7") {
bin_dir.push("android-armeabi-v7a");
} else {
panic!("Missing Android target support {}", target);
}
} else {
panic!("Missing target support {}", target);
};
// Link order matters, make sure dependents are linked before their dependencies.
println!("cargo:rustc-link-search={}", bin_dir.to_str().unwrap());
println!("cargo:rustc-link-lib=glslang.glsltospirv");
println!("cargo:rustc-link-lib=HLSL.glsltospirv");
println!("cargo:rustc-link-lib=OGLCompiler.glsltospirv");
println!("cargo:rustc-link-lib=OSDependent.glsltospirv");
println!("cargo:rustc-link-lib=SPIRV.glsltospirv");
println!("cargo:rustc-link-lib=SPVRemapper.glsltospirv");
if target.contains("x86_64-unknown-linux-gnu") || target.contains("x86_64-apple-darwin") {
println!("cargo:rustc-link-lib=SPIRV-Tools-opt.glsltospirv");
println!("cargo:rustc-link-lib=SPIRV-Tools.glsltospirv");
}
if target.contains("android") {
println!("cargo:rustc-link-lib=c++_shared");
}
}