-
Notifications
You must be signed in to change notification settings - Fork 472
Target specific bindings + refactor generate_bindings, clean, update remaining bindings #1516
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
base: master
Are you sure you want to change the base?
Conversation
clean gfx, image, mixer and ttf now, sdl_bindings.rs has been done already
…ecific bindings dirs
need edition 2021 for panic message formatting
extern crate statements are not needed anymore, cfg_if was unused, remove unused import
|
For review: please look at the TODO questions (with the checkboxes) too |
|
I am not against the idea but what does this specifically solve? Current bindings are generated for linux and 99% of users will never know the difference if it was generated for windows or something else. The only exception is when using platform-specific stuff such as |
I dont use windows, but on master currently all windows tests fail because of a layout incompatibility found by bindgen (the generated layout tests) on windows (example). This PR fixes this, but can be overkill. I dont expect a layout incompatibility because primitive types have the same layout on linux as on windows.
Agreed. Does this crate currently build on windows? |
It does, but not with default features. I use this in my sdl2 = { git = "https://github.com/Rust-SDL2/rust-sdl2.git", features = [
"static-link",
"bundled",
"use-bindgen",
] }Without bindgen, all the X11 types and SDL types that include X11 types fail layout checks. As far as I can tell, there is no reasonable way to solve this without target specific bindings or bindgen. Though, why not use bindgen by default? Edit cfg_if! {
if #[cfg(all(target_pointer_width = "64", not(windows)))] {
pub type c_long = i64;
pub type c_ulong = u64;
} else {
// The minimal size of `long` in the C standard is 32 bits
pub type c_long = i32;
pub type c_ulong = u32;
}
} |
fixes #1511
If pregenerated bindings are not available for the target this error is printed (temporarily removed them to test):
Only 2 CI checks fail now instead of the 6 on master currently, those 2 that fail is related to vcpkg and not on linux, so maybe someone else has some insights on how to fix that.
The diff of locally found bindings and generated ones is dumped in the CI logs, from there I git applied it, worked pretty well :).
TODO: