2020-09-16 18:04:18 +02:00
|
|
|
use bindgen::{Builder, CargoCallbacks};
|
|
|
|
use std::env;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
fn main() {
|
2020-10-25 18:35:50 +01:00
|
|
|
println!("cargo:rerun-if-changed=glue/glue.h");
|
2020-10-25 19:37:18 +01:00
|
|
|
println!("cargo:rustc-link-lib=evdev");
|
2020-09-16 18:04:18 +02:00
|
|
|
|
2020-10-28 19:45:49 +01:00
|
|
|
// TODO: pkg-config
|
2020-09-16 18:04:18 +02:00
|
|
|
let bindings = Builder::default()
|
2020-10-25 18:35:50 +01:00
|
|
|
.header("glue/glue.h")
|
2020-10-28 19:45:49 +01:00
|
|
|
.clang_arg("-I/usr/include/libevdev-1.0/")
|
2020-09-16 18:04:18 +02:00
|
|
|
.parse_callbacks(Box::new(CargoCallbacks))
|
|
|
|
.generate()
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
2020-10-25 18:35:50 +01:00
|
|
|
bindings.write_to_file(out_path.join("glue.rs")).unwrap();
|
2020-09-16 18:04:18 +02:00
|
|
|
}
|