feat(teipe): initial commit
This commit is contained in:
25
libeirs/build.rs
Normal file
25
libeirs/build.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let bindings = bindgen::builder()
|
||||
.header("/usr/include/libei-1.0/libei.h")
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
.allowlist_item("ei_.*")
|
||||
.default_enum_style(bindgen::EnumVariation::NewType {
|
||||
is_bitfield: false,
|
||||
is_global: false,
|
||||
})
|
||||
.no_debug("ei_event_type") // Implemented manually to use Display
|
||||
.bitfield_enum("ei_device_capability")
|
||||
.generate()?;
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
let out_file = out_path.join("libei.rs");
|
||||
bindings
|
||||
.write_to_file(out_file)
|
||||
.expect("Couldn't write bindings!");
|
||||
|
||||
println!("cargo:rustc-link-lib=ei");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user