2024-03-05 23:51:21 +00:00
|
|
|
use std::env;
|
2024-03-06 03:23:47 +00:00
|
|
|
use std::fs;
|
2024-03-05 23:51:21 +00:00
|
|
|
use std::path::PathBuf;
|
2024-03-06 03:23:47 +00:00
|
|
|
use std::process::Command;
|
2024-03-05 23:51:21 +00:00
|
|
|
|
|
|
|
fn main() {
|
2024-03-06 03:23:47 +00:00
|
|
|
let bindings = Command::new("bindgen")
|
|
|
|
.arg("wrapper.h")
|
|
|
|
.output()
|
2024-03-05 23:51:21 +00:00
|
|
|
.expect("Failed to generate bindings");
|
|
|
|
|
|
|
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
2024-03-06 03:23:47 +00:00
|
|
|
fs::write(out_path.join("v4l2_bindings.rs"), bindings.stdout.as_slice())
|
2024-03-05 23:51:21 +00:00
|
|
|
.expect("Failed to write bindings");
|
|
|
|
}
|