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

Added sdl2_bundled and sdl2_static_link features #33

Merged

Conversation

@VictorKoenders
Copy link
Contributor

VictorKoenders commented Dec 14, 2018

SDL2 has a nice feature called "bundled": https://github.com/Rust-SDL2/rust-sdl2#bundled-feature

Since 0.31, this crate supports a feature named "bundled" which downloads SDL2 from source, compiles it and links it automatically. While this should work for any architecture, you will need a C compiler (like gcc, clang, or MS's own compiler) to use this feature properly.

In addition, for my games I also link things statically. SDL2 has a feature for that called "static-link":

Static linking with MinGW
If you want to use the static-link feature with the windows-gnu toolchain, then you will also need the following libraries:

libimm32.a
libversion.a
libdinput8.a
libdxguid.a
These files are not currently included with the windows-gnu toolchain, but can be downloaded here. For the x86_64 toolchain, you want the x86_64-win32-seh package, and for i686 you want the i686-win32-dwarf one.

You will find the aforementioned libraries under mingw64/x86_64-w64-mingw32/lib/ (for x86_64) or mingw32/i686-w64-mingw32/lib/ (for i686). Copy them to your toolchain's lib directory (the same one you copied the SDL .a files to).
Static linking with MSVC
The MSVC development libraries provided by http://libsdl.org/ don't include a static library. This means that if you want to use the static-link feature with the windows-msvc toolchain, you have to either

build an SDL2 static library yourself and copy it to your toolchain's lib directory; or
also enable the bundled feature, which will build a static library for you.
@17cupsofcoffee

This comment has been minimized.

Copy link
Owner

17cupsofcoffee commented Dec 14, 2018

Cool! I was avoiding turning these on by default, as it sounds like they have their own set of tradeoffs (the less CMake in my life, the better 😅), but I see absolutely no harm in making the features available if people want them.

@17cupsofcoffee 17cupsofcoffee merged commit 0339ea1 into 17cupsofcoffee:master Dec 14, 2018
VictorKoenders added a commit to VictorKoenders/tetra that referenced this pull request Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.