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";
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"));