Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/coreaudio-sys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coreaudio-sys"
version = "0.2.8"
version = "0.2.9"
authors = ["Mitchell Nordine <mitchell.nordine@gmail.com>"]
description = "Bindings for Apple's CoreAudio frameworks generated via rust-bindgen"
license = "MIT"
Expand Down
26 changes: 21 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down