boring-sys: Pull iOS CMake params into a function

This commit is contained in:
ilammy 2021-12-30 19:37:04 +09:00 committed by Joshua Nelson
parent 570cc95c90
commit 06cf604b3a
1 changed files with 13 additions and 7 deletions

View File

@ -65,6 +65,16 @@ const CMAKE_PARAMS_IOS: &[(&str, &[(&str, &str)])] = &[
), ),
]; ];
fn cmake_params_ios() -> &'static [(&'static str, &'static str)] {
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
for (ios_arch, params) in CMAKE_PARAMS_IOS {
if *ios_arch == arch {
return *params;
}
}
&[]
}
/// Returns the platform-specific output path for lib. /// Returns the platform-specific output path for lib.
/// ///
/// MSVC generator on Windows place static libs in a target sub-folder, /// MSVC generator on Windows place static libs in a target sub-folder,
@ -143,14 +153,10 @@ fn get_boringssl_cmake_config() -> cmake::Config {
} }
"ios" => { "ios" => {
for (ios_arch, params) in CMAKE_PARAMS_IOS { for (name, value) in cmake_params_ios() {
if *ios_arch == arch {
for (name, value) in *params {
eprintln!("ios arch={} add {}={}", arch, name, value); eprintln!("ios arch={} add {}={}", arch, name, value);
boringssl_cmake.define(name, value); boringssl_cmake.define(name, value);
} }
}
}
// Bitcode is always on. // Bitcode is always on.
let bitcode_cflag = "-fembed-bitcode"; let bitcode_cflag = "-fembed-bitcode";