10

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"?

vinnylinux
  • 7,050
  • 13
  • 61
  • 127

2 Answers2

3

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.

Fred4106
  • 105
  • 1
  • 1
  • 8
alexdantas
  • 626
  • 1
  • 7
  • 13
2

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.

Darius Makaitis
  • 880
  • 1
  • 5
  • 5