This is always no_std
.The bindings use libc
for the C type declarations.
Currently only supports the desktop platforms: Windows, Mac, and Linux.
Before Building: Since this crate is about SDL2 bindings, it obviously
requires SDL2. You will need the latest stable version of SDL2 (currently
2.0.9
). Theoretically this crate could be configured for an older version
with minimal effort, but this has not been tested.
Building: There are pre-generated bindings files for common platforms. By
default, with no features enabled, it will pull in the pre-generated bindings
file of the current platform and use that. If this fails, you will need to
generated some bindings yourself using bindgen
.
bindgen
binary
and have this crate run it as a CLI tool, or you can have this crate build
it as a library and run it that way. Either way please see the requirements
page for
information on how to setup bindgen if you don't already have it. Windows
Users: after installing LLVM as instructed you must manually make an
environment variable for LIBCLANG_PATH
pointing to the install directory
that has libclang.dll
(eg: D:\programs\LLVM\bin
).static_link_sdl2_use_with_caution
feature if you would like to staticly link SDL2 instead of the normal
dynamic link.-fPIC
flag.LD_LIBRARY_PATH
list to be searched for the static lib files (which
should find SDL2 just fine).Running: Once you've compiled your program using this library, you'll need to have the SDL2 dynamic library somewhere that the OS can find for your program to run (unless you went with a static link).
SDL2.dll
available. It's also in the lib directory of this
repository.LD_LIBRARY_PATH
to point to an appropriate directory.Shipping: When you're ready to send a program out the door, how should you package SDL2 along with your program? Well, it depends.
SDL2.dll
file along side
your program.exe
. DLL loading starts by checking the same directory as the
executable, so it's sure to find the correct DLL that way. If the user
really needs to they can replace the DLL later. Having one copy of
SDL2.dll
per program isn't a huge deal, it's only about 1.4 megabytes.This crate uses the Zlib license (the same license that SDL2 itself uses).