boring-sys: Use TARGET to determine iOS CMake params

The architecture alone is not enough. aarch64-apple-ios and
aarch-apple-ios-sim are both building for aarch64, but they need
slightly different CMake flags.
This commit is contained in:
ilammy 2021-12-30 19:40:02 +09:00 committed by Joshua Nelson
parent 06cf604b3a
commit f7673415bf
1 changed files with 5 additions and 5 deletions

View File

@ -50,14 +50,14 @@ fn cmake_params_android() -> &'static [(&'static str, &'static str)] {
const CMAKE_PARAMS_IOS: &[(&str, &[(&str, &str)])] = &[ const CMAKE_PARAMS_IOS: &[(&str, &[(&str, &str)])] = &[
( (
"aarch64", "aarch64-apple-ios",
&[ &[
("CMAKE_OSX_ARCHITECTURES", "arm64"), ("CMAKE_OSX_ARCHITECTURES", "arm64"),
("CMAKE_OSX_SYSROOT", "iphoneos"), ("CMAKE_OSX_SYSROOT", "iphoneos"),
], ],
), ),
( (
"x86_64", "x86_64-apple-ios",
&[ &[
("CMAKE_OSX_ARCHITECTURES", "x86_64"), ("CMAKE_OSX_ARCHITECTURES", "x86_64"),
("CMAKE_OSX_SYSROOT", "iphonesimulator"), ("CMAKE_OSX_SYSROOT", "iphonesimulator"),
@ -66,9 +66,9 @@ const CMAKE_PARAMS_IOS: &[(&str, &[(&str, &str)])] = &[
]; ];
fn cmake_params_ios() -> &'static [(&'static str, &'static str)] { fn cmake_params_ios() -> &'static [(&'static str, &'static str)] {
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); let target = std::env::var("TARGET").unwrap();
for (ios_arch, params) in CMAKE_PARAMS_IOS { for (ios_target, params) in CMAKE_PARAMS_IOS {
if *ios_arch == arch { if *ios_target == target {
return *params; return *params;
} }
} }