Skip to content

Commit 4e15239

Browse files
committed
Added ios support
1 parent 2082654 commit 4e15239

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ script:
1818
- if [ "$TRAVIS_OS_NAME" = linux ]; then curl -sL https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.13.sdk.tar.xz | tar -Jxf -; export COREAUDIO_SDK_PATH="$PWD/MacOSX10.13.sdk"; fi
1919
- RUSTFMT=rustfmt cargo build --verbose --target=x86_64-apple-darwin
2020
- if [ "$TRAVIS_OS_NAME" = osx ]; then RUSTFMT=rustfmt cargo test --verbose; fi
21+
- if [ "$TRAVIS_OS_NAME" = osx ]; then rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios; for i in aarch64-apple-ios armv7-apple-ios armv7s-apple-ios; do RUSTFMT=rustfmt cargo build --verbose --target=$i; done; fi

build.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ fn build(sdk_path: Option<&str>, target: &str) {
5454
#[cfg(feature = "core_audio")]
5555
{
5656
println!("cargo:rustc-link-lib=framework=CoreAudio");
57-
headers.push("CoreAudio/CoreAudio.h");
57+
58+
if target.contains("apple-ios") {
59+
headers.push("CoreAudio/CoreAudioTypes.h");
60+
} else {
61+
headers.push("CoreAudio/CoreAudio.h");
62+
}
5863
}
5964

6065
#[cfg(feature = "open_al")]
@@ -79,7 +84,14 @@ fn build(sdk_path: Option<&str>, target: &str) {
7984
// Begin building the bindgen params.
8085
let mut builder = bindgen::Builder::default();
8186

82-
builder = builder.clang_args(&[&format!("--target={}", target)]);
87+
if target == "aarch64-apple-ios" {
88+
// See https://github.com/rust-lang/rust-bindgen/issues/1211
89+
// Technically according to the llvm mailing list, the argument to clang here should be
90+
// -arch arm64 but it looks cleaner to just change the target.
91+
builder = builder.clang_args(&[&format!("--target={}", "arm64-apple-ios")]);
92+
} else {
93+
builder = builder.clang_args(&[&format!("--target={}", target)]);
94+
}
8395

8496
if let Some(sdk_path) = sdk_path {
8597
builder = builder.clang_args(&["-isysroot", sdk_path]);

0 commit comments

Comments
 (0)