Check for CMAKE_TOOLCHAIN_FILE when creating cmake config

We don't do anything fancy anymore for non-cross builds
and when a specific CMAKE_TOOLCHAIN_FILE is specified.
This commit is contained in:
Anthony Ramine 2023-10-16 10:36:02 +02:00 committed by Alessandro Ghedini
parent 80b97c8318
commit ba0ea33ab4
2 changed files with 105 additions and 97 deletions

View File

@ -30,6 +30,7 @@ pub(crate) struct Env {
pub(crate) debug: Option<OsString>, pub(crate) debug: Option<OsString>,
pub(crate) opt_level: Option<OsString>, pub(crate) opt_level: Option<OsString>,
pub(crate) android_ndk_home: Option<PathBuf>, pub(crate) android_ndk_home: Option<PathBuf>,
pub(crate) cmake_toolchain_file: Option<PathBuf>,
} }
impl Config { impl Config {
@ -147,6 +148,7 @@ impl Env {
debug: target_var("DEBUG"), debug: target_var("DEBUG"),
opt_level: target_var("OPT_LEVEL"), opt_level: target_var("OPT_LEVEL"),
android_ndk_home: target_var("ANDROID_NDK_HOME").map(Into::into), android_ndk_home: target_var("ANDROID_NDK_HOME").map(Into::into),
cmake_toolchain_file: target_var("CMAKE_TOOLCHAIN_FILE").map(Into::into),
} }
} }
} }

View File

@ -185,7 +185,14 @@ fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
let src_path = get_boringssl_source_path(config); let src_path = get_boringssl_source_path(config);
let mut boringssl_cmake = cmake::Config::new(src_path); let mut boringssl_cmake = cmake::Config::new(src_path);
if config.host != config.target { if config.host == config.target {
return boringssl_cmake;
}
if config.env.cmake_toolchain_file.is_some() {
return boringssl_cmake;
}
// Add platform-specific parameters for cross-compilation. // Add platform-specific parameters for cross-compilation.
match &*config.target_os { match &*config.target_os {
"android" => { "android" => {
@ -286,7 +293,6 @@ fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
_ => {} _ => {}
} }
}
boringssl_cmake boringssl_cmake
} }