boring-sys: Support static MSVC runtime
This commit is contained in:
parent
43c8c279f3
commit
7d000369f3
@ -12,6 +12,7 @@ pub(crate) struct Config {
|
||||
pub(crate) target_os: String,
|
||||
pub(crate) unix: bool,
|
||||
pub(crate) target_env: String,
|
||||
pub(crate) target_features: Vec<String>,
|
||||
pub(crate) features: Features,
|
||||
pub(crate) env: Env,
|
||||
}
|
||||
@ -48,6 +49,12 @@ impl Config {
|
||||
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
|
||||
let unix = env::var("CARGO_CFG_UNIX").is_ok();
|
||||
|
||||
let target_features = env::var("CARGO_CFG_TARGET_FEATURE")
|
||||
.unwrap()
|
||||
.split(',')
|
||||
.map(|s| s.to_owned())
|
||||
.collect();
|
||||
|
||||
let features = Features::from_env();
|
||||
let env = Env::from_env(&host, &target, features.is_fips_like());
|
||||
|
||||
@ -66,6 +73,7 @@ impl Config {
|
||||
target_os,
|
||||
unix,
|
||||
target_env,
|
||||
target_features,
|
||||
features,
|
||||
env,
|
||||
};
|
||||
|
||||
@ -217,7 +217,11 @@ fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
|
||||
// This is required now because newest BoringSSL requires CMake 3.22 which
|
||||
// uses the new logic with CMAKE_MSVC_RUNTIME_LIBRARY introduced in CMake 3.15.
|
||||
// https://github.com/rust-lang/cmake-rs/pull/30#issuecomment-2969758499
|
||||
boringssl_cmake.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreadedDLL");
|
||||
if config.target_features.iter().any(|f| f == "crt-static") {
|
||||
boringssl_cmake.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded");
|
||||
} else {
|
||||
boringssl_cmake.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreadedDLL");
|
||||
}
|
||||
}
|
||||
|
||||
if config.host == config.target {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user