Easy-to-use unified build automation for all platforms.
One command to configure, build, test, and run the Caffeine Engine on Windows, macOS, and Linux.
./caffeine-build # Debug build
./caffeine-build build --release # Release build
./caffeine-build rebuild --release # Full rebuild
./caffeine-build test # Run tests
./caffeine-build run # Execute game.\caffeine-build # Debug build
.\caffeine-build build --release # Release build
.\caffeine-build rebuild --release # Full rebuild
.\caffeine-build test # Run tests
.\caffeine-build run # Execute gameBuilds the project with automatic configuration if needed.
./caffeine-build build # Build Debug
./caffeine-build build --release # Build Release
./caffeine-build build --release --jobs 8 # Custom parallel jobsWhat it does:
- Checks CMake configuration (runs
configif not configured) - Compiles with parallel jobs (auto-detected CPU cores)
- Lists built artifacts
Exit codes:
0= Success1= Build failed
Sets up CMake configuration without building.
./caffeine-build config # Debug config
./caffeine-build config --release # Release config
./caffeine-build config --headless # Headless (no graphics)
./caffeine-build config --scripting # Enable Lua scripting
./caffeine-build config --release --headless # Combined optionsOptions:
--debug- Debug mode with symbols (default)--release- Release mode with optimizations--headless- Build without SDL3/graphics (server/CI mode)--scripting- Enable Lua scripting support
Full rebuild from scratch.
./caffeine-build rebuild # Full Debug rebuild
./caffeine-build rebuild --release # Full Release rebuild
./caffeine-build rebuild --release --headless # Full Release headless rebuildWhat it does:
- Removes all build artifacts (
build/andbin/) - Runs CMake configuration
- Builds project
Use this when:
- You've changed CMakeLists.txt
- Build is broken and needs fresh start
- You're switching between Debug/Release
Executes all unit tests.
./caffeine-build test # Run tests (auto-builds if needed)
./caffeine-build build && ./caffeine-build test # Build then testWhat it does:
- Verifies build directory exists
- Runs CTest with parallel execution
- Reports success/failure
Exit codes:
0= All tests passed1= One or more tests failed
Launches the built game/editor executable.
./caffeine-build run # Run Release binary if exists, else DebugWhat it does:
- Searches for built executable in standard locations
- Launches with same working directory
Searches:
./bin/caffeine-combined./build/apps/doppio/caffeine-combined./build/bin/caffeine-combined- Full
./build/recursion as fallback
Deletes all build outputs.
./caffeine-build clean # Remove build/ and bin/Removes:
./build/- CMake build directory./bin/- Binary directory
Use this when:
- You want to free disk space
- Build is corrupted
- Switching major build options
Displays command reference and examples.
./caffeine-build help
./caffeine-build --help
./caffeine-build -hThese options can be combined with any command:
./caffeine-build [command] [options]Build in debug mode with full symbols.
./caffeine-build build --debug
./caffeine-build rebuild --debugBuild in release mode with optimizations.
./caffeine-build build --release
./caffeine-build rebuild --releaseBuild without SDL3/graphics (server/CI mode).
./caffeine-build config --headless
./caffeine-build rebuild --headlessEnable Lua scripting support.
./caffeine-build config --scripting
./caffeine-build build --scriptingClean build artifacts before building.
./caffeine-build build --clean # Same as: clean && build
./caffeine-build build --release --clean # Release rebuildUse N parallel compilation jobs.
./caffeine-build build --jobs 8 # Use 8 cores
./caffeine-build rebuild --jobs 4 # Use 4 coresDefault: Auto-detected from CPU count
./caffeine-build rebuild./caffeine-build build && ./caffeine-build test./caffeine-build rebuild --release./caffeine-build build && ./caffeine-build run./caffeine-build clean # Start fresh
./caffeine-build build # Build Debug
./caffeine-build test # Run tests
./caffeine-build run # Execute game./caffeine-build rebuild --headless --release./caffeine-build build && ./caffeine-build test && ./caffeine-build runcaffeine/
├── caffeine-build # Unix/macOS build script (executable)
├── caffeine-build.bat # Windows build script
├── build/ # CMake build directory (created)
│ ├── CMakeCache.txt
│ ├── Makefile
│ ├── compile_commands.json
│ └── tests/
├── bin/ # Built binaries (created)
│ └── caffeine-combined # Main executable
├── src/ # Source code
├── tests/ # Test suite
├── docs/
│ └── building.md # Detailed build documentation
└── scripts/
├── README.md # Legacy scripts reference
├── build.sh # Original shell script
├── build_manager.py # Build manager library
└── version_manager.py # Version tracking
Linux/macOS:
bashshellpython3(optional, for extra features)ctest(part of CMake)
Windows:
- PowerShell 5.0+ OR Command Prompt
- Visual Studio 2022 (with C++ workload) OR
- MSVC compiler via command line
- SDL3 - For graphics (disable with
--headless) - Lua 5.3+ - For scripting (enable with
--scripting) - ImGui - For editor UI (included)
chmod +x caffeine-buildTo use from anywhere:
Linux/macOS:
# Copy to global location
sudo cp caffeine-build /usr/local/bin/
# Then use from anywhere:
caffeine-build build --releaseWindows:
REM Add project directory to PATH environment variable
REM Or run from project root: .\caffeine-buildInstall CMake:
# macOS
brew install cmake
# Linux
apt-get install cmake
# Windows
choco install cmake
# OR download from https://cmake.org/download/Make script executable:
chmod +x caffeine-buildEither:
- Install SDL3:
brew install sdl3(macOS) - Use headless mode:
./caffeine-build rebuild --headless
Some build features require Python 3:
# macOS
brew install python3
# Linux
apt-get install python3./caffeine-build clean rebuildReduce jobs:
./caffeine-build build --jobs 2- Auto-detect cores: Script auto-detects CPU cores (use
--jobs Nto override) - Incremental builds: Don't use
cleanunless necessary - ccache (Optional): Speeds up recompilation
# Linux/macOS brew install ccache - Precompiled headers: CMake uses them automatically
- Parallel linking: Build with
--jobs $(nproc)for full parallelism
Edit caffeine-build to add:
cmake --build . --target caffeine-core --parallel $PARALLEL_JOBSAdd to script:
cmake --install build --config Release --prefix /usr/localFor IDE integration:
./caffeine-build config
# Compile commands in: build/compile_commands.jsontime ./caffeine-build rebuild --releasecd build
cmake --build . --verbose --parallel 1The original scripts in scripts/ are still available:
scripts/build.sh- Original shell scriptscripts/build.bat- Original batch scriptscripts/build_manager.py- Python build manager
The new caffeine-build script is recommended for daily use.
To improve the build script:
- Test changes on all three platforms (Windows, macOS, Linux)
- Ensure backwards compatibility
- Update this documentation
- Follow existing shell conventions
- CMake Documentation
- CTest Documentation
- C++20 Compiler Support
- See also:
docs/building.md
Last Updated: May 2026
Maintained By: Caffeine Development Team