2023-02-19 06:51:37 +00:00
|
|
|
extern crate bindgen;
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2023-02-20 11:07:44 +00:00
|
|
|
#[cfg(not(feature = "no_link_libs"))]
|
|
|
|
fn linking_libs() {
|
2023-02-19 06:51:37 +00:00
|
|
|
println!("cargo:rustc-link-lib=raylib");
|
2023-02-20 11:07:44 +00:00
|
|
|
println!("cargo:rustc-link-lib=OpenGL");
|
2023-02-19 06:51:37 +00:00
|
|
|
}
|
|
|
|
|
2023-02-20 11:07:44 +00:00
|
|
|
#[cfg(feature = "no_link_libs")]
|
|
|
|
fn linking_libs() {}
|
2023-02-19 06:51:37 +00:00
|
|
|
|
|
|
|
fn main() {
|
2023-02-20 11:07:44 +00:00
|
|
|
linking_libs();
|
2023-02-19 06:51:37 +00:00
|
|
|
println!("cargo:rerun-if-changed=raylib/raylib.h");
|
|
|
|
|
|
|
|
let bindings = bindgen::Builder::default()
|
|
|
|
.header("raylib/raylib.h")
|
|
|
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
|
|
|
.generate()
|
|
|
|
.expect("Unable to generate bindings");
|
|
|
|
|
|
|
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
|
|
bindings
|
|
|
|
.write_to_file(out_path.join("raylib_bindings.rs"))
|
|
|
|
.expect("Couldn't write bindings!");
|
|
|
|
}
|