Skip to content

Commit fcd554d

Browse files
committed
Added ios support
1 parent 2082654 commit fcd554d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ before_script:
1616
- if [ "$TRAVIS_OS_NAME" = linux ]; then rustup target add x86_64-apple-darwin; fi
1717
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
19-
- RUSTFMT=rustfmt cargo build --verbose --target=x86_64-apple-darwin
19+
- rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios
20+
- for i in x86_64-apple-darwin aarch64-apple-ios armv7-apple-ios armv7s-apple-ios; do RUSTFMT=rustfmt cargo build --verbose --target=$i; done
2021
- if [ "$TRAVIS_OS_NAME" = osx ]; then RUSTFMT=rustfmt cargo test --verbose; 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)