Build System
Mobile Eggbert uses CMake 3.21+ as its build system. All four target platforms share the same CMakeLists.txt; platform-specific behaviour is enabled through CMake flags.
Prerequisites
| Tool | Purpose | Minimum Version |
|---|---|---|
| CMake | Build system generator | 3.21 |
| GCC or Clang | C++23 compiler (Linux/macOS) | GCC 13 / Clang 16 |
| MinGW-w64 | Windows cross-compilation from Linux | x86_64-w64-mingw32 |
| Emscripten SDK | WebAssembly build | 3.1+ |
| Android NDK | Android native build | 28.2.13676358 |
| Gradle | Android APK packaging | 8.4+ |
| SDL3 | Window, input, rendering (via CNA) | 3.x |
| SDL3_image | PNG loading (via CNA) | 3.x |
| SDL3_mixer | Audio mixing (via CNA) | 3.x |
Initialize Submodules
CNA and SharpRuntime are Git submodules. Run this once after cloning:
git submodule update --init --recursive
Linux Build
The recommended development target. Uses the EasyGL (OpenGL) backend by default.
# Configure
cmake -S . -B cmake-build-debug \
-DCMAKE_BUILD_TYPE=Debug
# Build
cmake --build cmake-build-debug --target WindowsPhoneSpeedyBlupi
# Run
./cmake-build-debug/WindowsPhoneSpeedyBlupi
To explicitly choose the SDL_Renderer backend:
cmake -S . -B build-linux \
-DCNA_BACKEND_SDL_RENDERER=ON \
-DCNA_BACKEND_EASY_GL=OFF \
-DCNA_BACKEND_BGFX=OFF
cmake --build build-linux --target WindowsPhoneSpeedyBlupi
Rendering Backends
Exactly one rendering backend must be active at build time. Set via CMake flags:
| CMake Flag | Backend | Recommended For |
|---|---|---|
| CNA_BACKEND_EASY_GL=ON | easy-gl (lightweight OpenGL) | Desktop (default) |
| CNA_BACKEND_SDL_RENDERER=ON | SDL_Renderer | Emscripten, Android, compatibility |
| CNA_BACKEND_BGFX=ON | bgfx (multi-API) | Desktop, multi-GPU |
| Vulkan | Vulkan | Desktop high-performance build |
cmake-build-vulkan preset.
Web / Emscripten Build
Produces a .html + .wasm + .js bundle that runs in any modern browser.
# Activate Emscripten SDK (adjust path)
source /path/to/emsdk/emsdk_env.sh
# Configure with Emscripten cmake wrapper
emcmake cmake -S . -B cmake-build-web -DCMAKE_BUILD_TYPE=Debug
# Build
cmake --build cmake-build-web
# Run in browser (starts a local HTTP server)
emrun cmake-build-web/WindowsPhoneSpeedyBlupi.html
Emscripten-specific Settings
These flags are automatically set by CMakeLists.txt when building for Emscripten:
| Linker Flag | Value | Effect |
|---|---|---|
| ALLOW_MEMORY_GROWTH | 1 | Heap can grow dynamically at runtime |
| INITIAL_MEMORY | 134 MB | Starting heap allocation |
| --preload-file Content | — | Game assets embedded in .data file |
| --preload-file worlds | — | Level files embedded |
Virtual filesystem mount points accessible from C++ code:
/Content/backgrounds/— level backgrounds/Content/icons/— sprite sheets/Content/sounds/— WAV files/worlds/— level text files
Android Build
The android/ directory contains a Gradle project that wraps the native build.
cd android
./gradlew assembleDebug
# Install to connected device or emulator
adb install app/build/outputs/apk/debug/app-debug.apk
# Launch
adb shell am start -n org.openeggbert.speedyblupi/.SpeedyBlupiActivity
Android Configuration
| Setting | Value |
|---|---|
| NDK version | 28.2.13676358 |
| Target API level | 35 (Android 15) |
| Asset access | AAssetManager (assets packaged in APK) |
| Rendering backend | SDL_Renderer (auto-selected for Android) |
Windows Build (Cross-compile from Linux)
Uses MinGW-w64 to produce a native Windows x86_64 executable. See WINDOWS.md in the repo root for full details.
cmake -S . -B cmake-build-win \
-DCMAKE_TOOLCHAIN_FILE=cmake/mingw-toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake-build-win --target WindowsPhoneSpeedyBlupi
The C++ runtime can be linked either dynamically (default) or statically via -static-libgcc -static-libstdc++.
Asset Layout per Platform
| Platform | Content location | How accessed |
|---|---|---|
| Linux / Windows | Content/ copied next to executable | Standard file I/O |
| Emscripten | Preloaded into virtual FS at link time | /Content/ virtual path |
| Android | Packaged as APK assets | AAssetManager API |
Runtime DLLs (Windows only)
The following DLLs must be present alongside the executable on Windows (CMake copies them automatically):
SDL3.dllSDL3_image.dllSDL3_mixer.dlllibwinpthread-1.dll
Alternatively, link statically with -static-libgcc -static-libstdc++ to avoid the libwinpthread dependency.