I'm looking for a "Hello World" SDL 2.0 project that cross-compiles between all supported platforms: Windows, Linux, Mac, Android and iOS. Is there anything like that? I could not find on the official forums or docs.
What tools are recommended? CMake or SCons? Can it be done with just "make"?
Don't know if that's exactly what you're looking for, but I've just made a small tutorial on how to cross-compile SDL2 projects from Linux to Windows. Dead Link
Basically, install MinGW and set your compilation flags to the following (Makefile
example):
# Where your MinGW SDL is installed
SDL_ROOT_DIR = /usr/x86_64-w64-mingw32
CFLAGS = `$(SDL_ROOT_DIR)/bin/sdl2-config --cflags`
-Wall -Wextra
CXXFLAGS = `$(SDL_ROOT_DIR)/bin/sdl2-config --cflags`
-Wall -Wextra
LDFLAGS = `$(SDL_ROOT_DIR)/bin/sdl2-config --libs` \
-lSDL2_image -lSDL2_ttf -lSDL2_mixer -lSDL2_gfx \
-static-libgcc -static-libstdc++
In-depth explanations here and here.
If you download the source for SDL2, there are a number of short example programs that compile on all supported platforms in the "test" directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With