@@ -11,6 +11,20 @@ use crate::config::Config;
11
11
12
12
mod config;
13
13
14
+ fn should_use_cmake_cross_compilation ( config : & Config ) -> bool {
15
+ if config. host == config. target {
16
+ return false ;
17
+ }
18
+ match config. target_os . as_str ( ) {
19
+ "macos" | "ios" => {
20
+ // Cross-compiling for Apple platforms on macOS is supported using the normal Xcode
21
+ // tools, along with the settings from `cmake_params_apple`.
22
+ !config. host . ends_with ( "-darwin" )
23
+ }
24
+ _ => true ,
25
+ }
26
+ }
27
+
14
28
// Android NDK >= 19.
15
29
const CMAKE_PARAMS_ANDROID_NDK : & [ ( & str , & [ ( & str , & str ) ] ) ] = & [
16
30
( "aarch64" , & [ ( "ANDROID_ABI" , "arm64-v8a" ) ] ) ,
@@ -193,11 +207,13 @@ fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
193
207
return boringssl_cmake;
194
208
}
195
209
196
- boringssl_cmake
197
- . define ( "CMAKE_CROSSCOMPILING" , "true" )
198
- . define ( "CMAKE_C_COMPILER_TARGET" , & config. target )
199
- . define ( "CMAKE_CXX_COMPILER_TARGET" , & config. target )
200
- . define ( "CMAKE_ASM_COMPILER_TARGET" , & config. target ) ;
210
+ if should_use_cmake_cross_compilation ( config) {
211
+ boringssl_cmake
212
+ . define ( "CMAKE_CROSSCOMPILING" , "true" )
213
+ . define ( "CMAKE_C_COMPILER_TARGET" , & config. target )
214
+ . define ( "CMAKE_CXX_COMPILER_TARGET" , & config. target )
215
+ . define ( "CMAKE_ASM_COMPILER_TARGET" , & config. target ) ;
216
+ }
201
217
202
218
if let Some ( sysroot) = & config. env . sysroot {
203
219
boringssl_cmake. define ( "CMAKE_SYSROOT" , sysroot) ;
0 commit comments