diff --git a/ui-sys/build.rs b/ui-sys/build.rs index db12b5f84..3ed603215 100644 --- a/ui-sys/build.rs +++ b/ui-sys/build.rs @@ -37,12 +37,15 @@ fn main() { } } + println!("cargo:rerun-if-changed=wrapper.h"); + // Generate libui bindings on the fly let bindings = BindgenBuilder::default() .header("wrapper.h") .opaque_type("max_align_t") // For some reason this ends up too large //.rustified_enum(".*") .trust_clang_mangling(false) // clang sometimes wants to treat these functions as C++ + .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .generate() .expect("Unable to generate bindings"); @@ -57,6 +60,14 @@ fn main() { let src_base = env::var("SRC_BASE").unwrap_or("libui".to_string()); let src_path = |x| format!("{}/{}", src_base, x); + macro_rules! src_add { + ($p:expr) => { + let path = $p; + println!("cargo:rerun-if-changed={}", path); + base_config.file(path); + } + } + // Add source files that are common to all platforms base_config.include(src_path("/common")); @@ -77,7 +88,7 @@ fn main() { ] .iter() { - base_config.file(src_path(filename)); + src_add!(src_path(filename)); } if target_os == "windows" { @@ -149,7 +160,7 @@ fn main() { ] .iter() { - base_config.file(src_path(filename)); + src_add!(src_path(filename)); } // See https://github.com/nabijaczleweli/rust-embed-resource/issues/11 @@ -231,7 +242,7 @@ fn main() { ] .iter() { - base_config.file(src_path(filename)); + src_add!(src_path(filename)); } } else if apple { base_config.include(src_path("/darwin")); @@ -289,7 +300,7 @@ fn main() { ] .iter() { - base_config.file(src_path(filename)); + src_add!(src_path(filename)); } println!("cargo:rustc-link-lib=framework=AppKit"); } else {