From bd1ec6ae2e6046646e74629cc522f68c2b0ce4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Bayardo=20Spadafora?= Date: Fri, 10 Mar 2023 03:43:43 -0800 Subject: [PATCH] Re-run build script if CPAL_ASIO_DIR changes or the folder it points to does (#759) * Re-run build script if the CPAL_ASIO_DIR env variable changes value * Re-run build script if the SDK changes --- asio-sys/build.rs | 3 +++ build.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/asio-sys/build.rs b/asio-sys/build.rs index 628b2ef..60f8704 100644 --- a/asio-sys/build.rs +++ b/asio-sys/build.rs @@ -13,6 +13,8 @@ const ASIO_SYS_HEADER: &str = "asiosys.h"; const ASIO_DRIVERS_HEADER: &str = "asiodrivers.h"; fn main() { + println!("cargo:rerun-if-env-changed={}", CPAL_ASIO_DIR); + // If ASIO directory isn't set silently return early let cpal_asio_dir_var = match env::var(CPAL_ASIO_DIR) { Err(_) => return, @@ -21,6 +23,7 @@ fn main() { // Asio directory let cpal_asio_dir = PathBuf::from(cpal_asio_dir_var); + println!("cargo:rerun-if-changed={}", cpal_asio_dir.display()); // Directory where bindings and library are created let out_dir = PathBuf::from(env::var("OUT_DIR").expect("bad path")); diff --git a/build.rs b/build.rs index 52cddc5..ae97f68 100644 --- a/build.rs +++ b/build.rs @@ -3,6 +3,8 @@ use std::env; const CPAL_ASIO_DIR: &str = "CPAL_ASIO_DIR"; fn main() { + println!("cargo:rerun-if-env-changed={}", CPAL_ASIO_DIR); + // If ASIO directory isn't set silently return early // otherwise set the asio config flag match env::var(CPAL_ASIO_DIR) {