diff --git a/CHANGELOG.md b/CHANGELOG.md index 63388e6..14cf0d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +* Bump `librocksdb-sys` up to 6.19.3 (olegnn) +* Make SSE inclusion conditional for target features. + RocksDB is not compiled with SSE4 instructions anymore unless the corresponding features are enabled in rustc (mbargull) * Bump `librocksdb-sys` up to 6.20.3 (olegnn, akrylysov) * Add `DB::key_may_exist_cf_opt` method (stanislav-tkach) * Add `Options::set_zstd_max_train_bytes` method (stanislav-tkach) diff --git a/librocksdb-sys/build.rs b/librocksdb-sys/build.rs index 03cc9b8..e41065e 100644 --- a/librocksdb-sys/build.rs +++ b/librocksdb-sys/build.rs @@ -103,14 +103,24 @@ fn build_rocksdb() { // This is needed to enable hardware CRC32C. Technically, SSE 4.2 is // only available since Intel Nehalem (about 2010) and AMD Bulldozer // (about 2011). - config.define("HAVE_SSE42", Some("1")); - config.flag_if_supported("-msse2"); - config.flag_if_supported("-msse4.1"); - config.flag_if_supported("-msse4.2"); + let target_feature = env::var("CARGO_CFG_TARGET_FEATURE").unwrap(); + let target_features: Vec<_> = target_feature.split(",").collect(); + if target_features.contains(&"sse2") { + config.flag_if_supported("-msse2"); + } + if target_features.contains(&"sse4.1") { + config.flag_if_supported("-msse4.1"); + } + if target_features.contains(&"sse4.2") { + config.flag_if_supported("-msse4.2"); + config.define("HAVE_SSE42", Some("1")); + } if !target.contains("android") { - config.define("HAVE_PCLMUL", Some("1")); - config.flag_if_supported("-mpclmul"); + if target_features.contains(&"pclmulqdq") { + config.define("HAVE_PCLMUL", Some("1")); + config.flag_if_supported("-mpclmul"); + } } }