feat: use CMake and SDL3

Based on: https://github.com/Ravbug/sdl3-sample
This commit is contained in:
Martin Prokoph
2025-02-28 18:23:23 +01:00
parent d46a0324a8
commit 071867674f
26 changed files with 1323 additions and 33 deletions

18
config/README.md Normal file
View File

@@ -0,0 +1,18 @@
# How to use these scripts
For the most part, just run the scripts in this directory from this directory.
## Notes:
- visionOS
- Requires CMake 3.28 or newer
- Web
1. Install emsdk somewhere.
2. On Windows hosts, run `config-web-win.bat` via the `emcmdprompt.bat` cmd in the emsdk root directory
3. On Unix hosts, first run `source emsdk_env.sh` (found in the emsdk root directory), then run `config-web-unix.sh`
4. After the build completes, use `python3 -m http.server` in the build directory to make the page accessible.
- Android
- There is no easy CMake config for this platform. Instead, follow the steps as outlined below. See the android GitHub action for more details.
1. Install Android Studio + NDK from https://developer.android.com/studio
2. Copy `build.gradle` to `SDL/android-project/app/`. If you look inside `build.gradle`, you'll see `"../../../CMakeLists.txt"` as the path to the CMakeLists file. This points to the CMakeLists in this repo's root directory after it is copied.
3. `cd SDL/android-project/`
4. `./gradlew assembleDebug`. You'll get an apk which you can then install onto a device.

4
config/config-generic.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd "${0%/*}"/
cmake -B "../build/`uname`" -S ..

4
config/config-ios-xcode.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd "${0%/*}"
cmake -G "Xcode" -DCMAKE_SYSTEM_NAME="iOS" -B ../build/ios -S ..

4
config/config-mac-xcode.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd "${0%/*}"
cmake -G "Xcode" -B ../build/mac -S ..

4
config/config-tvos-xcode.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd "${0%/*}"
cmake -G "Xcode" -DCMAKE_SYSTEM_NAME="tvOS" -B ../build/tvos -S ..

View File

@@ -0,0 +1,7 @@
#!/bin/bash
# note: requires CMake 3.28 or newer
cd "${0%/*}"
cmake -G "Xcode" -DCMAKE_SYSTEM_NAME="visionOS" -S .. -B ../build/visionOS

4
config/config-web-unix.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd "${0%/*}"
emcmake cmake -S .. -B ../build/web

View File

@@ -0,0 +1,3 @@
@echo OFF
emcmake cmake -S .. -B ..\build\web

3
config/config-win.bat Normal file
View File

@@ -0,0 +1,3 @@
@echo OFF
cmake -S .. -B ..\build\win