@@ -279,17 +279,29 @@ fn main() {
279
279
fn copy_pregenerated_bindings ( ) {
280
280
let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
281
281
let crate_path = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
282
- fs:: copy ( crate_path. join ( "pregenerated_bindings .rs" ) , out_path. join ( "bindings .rs" ) )
282
+ fs:: copy ( crate_path. join ( "sdl_bindings .rs" ) , out_path. join ( "sdl_bindings .rs" ) )
283
283
. expect ( "Couldn't find pregenerated bindings!" ) ;
284
284
285
- fs:: copy ( crate_path. join ( "sdl_image_bindings.rs" ) , out_path. join ( "image_bindings .rs" ) )
285
+ fs:: copy ( crate_path. join ( "sdl_image_bindings.rs" ) , out_path. join ( "sdl_image_bindings .rs" ) )
286
286
. expect ( "Couldn't find pregenerated SDL_image bindings!" ) ;
287
287
288
- fs:: copy ( crate_path. join ( "sdl_ttf_bindings.rs" ) , out_path. join ( "ttf_bindings .rs" ) )
288
+ fs:: copy ( crate_path. join ( "sdl_ttf_bindings.rs" ) , out_path. join ( "sdl_ttf_bindings .rs" ) )
289
289
. expect ( "Couldn't find pregenerated SDL_ttf bindings!" ) ;
290
290
291
- fs:: copy ( crate_path. join ( "sdl_mixer_bindings.rs" ) , out_path. join ( "mixer_bindings .rs" ) )
291
+ fs:: copy ( crate_path. join ( "sdl_mixer_bindings.rs" ) , out_path. join ( "sdl_mixer_bindings .rs" ) )
292
292
. expect ( "Couldn't find pregenerated SDL_mixer bindings!" ) ;
293
+
294
+ fs:: copy ( crate_path. join ( "sdl_gfx_framerate_bindings.rs" ) , out_path. join ( "sdl_gfx_framerate_bindings.rs" ) )
295
+ . expect ( "Couldn't find pregenerated SDL_gfx framerate bindings!" ) ;
296
+
297
+ fs:: copy ( crate_path. join ( "sdl_gfx_primitives_bindings.rs" ) , out_path. join ( "sdl_gfx_primitives_bindings.rs" ) )
298
+ . expect ( "Couldn't find pregenerated SDL_gfx primitives bindings!" ) ;
299
+
300
+ fs:: copy ( crate_path. join ( "sdl_gfx_imagefilter_bindings.rs" ) , out_path. join ( "sdl_gfx_imagefilter_bindings.rs" ) )
301
+ . expect ( "Couldn't find pregenerated SDL_gfx imagefilter bindings!" ) ;
302
+
303
+ fs:: copy ( crate_path. join ( "sdl_gfx_rotozoom_bindings.rs" ) , out_path. join ( "sdl_gfx_rotozoom_bindings.rs" ) )
304
+ . expect ( "Couldn't find pregenerated SDL_gfx rotozoom bindings!" ) ;
293
305
}
294
306
295
307
#[ cfg( feature = "bindgen" ) ]
@@ -301,6 +313,10 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
301
313
let mut image_bindings = bindgen:: Builder :: default ( ) ;
302
314
let mut ttf_bindings = bindgen:: Builder :: default ( ) ;
303
315
let mut mixer_bindings = bindgen:: Builder :: default ( ) ;
316
+ let mut gfx_framerate_bindings = bindgen:: Builder :: default ( ) ;
317
+ let mut gfx_primitives_bindings = bindgen:: Builder :: default ( ) ;
318
+ let mut gfx_imagefilter_bindings = bindgen:: Builder :: default ( ) ;
319
+ let mut gfx_rotozoom_bindings = bindgen:: Builder :: default ( ) ;
304
320
305
321
// Set correct target triple for bindgen when cross-compiling
306
322
if target != host {
@@ -315,6 +331,18 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
315
331
316
332
mixer_bindings = mixer_bindings. clang_arg ( "-target" ) ;
317
333
mixer_bindings = mixer_bindings. clang_arg ( target. clone ( ) ) ;
334
+
335
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( "-target" ) ;
336
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( target. clone ( ) ) ;
337
+
338
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( "-target" ) ;
339
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( target. clone ( ) ) ;
340
+
341
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( "-target" ) ;
342
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( target. clone ( ) ) ;
343
+
344
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( "-target" ) ;
345
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( target. clone ( ) ) ;
318
346
}
319
347
320
348
if headers_paths. len ( ) == 0 {
@@ -326,13 +354,21 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
326
354
image_bindings = image_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
327
355
ttf_bindings = ttf_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
328
356
mixer_bindings = mixer_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
357
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
358
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
359
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
360
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-I{}" , include_path. display( ) ) ) ;
329
361
} else {
330
362
// if paths are included, use them for bindgen. Bindgen should use the first one.
331
363
for headers_path in headers_paths {
332
364
bindings = bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
333
365
image_bindings = image_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
334
366
ttf_bindings = ttf_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
335
367
mixer_bindings = mixer_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
368
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
369
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
370
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
371
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-I{}" , headers_path. as_ref( ) ) ) ;
336
372
}
337
373
}
338
374
@@ -360,6 +396,30 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
360
396
mixer_bindings = mixer_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" ) ) ;
361
397
mixer_bindings = mixer_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" ) ) ;
362
398
mixer_bindings = mixer_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/um" ) ) ;
399
+
400
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/shared" ) ) ;
401
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-IC:/Program Files/LLVM/lib/clang/5.0.0/include" ) ) ;
402
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" ) ) ;
403
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" ) ) ;
404
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/um" ) ) ;
405
+
406
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/shared" ) ) ;
407
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-IC:/Program Files/LLVM/lib/clang/5.0.0/include" ) ) ;
408
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" ) ) ;
409
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" ) ) ;
410
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/um" ) ) ;
411
+
412
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/shared" ) ) ;
413
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-IC:/Program Files/LLVM/lib/clang/5.0.0/include" ) ) ;
414
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" ) ) ;
415
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" ) ) ;
416
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/um" ) ) ;
417
+
418
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/shared" ) ) ;
419
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-IC:/Program Files/LLVM/lib/clang/5.0.0/include" ) ) ;
420
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" ) ) ;
421
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" ) ) ;
422
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( format ! ( "-IC:/Program Files (x86)/Windows Kits/8.1/Include/um" ) ) ;
363
423
} ;
364
424
365
425
// SDL2 hasn't a default configuration for Linux
@@ -372,6 +432,14 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
372
432
ttf_bindings = ttf_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_WAYLAND" ) ;
373
433
mixer_bindings = mixer_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_X11" ) ;
374
434
mixer_bindings = mixer_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_WAYLAND" ) ;
435
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_X11" ) ;
436
+ gfx_framerate_bindings = gfx_framerate_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_WAYLAND" ) ;
437
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_X11" ) ;
438
+ gfx_primitives_bindings = gfx_primitives_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_WAYLAND" ) ;
439
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_X11" ) ;
440
+ gfx_imagefilter_bindings = gfx_imagefilter_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_WAYLAND" ) ;
441
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_X11" ) ;
442
+ gfx_rotozoom_bindings = gfx_rotozoom_bindings. clang_arg ( "-DSDL_VIDEO_DRIVER_WAYLAND" ) ;
375
443
}
376
444
377
445
let bindings = bindings
@@ -384,7 +452,7 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
384
452
let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
385
453
386
454
bindings
387
- . write_to_file ( out_path. join ( "bindings .rs" ) )
455
+ . write_to_file ( out_path. join ( "sdl_bindings .rs" ) )
388
456
. expect ( "Couldn't write bindings!" ) ;
389
457
390
458
let image_bindings = image_bindings
@@ -401,7 +469,7 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
401
469
let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
402
470
403
471
image_bindings
404
- . write_to_file ( out_path. join ( "image_bindings .rs" ) )
472
+ . write_to_file ( out_path. join ( "sdl_image_bindings .rs" ) )
405
473
. expect ( "Couldn't write image_bindings!" ) ;
406
474
407
475
let ttf_bindings = ttf_bindings
@@ -417,7 +485,7 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
417
485
let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
418
486
419
487
ttf_bindings
420
- . write_to_file ( out_path. join ( "ttf_bindings .rs" ) )
488
+ . write_to_file ( out_path. join ( "sdl_ttf_bindings .rs" ) )
421
489
. expect ( "Couldn't write ttf_bindings!" ) ;
422
490
423
491
let mixer_bindings = mixer_bindings
@@ -436,8 +504,84 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
436
504
let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
437
505
438
506
mixer_bindings
439
- . write_to_file ( out_path. join ( "mixer_bindings .rs" ) )
507
+ . write_to_file ( out_path. join ( "sdl_mixer_bindings .rs" ) )
440
508
. expect ( "Couldn't write mixer_bindings!" ) ;
509
+
510
+ let gfx_framerate_bindings = gfx_framerate_bindings
511
+ . header ( "wrapper_gfx_framerate.h" )
512
+ . whitelist_type ( "FPS.*" )
513
+ . whitelist_function ( "SDL_.*rame.*" )
514
+ . whitelist_var ( "FPS.*" )
515
+ . blacklist_type ( "_IO.*|FILE" )
516
+ . generate ( )
517
+ . expect ( "Unable to generate gfx_framerate_bindings!" ) ;
518
+
519
+ let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
520
+
521
+ gfx_framerate_bindings
522
+ . write_to_file ( out_path. join ( "sdl_gfx_framerate_bindings.rs" ) )
523
+ . expect ( "Couldn't write gfx_framerate_bindings!" ) ;
524
+
525
+ let gfx_primitives_bindings = gfx_primitives_bindings
526
+ . header ( "wrapper_gfx_primitives.h" )
527
+ . blacklist_type ( "SDL_.*" )
528
+ . whitelist_function ( "pixel.*" )
529
+ . whitelist_function ( "rectangle.*" )
530
+ . whitelist_function ( "rounded.*" )
531
+ . whitelist_function ( "box.*" )
532
+ . whitelist_function ( ".*line(Color|RGBA).*" )
533
+ . whitelist_function ( "thick.*" )
534
+ . whitelist_function ( ".*circle.*" )
535
+ . whitelist_function ( "arc.*" )
536
+ . whitelist_function ( "filled.*" )
537
+ . whitelist_function ( ".*ellipse.*" )
538
+ . whitelist_function ( "pie.*" )
539
+ . whitelist_function ( ".*trigon.*" )
540
+ . whitelist_function ( ".*polygon.*" )
541
+ . whitelist_function ( "textured.*" )
542
+ . whitelist_function ( "bezier.*" )
543
+ . whitelist_function ( "character.*" )
544
+ . whitelist_function ( "string.*" )
545
+ . whitelist_function ( "gfx.*" )
546
+ . blacklist_type ( "_IO.*|FILE" )
547
+ . generate ( )
548
+ . expect ( "Unable to generate gfx_primitives_bindings!" ) ;
549
+
550
+ let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
551
+
552
+ gfx_primitives_bindings
553
+ . write_to_file ( out_path. join ( "sdl_gfx_primitives_bindings.rs" ) )
554
+ . expect ( "Couldn't write gfx_primitives_bindings!" ) ;
555
+
556
+ let gfx_imagefilter_bindings = gfx_imagefilter_bindings
557
+ . header ( "wrapper_gfx_imagefilter.h" )
558
+ . whitelist_function ( "SDL_image.*" )
559
+ . blacklist_type ( "_IO.*|FILE" )
560
+ . generate ( )
561
+ . expect ( "Unable to generate gfx_imagefilter_bindings!" ) ;
562
+
563
+ let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
564
+
565
+ gfx_imagefilter_bindings
566
+ . write_to_file ( out_path. join ( "sdl_gfx_imagefilter_bindings.rs" ) )
567
+ . expect ( "Couldn't write gfx_imagefilter_bindings!" ) ;
568
+
569
+ let gfx_rotozoom_bindings = gfx_rotozoom_bindings
570
+ . header ( "wrapper_gfx_rotozoom.h" )
571
+ . blacklist_type ( "SDL_.*" )
572
+ . whitelist_function ( "rotozoom.*" )
573
+ . whitelist_function ( "zoom.*" )
574
+ . whitelist_function ( "shrink.*" )
575
+ . whitelist_function ( "rotate.*" )
576
+ . blacklist_type ( "_IO.*|FILE" )
577
+ . generate ( )
578
+ . expect ( "Unable to generate gfx_rotozoom_bindings!" ) ;
579
+
580
+ let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
581
+
582
+ gfx_rotozoom_bindings
583
+ . write_to_file ( out_path. join ( "sdl_gfx_rotozoom_bindings.rs" ) )
584
+ . expect ( "Couldn't write gfx_rotozoom_bindings!" ) ;
441
585
}
442
586
443
587
fn get_os_from_triple ( triple : & str ) -> Option < & str >
0 commit comments