-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.rs
27 lines (23 loc) · 841 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
#[cfg(feature = "bindgen")]
fn generate_bindings() {
let bindings = bindgen::Builder::default()
.header("oodle2.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
#[cfg(not(feature = "bindgen"))]
fn generate_bindings() {}
fn main() {
println!("cargo:rustc-link-search=native=/usr/local/lib");
#[cfg(target_os = "linux")]
println!("cargo:rustc-link-lib=oo2corelinux64");
#[cfg(target_os = "windows")]
println!("cargo:rustc-link-lib=oo2core_win64");
println!("cargo:rerun-if-changed=oodle2.h");
generate_bindings();
}