-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.rs
32 lines (24 loc) · 819 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
use std::env;
use std::path::Path;
use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let compiler = env::var("ZIG_COMPILER").expect("Failed to find compiler");
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let path = Path::new(&dir);
env::set_current_dir(path.join("zig")).unwrap();
Command::new(compiler)
.args(&["build", "-Drelease-fast"])
.output()
.expect("Failed to compile Zig lib");
env::set_current_dir(path).unwrap();
println!(
"cargo:rustc-link-search=native={}",
Path::new(&dir).join("zig/zig-cache/lib").display()
);
// // On windows, link against ntdll
// #[cfg(target_os = "windows")]
// {
// println!("cargo:rustc-link-lib={}={}", "dylib", "ntdll");
// }
}