@@ -338,9 +338,14 @@ fn build_wrapper(mut cc: cc::Build) {
338
338
}
339
339
340
340
fn main ( ) -> Result < ( ) > {
341
- println ! ( "cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_4)" ) ; // replace with cargo:: syntax when MSRV is 1.77
342
- println ! ( "cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_34)" ) ; // replace with cargo:: syntax when MSRV is 1.77
343
- println ! ( "cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_32)" ) ; // replace with cargo:: syntax when MSRV is 1.77
341
+ let args = env:: args_os ( ) . skip ( 1 ) . peekable ( ) ;
342
+ if matches ! ( handle_running_binding_generator( args) ?, GenerateFullBindings :: Stop ) {
343
+ return Ok ( ( ) ) ;
344
+ }
345
+
346
+ for branch in [ "4" , "34" , "32" ] . iter ( ) {
347
+ println ! ( "cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_{branch})" ) ; // replace with cargo:: syntax when MSRV is 1.77
348
+ }
344
349
for module in SUPPORTED_MODULES {
345
350
println ! ( "cargo:rustc-check-cfg=cfg(ocvrs_has_module_{module})" ) ; // replace with cargo:: syntax when MSRV is 1.77
346
351
}
@@ -349,12 +354,6 @@ fn main() -> Result<()> {
349
354
return Ok ( ( ) ) ;
350
355
}
351
356
352
- let args = env:: args_os ( ) . skip ( 1 ) . peekable ( ) ;
353
- let build_script_path = env:: current_exe ( ) ?;
354
- if matches ! ( handle_running_binding_generator( args) ?, GenerateFullBindings :: Stop ) {
355
- return Ok ( ( ) ) ;
356
- }
357
-
358
357
let pkg_version = env:: var ( "CARGO_PKG_VERSION" ) . unwrap_or_else ( |_| "unknown_crate_version" . to_string ( ) ) ;
359
358
eprintln ! ( "=== Crate version: {pkg_version}" ) ;
360
359
eprintln ! ( "=== Environment configuration:" ) ;
@@ -428,6 +427,7 @@ fn main() -> Result<()> {
428
427
setup_rerun ( ) ?;
429
428
430
429
let ffi_export_suffix = format ! ( "_{}" , pkg_version. replace( "." , "_" ) ) ;
430
+ let build_script_path = env:: current_exe ( ) ?;
431
431
let binding_generator = BindingGenerator :: new ( build_script_path) ;
432
432
binding_generator. generate_wrapper ( opencv_header_dir, & opencv, & ffi_export_suffix) ?;
433
433
let cc = build_compiler ( & opencv, & ffi_export_suffix) ;
0 commit comments