Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor refactorings for build.rs #1430

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 10 additions & 26 deletions sdl2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,11 @@ fn main() {

#[cfg(feature = "bindgen")]
{
let include_paths: Vec<String>;
#[cfg(feature = "bundled")]
{
include_paths = vec![sdl2_includes];
}
#[cfg(not(feature = "bundled"))]
{
include_paths = compute_include_paths(sdl2_includes)
}
let include_paths: Vec<String> = if cfg!(feature = "bundled") {
vec![sdl2_includes]
} else {
compute_include_paths(sdl2_includes)
};
generate_bindings(target.as_str(), host.as_str(), include_paths.as_slice());
println!("cargo:include={}", include_paths.join(":"));
}
Expand Down Expand Up @@ -663,26 +659,14 @@ fn generate_bindings(target: &str, host: &str, headers_paths: &[String]) {
.raw_line("use crate::*;")
.ctypes_prefix("libc");

let mut ttf_bindings = bindgen::Builder::default()
.use_core()
.raw_line("use crate::*;")
.ctypes_prefix("libc");
let mut ttf_bindings = image_bindings.clone();

let mut mixer_bindings = bindgen::Builder::default()
.use_core()
.raw_line("use crate::*;")
.ctypes_prefix("libc");
let mut mixer_bindings = image_bindings.clone();

let mut gfx_framerate_bindings = bindgen::Builder::default().use_core().ctypes_prefix("libc");
let mut gfx_primitives_bindings = bindgen::Builder::default()
.use_core()
.raw_line("use crate::*;")
.ctypes_prefix("libc");
let mut gfx_imagefilter_bindings = bindgen::Builder::default().use_core().ctypes_prefix("libc");
let mut gfx_rotozoom_bindings = bindgen::Builder::default()
.use_core()
.raw_line("use crate::*;")
.ctypes_prefix("libc");
let mut gfx_primitives_bindings = image_bindings.clone();
let mut gfx_imagefilter_bindings = gfx_framerate_bindings.clone();
let mut gfx_rotozoom_bindings = gfx_primitives_bindings.clone();

// Set correct target triple for bindgen when cross-compiling
if target != host {
Expand Down
Loading