From 674f395961c27f1f1d53d487721e24f04fc81d71 Mon Sep 17 00:00:00 2001 From: Dakota Thompson Date: Wed, 8 Nov 2023 16:53:50 +0000 Subject: [PATCH] fix: do not rerun build on changed header files this restores functionality lost in the latest upgrade to `bindgen`, which enabled this functionality --- crates/llama_cpp_sys/build.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/llama_cpp_sys/build.rs b/crates/llama_cpp_sys/build.rs index 269a3ab..2ce4fec 100644 --- a/crates/llama_cpp_sys/build.rs +++ b/crates/llama_cpp_sys/build.rs @@ -61,7 +61,9 @@ fn main() { } if !build_info_path.exists() { - fs::write(build_info_path, "\ + fs::write( + build_info_path, + "\ #ifndef BUILD_INFO_H #define BUILD_INFO_H @@ -72,7 +74,9 @@ fn main() { #endif // BUILD_INFO_H - ").unwrap(); + ", + ) + .unwrap(); } let dst = cmake::Config::new(&build_dir) @@ -88,7 +92,9 @@ fn main() { let bindings = bindgen::Builder::default() .header(header_path.to_string_lossy()) - .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) + .parse_callbacks(Box::new( + bindgen::CargoCallbacks::new().rerun_on_header_files(false), + )) .generate_comments(false) .allowlist_function("llama_.*") .allowlist_type("llama_.*")