Browse Source

Merge pull request #20 from vhbit/ios-additional-archs

Additional archs for iOS
add-rc-path
Alex Crichton 10 years ago
parent
commit
63c78c7efe
  1. 38
      src/lib.rs

38
src/lib.rs

@ -175,24 +175,34 @@ fn cflags() -> Vec<String> {
} }
fn ios_flags(target: &str) -> Vec<String> { fn ios_flags(target: &str) -> Vec<String> {
let mut is_device_arch = false; enum ArchSpec {
Device(&'static str),
Simulator(&'static str),
}
let mut res = Vec::new(); let mut res = Vec::new();
if target.starts_with("arm-") { let arch = target.split('-').nth(0).expect("expected target in format `arch-vendor-os`");
res.push("-arch"); let arch = match arch {
res.push("armv7"); "arm" | "armv7" | "thumbv7" => ArchSpec::Device("armv7"),
is_device_arch = true; "armv7s" | "thumbv7s" => ArchSpec::Device("armv7s"),
} else if target.starts_with("arm64-") { "arm64" | "aarch64" => ArchSpec::Device("aarch64"),
"i386" | "i686" => ArchSpec::Simulator("-m32"),
"x86_64" => ArchSpec::Simulator("-m64"),
_ => unreachable!("Unknown arch for iOS target")
};
let sdk = match arch {
ArchSpec::Device(arch) => {
res.push("-arch"); res.push("-arch");
res.push("arm64"); res.push(arch);
is_device_arch = true; "iphoneos"
} else if target.starts_with("i386-") { },
res.push("-m32"); ArchSpec::Simulator(arch) => {
} else if target.starts_with("x86_64-") { res.push(arch);
res.push("-m64"); "iphonesimulator"
} }
};
let sdk = if is_device_arch {"iphoneos"} else {"iphonesimulator"};
println!("Detecting iOS SDK path for {}", sdk); println!("Detecting iOS SDK path for {}", sdk);
let sdk_path = Command::new("xcrun") let sdk_path = Command::new("xcrun")

Loading…
Cancel
Save