Files
aevolution/cmake/ProjectOptions.cmake
T
dingoandClaude Opus 5 d5b4bd068e Initial commit: architecture docs and headless engineering proof
Aeternalis Evolution, a custom-engine persistent evolutionary MMO.

This first commit establishes the project skeleton:

- Architecture and design docs: project vision, system overview,
  engineering constitution, roadmap, 19 ADRs, and the simulation,
  world, network, persistence and infrastructure architectures.
- Headless engineering proof: deterministic synthetic particles,
  component lifecycle, explicit PRNG streams, canonical snapshots
  and restored execution.
- Build and tooling: CMake 3.28+ / Ninja presets, C++23 feature
  check, clang-format and clang-tidy config, format check script,
  Windows check script, and a Docker build context.
- Tests: unit tests, benchmarks, a snapshot fuzz target and CLI
  integration wiring.

No gameplay, renderer, network service or running deployment yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 15:44:41 -04:00

55 lines
2.4 KiB
CMake

if(NOT EVO_SANITIZER MATCHES "^(none|address|thread)$")
message(FATAL_ERROR "Unsupported EVO_SANITIZER=${EVO_SANITIZER}")
endif()
if(EVO_ENABLE_TIDY)
if(NOT CMAKE_GENERATOR MATCHES "Ninja|Makefiles")
message(FATAL_ERROR "Use Ninja or Makefiles for clang-tidy compilation")
endif()
find_program(EVO_CLANG_TIDY NAMES clang-tidy-19 clang-tidy REQUIRED)
execute_process(COMMAND "${EVO_CLANG_TIDY}" --version OUTPUT_VARIABLE tidy_version)
if(NOT tidy_version MATCHES "version 19\\.")
message(FATAL_ERROR "Analysis baseline requires clang-tidy major 19")
endif()
endif()
if(MSVC AND EVO_SANITIZER STREQUAL "address")
# MSVC runtime checks are incompatible with AddressSanitizer.
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()
if(MSVC AND EVO_SANITIZER STREQUAL "thread")
message(FATAL_ERROR "MSVC does not provide TSan; use the dedicated Linux preset/job")
endif()
function(evo_owned_target target)
if(MSVC)
target_compile_options(${target} PRIVATE /W4 /permissive- /Zc:__cplusplus /utf-8 /fp:strict)
if(EVO_WARNINGS_AS_ERRORS)
target_compile_options(${target} PRIVATE /WX)
endif()
if(EVO_SANITIZER STREQUAL "address")
target_compile_options(${target} PRIVATE /fsanitize=address)
target_link_options(${target} PRIVATE /INCREMENTAL:NO)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic -Wconversion -Wshadow -fno-fast-math)
if(EVO_WARNINGS_AS_ERRORS)
target_compile_options(${target} PRIVATE -Werror)
endif()
if(EVO_SANITIZER STREQUAL "address")
target_compile_options(${target} PRIVATE -fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all)
target_link_options(${target} PRIVATE -fsanitize=address,undefined -fno-sanitize-recover=all)
elseif(EVO_SANITIZER STREQUAL "thread")
target_compile_options(${target} PRIVATE -fsanitize=thread -fno-omit-frame-pointer)
target_link_options(${target} PRIVATE -fsanitize=thread)
endif()
else()
message(FATAL_ERROR "Unsupported compiler; add a documented/tested toolchain")
endif()
if(EVO_ENABLE_TIDY)
set(tidy_command "${EVO_CLANG_TIDY};--warnings-as-errors=*")
if(MSVC)
list(APPEND tidy_command "--extra-arg=/EHsc")
endif()
set_property(TARGET ${target} PROPERTY CXX_CLANG_TIDY "${tidy_command}")
endif()
endfunction()