Skip to content

Commit cad6e50

Browse files
authored
Use more target features to build librocksdb-sys (tikv#620)
1 parent 35674e7 commit cad6e50

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

librocksdb-sys/build.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,20 @@ fn build_rocksdb() {
123123
config.flag_if_supported("-msse4.2");
124124
config.define("HAVE_SSE42", Some("1"));
125125
}
126-
126+
// Pass along additional target features as defined in
127+
// build_tools/build_detect_platform.
128+
if target_features.contains(&"avx2") {
129+
config.flag_if_supported("-mavx2");
130+
config.define("HAVE_AVX2", Some("1"));
131+
}
132+
if target_features.contains(&"bmi1") {
133+
config.flag_if_supported("-mbmi");
134+
config.define("HAVE_BMI", Some("1"));
135+
}
136+
if target_features.contains(&"lzcnt") {
137+
config.flag_if_supported("-mlzcnt");
138+
config.define("HAVE_LZCNT", Some("1"));
139+
}
127140
if !target.contains("android") && target_features.contains(&"pclmulqdq") {
128141
config.define("HAVE_PCLMUL", Some("1"));
129142
config.flag_if_supported("-mpclmul");
@@ -211,6 +224,7 @@ fn build_rocksdb() {
211224
} else {
212225
config.flag(&cxx_standard());
213226
// matches the flags in CMakeLists.txt from rocksdb
227+
config.define("HAVE_UINT128_EXTENSION", Some("1"));
214228
config.flag("-Wsign-compare");
215229
config.flag("-Wshadow");
216230
config.flag("-Wno-unused-parameter");

0 commit comments

Comments
 (0)