rkvm/input/build.rs

25 lines
718 B
Rust

use bindgen::{Builder, CargoCallbacks};
use std::env;
use std::path::PathBuf;
fn main() {
match env::var("CARGO_CFG_TARGET_OS").unwrap().as_str() {
"windows" => return,
"linux" => {}
_ => panic!("Unsupported target OS"),
}
println!("cargo:rerun-if-changed=glue/glue.h");
println!("cargo:rustc-link-lib=evdev");
// TODO: pkg-config
let bindings = Builder::default()
.header("glue/glue.h")
.clang_arg("-I/usr/include/libevdev-1.0/")
.parse_callbacks(Box::new(CargoCallbacks))
.generate()
.unwrap();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings.write_to_file(out_path.join("glue.rs")).unwrap();
}