-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.rs
31 lines (27 loc) · 1.09 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
#[cfg(target_os = "macos")]
fn main() {
use bindgen::{RustEdition, RustTarget};
use std::env;
use std::path::Path;
match RustTarget::stable(72, 0) {
Ok(rust_target) => {
let bindings = bindgen::builder()
.header_contents("libproc_rs.h", "#include <libproc.h>")
.rust_target(rust_target)
.rust_edition(RustEdition::Edition2018)
.layout_tests(false)
.clang_args(&["-x", "c++", "-I", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/"])
.generate()
.expect("Failed to build libproc bindings");
let output_path = Path::new(&env::var("OUT_DIR")
.expect("OUT_DIR env var was not defined"))
.join("osx_libproc_bindings.rs");
bindings
.write_to_file(output_path)
.expect("Failed to write libproc bindings");
}
_ => eprintln!("Error executing bindgen")
}
}
#[cfg(any(target_os = "linux", target_os = "redox", target_os = "android"))]
fn main() {}