diff --git a/.github/workflows/coreaudio-sys.yml b/.github/workflows/coreaudio-sys.yml index 8c07fcd..d09832e 100644 --- a/.github/workflows/coreaudio-sys.yml +++ b/.github/workflows/coreaudio-sys.yml @@ -4,6 +4,9 @@ jobs: # Run cargo test with default, no and all features. macos-test: runs-on: macOS-latest + strategy: + matrix: + toolchain: [stable, nightly] steps: - uses: actions/checkout@v2 - name: Install llvm and clang @@ -12,7 +15,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: ${{ matrix.toolchain }} override: true - name: cargo test run: cargo test --verbose diff --git a/Cargo.toml b/Cargo.toml index 92d78df..ff99924 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "coreaudio-sys" -version = "0.2.8" +version = "0.2.9" authors = ["Mitchell Nordine "] description = "Bindings for Apple's CoreAudio frameworks generated via rust-bindgen" license = "MIT" diff --git a/build.rs b/build.rs index be6f270..dd83151 100644 --- a/build.rs +++ b/build.rs @@ -47,16 +47,32 @@ fn build(sdk_path: Option<&str>, target: &str) { let mut headers: Vec<&'static str> = vec![]; - #[cfg(feature = "audio_toolbox")] + #[cfg(feature = "audio_unit")] { - println!("cargo:rustc-link-lib=framework=AudioToolbox"); - headers.push("AudioToolbox/AudioToolbox.h"); + // Since iOS 10.0 and macOS 10.12, all the functionality in AudioUnit + // moved to AudioToolbox, and the AudioUnit headers have been simple + // wrappers ever since. + if target.contains("apple-ios") { + // On iOS, the AudioUnit framework does not have (and never had) an + // actual dylib to link to, it is just a few header files. + // The AudioToolbox framework contains the symbols instead. + println!("cargo:rustc-link-lib=framework=AudioToolbox"); + } else { + // On macOS, the symbols are present in the AudioToolbox framework, + // but only on macOS 10.12 and above. + // + // However, unlike on iOS, the AudioUnit framework on macOS + // contains a dylib with the desired symbols, that we can link to + // (in later versions just re-exports from AudioToolbox). + println!("cargo:rustc-link-lib=framework=AudioUnit"); + } + headers.push("AudioUnit/AudioUnit.h"); } - #[cfg(feature = "audio_unit")] + #[cfg(feature = "audio_toolbox")] { println!("cargo:rustc-link-lib=framework=AudioToolbox"); - headers.push("AudioUnit/AudioUnit.h"); + headers.push("AudioToolbox/AudioToolbox.h"); } #[cfg(feature = "core_audio")]