blob: ae725614e3386702714ca3b4be57198565ee20fc (
plain)
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
|
extern crate cmake;
use cmake::Config;
use std::{env::VarError, path::PathBuf};
fn main() -> Result<(), VarError> {
let root_path = std::env::var("CARGO_MANIFEST_DIR")?;
let mut headers_path = PathBuf::new();
headers_path.push(root_path);
headers_path.push("../ext/spirv-headers");
let spirv_tools_dir = Config::new("../ext/spirv-tools")
.always_configure(false)
.define("SPIRV-Headers_SOURCE_DIR", headers_path)
.define("SPIRV_SKIP_EXECUTABLES", "ON")
.define("SPIRV_SKIP_TESTS", "ON")
.build();
println!(
"cargo:rustc-link-search=native={}/bin",
spirv_tools_dir.display()
);
println!(
"cargo:rustc-link-search=native={}/lib",
spirv_tools_dir.display()
);
// dynamic linking to avoid linking to C++ runtime
println!("cargo:rustc-link-lib=dylib=SPIRV-Tools-shared");
Ok(())
}
|