This package contains the bindings for SDL2 to Nim.
You must install the SDL2 C libraries before these Nim bindings can be used.
If you don't already have Homebrew installed, install it from the Homebrew site.
Install the SDL2 C libraries:
brew install sdl2{,_gfx,_image,_mixer,_net,_ttf}
If you don't already have Macports installed, install it from the Macports site.
sudo port install libsdl2 libsdl2_gfx libsdl2_image libsdl2_mixer libsdl2_ttf libsdl2_net
Install SDL2 development libraries using your distribution's packaging tool of choice.
Using SDL2 with mingw-w64 environment
- Install mingw-w64-builds. Check that
x86_64-w64-mingw32\bin\
from the installed mingw toolchain is in yourPATH
variable. - Download SDL2 Development Libraries for MinGW
- Extract contents of the downloaded archive to your mingw-w64 folder (for example,
SDL2-2.0.12\x86_64-w64-mingw32\
tomingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32\
)
Pass the following options to nim on compilation:
--dynlibOverride:libSDL2 --passL:"-static -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid"
Options for the linker (--passL:
) except -static
are taken from sdl2-config.cmake
which is included in SDL2 Development Libraries.
Add requires "sdl2"
to your .nimble
file.
You can also install manually with nimble install sdl2
if your project does not yet have a nimble package file.
For more information on using nimble, consult the nim documentation.
For documentation about SDL2 see wiki.libsdl.org.