@@ -332,36 +332,68 @@ fn build() {
332332 skip_codegen = false ;
333333 }
334334 // CONFIG
335- let codegen = bindgen:: Builder :: default ( ) ;
336- let codegen = codegen. clang_arg ( format ! ( "-I{}" , source_path. to_str( ) . expect( "PathBuf to str" ) ) ) ;
337- let mut missing = Vec :: new ( ) ;
338- let codegen = ffmpeg_headers
339- . iter ( )
340- . fold ( codegen, |codegen : bindgen:: Builder , path : & & str | -> bindgen:: Builder {
341- let path: & str = path. clone ( ) ;
342- let path: PathBuf = source_path. join ( path) ;
343- let path: & str = path. to_str ( ) . expect ( "PathBuf to str" ) ;
344- if !PathBuf :: from ( path) . exists ( ) {
345- missing. push ( String :: from ( path) ) ;
346- codegen
347- } else {
348- codegen. header ( path)
349- }
350- } ) ;
351- if !missing. is_empty ( ) {
352- panic ! ( "missing headers: {:#?}" , missing) ;
335+ if !skip_codegen {
336+ let codegen = bindgen:: Builder :: default ( ) ;
337+ let codegen = codegen. clang_arg ( format ! ( "-I{}" , source_path. to_str( ) . expect( "PathBuf to str" ) ) ) ;
338+ let mut missing = Vec :: new ( ) ;
339+ let codegen = ffmpeg_headers
340+ . iter ( )
341+ . fold ( codegen, |codegen : bindgen:: Builder , path : & & str | -> bindgen:: Builder {
342+ let path: & str = path. clone ( ) ;
343+ let path: PathBuf = source_path. join ( path) ;
344+ let path: & str = path. to_str ( ) . expect ( "PathBuf to str" ) ;
345+ if !PathBuf :: from ( path) . exists ( ) {
346+ missing. push ( String :: from ( path) ) ;
347+ codegen
348+ } else {
349+ codegen. header ( path)
350+ }
351+ } ) ;
352+ if !missing. is_empty ( ) {
353+ panic ! ( "missing headers: {:#?}" , missing) ;
354+ }
355+ // RUN
356+ codegen
357+ . parse_callbacks ( Box :: new ( ignored_macros. clone ( ) ) )
358+ . layout_tests ( false )
359+ . rustfmt_bindings ( true )
360+ . detect_include_paths ( true )
361+ . generate_comments ( true )
362+ . generate ( )
363+ . expect ( "Unable to generate bindings" )
364+ . write_to_file ( out_path. join ( gen_file_name) )
365+ . expect ( "Couldn't write bindings!" ) ;
353366 }
354- // RUN
355- codegen
356- . parse_callbacks ( Box :: new ( ignored_macros. clone ( ) ) )
357- . rustfmt_bindings ( true )
358- . detect_include_paths ( true )
359- . generate_comments ( true )
360- . generate ( )
361- . expect ( "Unable to generate bindings" )
362- . write_to_file ( out_path. join ( gen_file_name) )
363- . expect ( "Couldn't write bindings!" ) ;
364367 }
368+ // DEV - TMP
369+ // {
370+ // let codegen = |file_name: &str, headers: &[&str]| {
371+ // let codegen = bindgen::Builder::default();
372+ // let codegen = headers
373+ // .iter()
374+ // .fold(codegen, |codegen: bindgen::Builder, path: &&str| -> bindgen::Builder {
375+ // let path: &str = path.clone();
376+ // let path: PathBuf = source_path.join(path);
377+ // let path: &str = path.to_str().expect("PathBuf to str");
378+ // assert!(PathBuf::from(path).exists());
379+ // codegen.header(path)
380+ // });
381+ // codegen
382+ // .layout_tests(false)
383+ // .generate_comments(true)
384+ // .generate()
385+ // .expect("Unable to generate bindings")
386+ // .write_to_file(out_path.join(file_name))
387+ // .expect("Couldn't write bindings!");
388+ // };
389+ // codegen("bindings_avcodec.rs", &["libavcodec/avcodec.h"]);
390+ // codegen("bindings_avdevice.rs", &["libavdevice/avdevice.h"]);
391+ // codegen("bindings_avfilter.rs", &["libavfilter/avfilter.h"]);
392+ // codegen("bindings_avformat.rs", &["libavformat/avformat.h"]);
393+ // codegen("bindings_avresample.rs", &["libavresample/avresample.h"]);
394+ // codegen("bindings_avutil.rs", &["libavutil/avutil.h"]);
395+ // codegen("bindings_swresample.rs", &["libswresample/swresample.h"]);
396+ // }
365397}
366398
367399///////////////////////////////////////////////////////////////////////////////
0 commit comments