@@ -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