@@ -24,7 +24,7 @@ fn build_bindings(cwd: &Path) {
2424
2525 eprintln ! ( "{}" , cwd. display( ) ) ;
2626
27- let builder = bindgen:: Builder :: default ( )
27+ let mut builder = bindgen:: Builder :: default ( )
2828 . clang_arg ( format ! ( "--include-directory={}" , include_dir. display( ) ) )
2929 . clang_arg ( "-DXED_ENCODER" )
3030 . clang_arg ( "-DXED_DECODER" )
@@ -38,6 +38,10 @@ fn build_bindings(cwd: &Path) {
3838 . derive_debug ( true )
3939 . prepend_enum_name ( false ) ;
4040
41+ if cfg ! ( feature = "enc2" ) {
42+ builder = builder. clang_arg ( "-DXED_ENC2" ) ;
43+ }
44+
4145 builder. dump_preprocessed_input ( ) . unwrap ( ) ;
4246
4347 let bindings = match builder. generate ( ) {
@@ -147,6 +151,10 @@ fn main() {
147151 cmd. arg ( "--opt=0" ) ;
148152 }
149153
154+ if cfg ! ( feature = "enc2" ) {
155+ cmd. arg ( "--enc2" ) ;
156+ }
157+
150158 cmd. arg ( "install" ) . current_dir ( & build_dir) ;
151159
152160 eprintln ! ( "XED build command: {:?}" , cmd) ;
@@ -162,6 +170,13 @@ fn main() {
162170 println ! ( "cargo:rustc-link-search=native={}" , lib_dir. display( ) ) ;
163171 println ! ( "cargo:rustc-link-lib=static=xed" ) ;
164172
173+ if cfg ! ( feature = "enc2" ) {
174+ println ! ( "cargo:rustc-link-lib=static=xed-enc2-m32-a32" ) ;
175+ println ! ( "cargo:rustc-link-lib=static=xed-enc2-m64-a64" ) ;
176+ println ! ( "cargo:rustc-link-lib=static=xed-chk-enc2-m32-a32" ) ;
177+ println ! ( "cargo:rustc-link-lib=static=xed-chk-enc2-m64-a64" ) ;
178+ }
179+
165180 // Generate bindings
166181 build_bindings ( & cwd) ;
167182}
0 commit comments