Skip to content
Closed
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
46 changes: 36 additions & 10 deletions boring-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ const CMAKE_PARAMS_IOS: &[(&str, &[(&str, &str)])] = &[
("CMAKE_OSX_SYSROOT", "iphonesimulator"),
],
),
(
"aarch64-apple-ios-macabi",
&[
("CMAKE_OSX_ARCHITECTURES", "arm64"),
("CMAKE_OSX_SYSROOT", "macosx"),
],
),
(
"x86_64-apple-ios-macabi",
&[
("CMAKE_OSX_ARCHITECTURES", "x86_64"),
("CMAKE_OSX_SYSROOT", "macosx"),
],
),
];

fn cmake_params_ios() -> &'static [(&'static str, &'static str)] {
Expand Down Expand Up @@ -178,16 +192,28 @@ fn get_boringssl_cmake_config() -> cmake::Config {
// Bitcode is always on.
let bitcode_cflag = "-fembed-bitcode";

// Hack for Xcode 10.1.
let target_cflag = if arch == "x86_64" {
"-target x86_64-apple-ios-simulator"
if target.ends_with("-macabi") {
// Mac Catalyst
let compiler_flags = format!("{} -target {}", bitcode_cflag, target);
boringssl_cmake.define("CMAKE_ASM_FLAGS", &compiler_flags);
// Work around hardcoded deployment target in cc crate by defining CMAKE_C_FLAGS
// instead of using the cflag builder.
boringssl_cmake.define("CMAKE_C_FLAGS", &compiler_flags);
boringssl_cmake.define("CMAKE_CXX_FLAGS", &compiler_flags);
} else {
""
};

let cflag = format!("{} {}", bitcode_cflag, target_cflag);
boringssl_cmake.define("CMAKE_ASM_FLAGS", &cflag);
boringssl_cmake.cflag(&cflag);
// Normal iOS

// Hack for Xcode 10.1.
let target_cflag = if arch == "x86_64" {
"-target x86_64-apple-ios-simulator"
} else {
""
};

let cflag = format!("{} {}", bitcode_cflag, target_cflag);
boringssl_cmake.define("CMAKE_ASM_FLAGS", &cflag);
boringssl_cmake.cflag(&cflag);
}
}

"windows" => {
Expand Down Expand Up @@ -424,7 +450,7 @@ fn main() {
// so let's disable all alignment tests and hope for the best.
//
// [1]: https://github.com/rust-lang/rust-bindgen/issues/1651
"aarch64-apple-ios" | "aarch64-apple-ios-sim" => {
"aarch64-apple-ios" | "aarch64-apple-ios-sim" | "aarch64-apple-ios-macabi" => {
builder = builder.layout_tests(false);
}
_ => {}
Expand Down