- Notifications
You must be signed in to change notification settings - Fork21
Minimal HowTo for building and using SDL3 on a variety of platforms, including mobile and web. Also includes SDL_mixer, SDL_Image, and SDL_ttf!
Ravbug/sdl3-sample
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a minimal example for building and using SDL3, SDL_Mixer, SDL_Image, and SDL_ttf_ from sourceusing C++ and CMake. It also demonstrates setting up things like macOS/iOSbundles.Seesrc/main.cpp for the code.
Are you a complete beginner? If so, readthis!Otherwise, install CMake and your favorite compiler, and follow the commands below:
# You need to clone with submodules, otherwise SDL will not download.git clone https://github.com/Ravbug/sdl3-sample --depth=1 --recurse-submodulescd sdl3-samplecmake -S. -B build
You can also use an init script insideconfig/
. Then open the IDE project insidebuild/
(If you had CMake generate one) and run!
I have tested the following:
Platform | Architecture | Generator |
---|---|---|
macOS | x86_64, arm64 | Xcode |
iOS | x86_64, arm64 | Xcode |
tvOS | x86_64, arm64 | Xcode |
visionOS* | arm64 | Xcode |
Windows | x86_64, arm64 | Visual Studio |
Linux | x86_64, arm64 | Ninja, Make |
Web* | wasm | Ninja, Make |
Android* | x86, x64, arm, arm64 | Ninja via Android Studio |
*See further instructions inconfig/
Note: UWP support wasremoved from SDL3 during its development. For historical reasons, you can get a working UWP sample via this commit:df270da
Just update the submodule:
cd SDLgit pullcd ..cd SDL_ttfgit pull
You don't need to use a submodule, you can also copy the source in directly. Thisrepository uses a submodule to keep its size to a minimum.
Is something not working? Create an Issue or send a Pull Request on this repository!
About
Minimal HowTo for building and using SDL3 on a variety of platforms, including mobile and web. Also includes SDL_mixer, SDL_Image, and SDL_ttf!