use std::env; use std::fs; use std::path::PathBuf; use std::process::Command; fn main() { let bindings = Command::new("bindgen") .arg("wrapper.h") .output() .expect("Failed to generate bindings"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); fs::write(out_path.join("v4l2_bindings.rs"), bindings.stdout.as_slice()) .expect("Failed to write bindings"); }