-
Notifications
You must be signed in to change notification settings - Fork 476
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
Support "bundled", "bindgen" and opt-in static linking #720
Conversation
Allows statically linking to a self-contained build of SDL2.
* Also supports opt-in static linking
sdl2-sys/build.rs
Outdated
#[cfg(feature = "static-link")] | ||
fn get_pkg_config() -> pkg_config::Library { | ||
pkg_config::Config::new() | ||
.statik(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems backwards (as does the non-static version a few lines down from here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, good catch! I don't think it affects anything though, because it still worked for me with this on linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll still build, but you pass static-link
it'll build a dynamic version, and without static-link
it'll build a static version.
I was able to build each of those feature combos on Mac. 👍 |
Thanks for the help! Do you think you will be able to test that for iOS as well? |
Sooo... iOS is going not work with most of these features:
|
I at least expected it to work with bindgen as well, would you mind giving us the error you got? Maybe it can be useful in the future or someone can have a look at it and find a solution. |
|
Got this error when trying to use bindgen on msvc:
Looks like this is a bug with bindgen so I'm oing to drop support of this platform for bindgen only (everything else but pkg-config works). I'm still looking for someone to support using bindgen with windows-gnu. @dariost would you mind helping with that? |
Testing on Windows 10 x64 using rustc 1.21 and MSVC.
pkg-config and bindgen features don't appear to exist on this platform. All I did was |
I tested with msvc as well and bindgen can work if clang is installed, but even still it doesn't work because of the error that I had just before your post. i'm dropping bindgen support for msvc, the pregenerated bindings will have to do! (which they probably will). |
I wanted support for windows-gnu but no one's up for the task, but I guess we can still merge for those who need these features on everything but windows-gnu. Good work everyone! |
This is a follow up on the unmerged PR693.
The build.rs file in sdl2-sys has been totally overhauled. The "bindgen" feature is now smart enough o use the headers directly from the source if "bundled" is specified. Likewise, the library is compiled dynamically or statically (and linked as well), whether or not the feature "static-link" is enabled.
Currently been tested on:
PS: If someone has a clue of what's happening with travis, I'd be glad.