Use pkg-config
parent
2b54b72054
commit
0444f7bd64
|
@ -20,3 +20,4 @@ libc = "0.2"
|
|||
|
||||
[build-dependencies]
|
||||
bindgen = "0.52"
|
||||
pkg-config = "0.3"
|
||||
|
|
|
@ -4,10 +4,9 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rustc-link-lib=vlc");
|
||||
println!("cargo:rerun-if-changed=wrapper.h");
|
||||
|
||||
let bindings = bindgen::Builder::default()
|
||||
let mut bindings = bindgen::Builder::default()
|
||||
.header("wrapper.h")
|
||||
// For no_std
|
||||
.use_core()
|
||||
|
@ -18,9 +17,15 @@ fn main() {
|
|||
.whitelist_function(".*vlc.*")
|
||||
.whitelist_var(".*vlc.*")
|
||||
.whitelist_function("vsnprintf")
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
|
||||
|
||||
// Set header include paths
|
||||
let pkg_config_library = pkg_config::Config::new().probe("libvlc").unwrap();
|
||||
for include_path in &pkg_config_library.include_paths {
|
||||
bindings = bindings.clang_arg(format!("-I{}", include_path.display()));
|
||||
}
|
||||
|
||||
let bindings = bindings.generate().expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
|
|
Loading…
Reference in New Issue