Add MCRF_HEADLESS compile-time build option for #158
This commit enables McRogueFace to compile without SFML dependencies when built with -DMCRF_HEADLESS, a prerequisite for Emscripten/WebAssembly support. Changes: - Add src/platform/HeadlessTypes.h (~900 lines of SFML type stubs) - Consolidate all SFML includes through src/Common.h (15 files fixed) - Wrap ImGui-SFML with #ifndef MCRF_HEADLESS guards - Disable debug console/explorer in headless builds - Add comprehensive research document: docs/EMSCRIPTEN_RESEARCH.md The headless build compiles successfully but uses stub implementations that return failure/no-op. This proves the abstraction boundary is clean and enables future work on alternative backends (VRSFML, Emscripten). What still works in headless mode: - Python interpreter and script execution - libtcod integrations (pathfinding, FOV, noise, BSP, heightmaps) - Timer system and scene management - All game logic and data structures Build commands: Normal: make Headless: cmake .. -DCMAKE_CXX_FLAGS="-DMCRF_HEADLESS" && make Addresses #158 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
96c66decba
commit
7621ae35bb
23 changed files with 1694 additions and 16 deletions
22
src/Common.h
22
src/Common.h
|
|
@ -1,6 +1,24 @@
|
|||
# pragma once
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Audio.hpp>
|
||||
|
||||
// =============================================================================
|
||||
// Platform Selection
|
||||
// =============================================================================
|
||||
// Define MCRF_HEADLESS to build without SFML graphics/audio dependencies.
|
||||
// This enables headless operation for servers, CI, and Emscripten builds.
|
||||
//
|
||||
// Build with: cmake -DMCRF_HEADLESS=ON ..
|
||||
// =============================================================================
|
||||
|
||||
#ifdef MCRF_HEADLESS
|
||||
// Use headless type stubs instead of SFML
|
||||
#include "platform/HeadlessTypes.h"
|
||||
#define MCRF_GRAPHICS_BACKEND "headless"
|
||||
#else
|
||||
// Use SFML for graphics and audio
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Audio.hpp>
|
||||
#define MCRF_GRAPHICS_BACKEND "sfml"
|
||||
#endif
|
||||
|
||||
// Maximum dimension for grids, layers, and heightmaps (8192x8192 = 256MB of float data)
|
||||
// Prevents integer overflow in size calculations and limits memory allocation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue