Engine: - SdlContext and Window: RAII, throwing constructors, non-movable - FrameClock (real time, clamped dt) and SimClock (fixed 1/60 s steps, speed 0 = planning phase, backlog capped per frame) - Application owns them in lifetime order, exposes EngineContext, and runs the fixed-timestep loop; AppConfig::FromArgs parses --frames, --seed and --fullscreen - Temporary window-surface fill so Wayland maps the window until RenderDevice lands in step 2 Build: - Split into the siege_engine static lib and the siege_deck exe - check_engine_deps fails the build if Engine/ includes Game/ - ctest smoke test: siege_deck --frames 30 on the offscreen driver - siege_tests on Catch2 v3.15.3 (nixpkgs + CPM pin), with SimClock, FrameClock and AppConfig tests Docs: - Decision Log: error handling split, Catch2 for unit tests - Build Order step 1 done; Engine Overview, Main Loop and Time and README updated to match - AGENTS.md with build, conventions and gotchas for coding agents - .gitignore: .mcp.json (local CLion MCP port) and Obsidian's workspace.json (tab/pane state), now untracked Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
892 B
CMake
23 lines
892 B
CMake
# Fails the build if any file under Source/Engine includes something from Source/Game.
|
|
#
|
|
# cmake -DENGINE_DIR=<path to Source/Engine> -P CheckEngineDeps.cmake
|
|
#
|
|
# Engine and game share Source/ as their include root, so the compiler would
|
|
# happily resolve "Game/..." from engine code. This keeps the dependency one-way.
|
|
|
|
file(GLOB_RECURSE engine_files "${ENGINE_DIR}/*.h" "${ENGINE_DIR}/*.hpp" "${ENGINE_DIR}/*.cpp")
|
|
|
|
set(violations "")
|
|
foreach (file IN LISTS engine_files)
|
|
file(STRINGS "${file}" lines REGEX "^[ \t]*#[ \t]*include[ \t]*[<\"](\\.\\./)*Game/")
|
|
foreach (line IN LISTS lines)
|
|
file(RELATIVE_PATH rel "${ENGINE_DIR}/.." "${file}")
|
|
string(STRIP "${line}" line)
|
|
string(APPEND violations "\n ${rel}: ${line}")
|
|
endforeach ()
|
|
endforeach ()
|
|
|
|
if (violations)
|
|
message(FATAL_ERROR "Engine code must not include Game code:${violations}")
|
|
endif ()
|