2022-05-12 08:46:48 +02:00
|
|
|
extern crate bindgen;
|
|
|
|
|
2022-06-07 07:06:03 +02:00
|
|
|
use std::path::PathBuf;
|
2022-05-12 08:46:48 +02:00
|
|
|
|
|
|
|
fn main() {
|
2022-06-07 07:41:14 +02:00
|
|
|
// println!("cargo:rustc-link-lib=stdc++");
|
|
|
|
// println!("cargo:rustc-link-lib=opencv4");
|
2022-06-07 07:06:03 +02:00
|
|
|
println!("cargo:rustc-link-lib=mediagraph");
|
|
|
|
// println!("cargo:rerun-if-changed=wrapper.h");
|
2022-05-12 08:46:48 +02:00
|
|
|
|
2022-06-07 07:06:03 +02:00
|
|
|
let bindings = bindgen::Builder::default()
|
|
|
|
.clang_arg("-xc++")
|
|
|
|
.clang_arg("-std=c++14")
|
|
|
|
.clang_arg("-I/usr/local/include/opencv4")
|
|
|
|
.generate_comments(true)
|
|
|
|
.header("/usr/local/include/mediagraph.h")
|
|
|
|
.allowlist_function("mediagraph.*")
|
|
|
|
.allowlist_type("mediagraph.*")
|
|
|
|
.allowlist_var("mediagraph.*")
|
|
|
|
.detect_include_paths(true)
|
|
|
|
.generate_inline_functions(true)
|
|
|
|
.generate()
|
|
|
|
.expect("Unable to generate bindings");
|
2022-05-12 08:46:48 +02:00
|
|
|
|
2022-06-07 07:06:03 +02:00
|
|
|
let out_path = PathBuf::from("./src");
|
|
|
|
bindings
|
|
|
|
.write_to_file(out_path.join("bindings.rs"))
|
|
|
|
.expect("Couldn't write bindings!");
|
2022-05-12 08:46:48 +02:00
|
|
|
}
|