Skip to content
Open
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
33 changes: 15 additions & 18 deletions .github/workflows/coreaudio-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,34 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

ios-build:
xcode-builds:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Add iOS targets
run: rustup target add aarch64-apple-ios aarch64-apple-ios-sim
- name: Build iphonesimulator feedback example
run: cd examples/apple && xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS=arm64 -scheme coreaudio-ios-example -configuration Debug -derivedDataPath build -sdk iphonesimulator
toolchain: nightly
components: rust-src
targets: "aarch64-apple-ios,aarch64-apple-ios-sim"
- run: xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS=arm64 -scheme coreaudio-tvos-example -configuration Debug -derivedDataPath build -sdk appletvsimulator
working-directory: examples/apple
- run: xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS=arm64 -scheme coreaudio-ios-example -configuration Debug -derivedDataPath build -sdk iphonesimulator
working-directory: examples/apple
- run: xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS=arm64 -scheme coreaudio-visionos-example -configuration Debug -derivedDataPath build -sdk xrsimulator
working-directory: examples/apple

tvos-build:
check-examples:
runs-on: macOS-latest
strategy:
matrix:
rust-target: [aarch64-apple-ios-sim, aarch64-apple-tvos-sim, aarch64-apple-visionos-sim]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rust-src
- name: Build for tvOS simulator
run: cd examples/apple && cargo +nightly build -Zbuild-std --target aarch64-apple-tvos-sim --release
- name: Build for tvOS device
run: cd examples/apple && cargo +nightly build -Zbuild-std --target aarch64-apple-tvos --release
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Add iOS targets
run: rustup target add aarch64-apple-ios aarch64-apple-ios-sim
- name: Build appletvsimulator example
run: cd examples/apple && xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS=arm64 -scheme coreaudio-tvos-example -configuration Debug -derivedDataPath build -sdk appletvsimulator
- run: cargo +nightly build -Zbuild-std --all --target ${{ matrix.rust-target }}

# Build the docs with all features to make sure docs.rs will work.
macos-docs:
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ audio_unit = ["audio_toolbox"]

# Unsupported
open_al = []
[target.'cfg(target_os = "macos")'.dependencies]
libc = "0.2"

[dependencies]
bitflags = "2.10"
libc = "0.2"
objc2-core-foundation = { version = "0.3", optional = true, default-features = false, features = [
"std",
"CFString",
Expand Down Expand Up @@ -67,6 +68,9 @@ objc2-core-audio-types = { version = "0.3", optional = true, default-features =
"bitflags",
"CoreAudioBaseTypes",
] }
[dev-dependencies]
[target.'cfg(any(target_os = "ios", target_os = "tvos", target_os = "visionos"))'.dev-dependencies]
objc2-avf-audio = "0.3.2"

[package.metadata.docs.rs]
all-features = true
Expand Down
24 changes: 8 additions & 16 deletions examples/apple/build_rust_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@ if [[ -n "${DEVELOPER_SDK_DIR:-}" ]]; then
export LIBRARY_PATH="${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}"
fi

# Detect which platform we're building for based on SDKROOT
# SDKROOT is set by Xcode and contains the SDK path (e.g., iphoneos, iphonesimulator, appletvos, appletvsimulator)
case "${SDKROOT:-}" in
*appletvos*|*appletvsimulator*)
# Build for tvOS (requires nightly toolchain and -Zbuild-std since tvOS is a Tier 3 target)
cargo +nightly build -Zbuild-std --target aarch64-apple-tvos-sim --release
cargo +nightly build -Zbuild-std --target aarch64-apple-tvos --release
;;
*)
# Default: Build for iOS (stable toolchain)
# Device (arm64)
cargo build --target aarch64-apple-ios --release
# Simulator (arm64)
cargo build --target aarch64-apple-ios-sim --release
;;
esac
cargo build -Zbuild-std \
--target aarch64-apple-tvos-sim \
--target aarch64-apple-tvos \
--target aarch64-apple-visionos \
--target aarch64-apple-visionos-sim \
--release

cargo build --target aarch64-apple-ios --target aarch64-apple-ios-sim --release
Loading