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
This commit is contained in:
Julián Bayardo Spadafora 2023-03-10 03:43:43 -08:00 • committed by GitHub
parent e5ccc46afa
commit bd1ec6ae2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -13,6 +13,8 @@ const ASIO_SYS_HEADER: &str = "asiosys.h";
const ASIO_DRIVERS_HEADER: &str = "asiodrivers.h"; const ASIO_DRIVERS_HEADER: &str = "asiodrivers.h";
fn main() { fn main() {
println!("cargo:rerun-if-env-changed={}", CPAL_ASIO_DIR);
// If ASIO directory isn't set silently return early // If ASIO directory isn't set silently return early
let cpal_asio_dir_var = match env::var(CPAL_ASIO_DIR) { let cpal_asio_dir_var = match env::var(CPAL_ASIO_DIR) {
Err(_) => return, Err(_) => return,
@ -21,6 +23,7 @@ fn main() {
// Asio directory // Asio directory
let cpal_asio_dir = PathBuf::from(cpal_asio_dir_var); 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 // Directory where bindings and library are created
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("bad path")); let out_dir = PathBuf::from(env::var("OUT_DIR").expect("bad path"));

View file

@ -3,6 +3,8 @@ use std::env;
const CPAL_ASIO_DIR: &str = "CPAL_ASIO_DIR"; const CPAL_ASIO_DIR: &str = "CPAL_ASIO_DIR";
fn main() { fn main() {
println!("cargo:rerun-if-env-changed={}", CPAL_ASIO_DIR);
// If ASIO directory isn't set silently return early // If ASIO directory isn't set silently return early
// otherwise set the asio config flag // otherwise set the asio config flag
match env::var(CPAL_ASIO_DIR) { match env::var(CPAL_ASIO_DIR) {