From f6724d8558137f1efdacd12218afc5527ee54928 Mon Sep 17 00:00:00 2001 From: Thomas Tay Date: Mon, 25 Nov 2024 19:30:34 -0800 Subject: [PATCH 1/2] Add support for custom pkg-config include paths Add support for custom pkg-config include paths --- rlottie-sys/build.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rlottie-sys/build.rs b/rlottie-sys/build.rs index a3e05371..5e016bad 100644 --- a/rlottie-sys/build.rs +++ b/rlottie-sys/build.rs @@ -1,14 +1,22 @@ use std::{env, path::PathBuf}; fn main() { - pkg_config::Config::new() + let rlottie_pkg = pkg_config::Config::new() .probe("rlottie") .expect("Unable to find rlottie"); - + + // Extract include paths from the pkg-config metadata + let include_args: Vec = rlottie_pkg + .include_paths + .iter() + .map(|path| format!("-I{}", path.display())) + .collect(); + println!("cargo:rerun-if-changed=wrapper.h"); let bindings = bindgen::Builder::default() .formatter(bindgen::Formatter::Prettyplease) .header("wrapper.h") + .clang_args(&include_args) // Add include paths .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .newtype_enum(".*") .size_t_is_usize(true) From 14a982368aa4ccd93d8fa49ba4da67f65c00a085 Mon Sep 17 00:00:00 2001 From: ttay Date: Mon, 25 Nov 2024 19:35:46 -0800 Subject: [PATCH 2/2] be consistent with tab formatting --- rlottie-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rlottie-sys/build.rs b/rlottie-sys/build.rs index 5e016bad..b6eaf128 100644 --- a/rlottie-sys/build.rs +++ b/rlottie-sys/build.rs @@ -16,7 +16,7 @@ fn main() { let bindings = bindgen::Builder::default() .formatter(bindgen::Formatter::Prettyplease) .header("wrapper.h") - .clang_args(&include_args) // Add include paths + .clang_args(&include_args) // Add include paths .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .newtype_enum(".*") .size_t_is_usize(true)