Files
aevolution/CMakeLists.txt
T
dingoandClaude Opus 5.5 2a5c0d0e22
Foundation / checks (ecs) (push) Successful in 2m21s
Foundation / checks (deploy) (push) Successful in 4m1s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 7m21s
Foundation / checks (network) (push) Canceled after 9m43s
Foundation / checks (checks) (push) Canceled after 9m49s
Foundation / checks (postgres) (push) Canceled after 9m43s
Foundation / checks (client) (push) Canceled after 9m48s
ADR-0131: Keycloak sign-in in the Windows engineering client
Sign In / Register opens the system browser (PKCE S256, loopback 127.0.0.1:47600)
and keeps the refresh token in Windows Credential Manager. The client then fetches
a 10-minute grant from grants.aeternalisgames.com and connects to the cellular DEV
region. It renews the grant about a minute before expiry through SessionRefresh,
and again after a lost connection. Sign Out closes the session and revokes the
login at the broker and at Keycloak. Grant replies are cross-checked against the
grant record before use. The manual grant-bundle path stays for developers.

The bounded JSON reader moves to evo_json (evo::serialization), shared by the
broker and the client. Adds the client-auth tests. Completes work started in
another session: main.cpp wiring, refresh expiry tracking, no requests for a
superseded session, and clang-tidy and Windows header-order fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:31:33 -04:00

693 lines
40 KiB
CMake

cmake_minimum_required(VERSION 3.28)
project(AeternalisEvolution VERSION 0.1.0 LANGUAGES CXX)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Use an out-of-source build, e.g. cmake --preset debug")
endif()
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <expected>
#if !defined(__cpp_lib_expected) || __cpp_lib_expected < 202202L
#error std::expected is required
#endif
int main() { std::expected<int, int> result{42}; return *result == 42 ? 0 : 1; }"
EVO_HAS_EXPECTED)
if(NOT EVO_HAS_EXPECTED)
message(FATAL_ERROR "This compiler/standard-library pair lacks the required C++23 std::expected")
endif()
option(EVO_WARNINGS_AS_ERRORS "Treat owned-code warnings as errors" ON)
option(EVO_ENABLE_TIDY "Run clang-tidy during compilation" OFF)
option(EVO_BUILD_FUZZER "Build the Clang libFuzzer snapshot target" OFF)
option(EVO_BUILD_ECS_EXPERIMENT "Build the isolated EnTT comparison (explicit preparation required)" OFF)
option(EVO_BUILD_POSTGRES "Build the isolated Linux PostgreSQL persistence adapter" OFF)
option(EVO_BUILD_UI_PROBE "Build the isolated M9.8a Dear ImGui compatibility probe" OFF)
option(EVO_BUILD_CLIENT_PROBE "Build the isolated M9.1 SDL dependency probe" OFF)
option(EVO_BUILD_CLIENT "Build the native M9 engineering client" OFF)
option(EVO_BUILD_NETWORK "Build the M9.6 dev session protocol and TLS adapter (explicit Mbed TLS preparation required)" OFF)
option(EVO_BUILD_QUIC "Build the M10.2 msquic transport (explicit msquic preparation required)" OFF)
# M9.8e Windows package (ADR-0086): identity printed by `evo-client --version`, set by
# tools/client/package-windows.ps1; deterministic MSVC objects/binaries for packaging.
set(EVO_BUILD_IDENTITY "unpackaged" CACHE STRING "evo-client build identity")
string(LENGTH "${EVO_BUILD_IDENTITY}" evo_identity_length)
if(NOT EVO_BUILD_IDENTITY MATCHES "^[0-9A-Za-z.+-]+$" OR evo_identity_length GREATER 64)
message(FATAL_ERROR "EVO_BUILD_IDENTITY must be 1-64 characters of [0-9A-Za-z.+-]")
endif()
option(EVO_REPRODUCIBLE "MSVC: deterministic objects and binaries (/Brepro)" OFF)
if(MSVC AND EVO_REPRODUCIBLE)
# Before any dependency is added, so SDL, Mbed TLS and Dear ImGui are covered too.
add_compile_options(/Brepro)
add_link_options(/Brepro)
endif()
set(EVO_SANITIZER "none" CACHE STRING "none, address (ASan/UBSan), or thread")
set_property(CACHE EVO_SANITIZER PROPERTY STRINGS none address thread)
include(cmake/ProjectOptions.cmake)
if(EVO_BUILD_CLIENT OR EVO_BUILD_POSTGRES)
add_library(evo_json STATIC src/serialization/json.cpp)
target_include_directories(evo_json PUBLIC "${PROJECT_SOURCE_DIR}/include")
evo_owned_target(evo_json)
endif()
set(evo_simulation_sources src/simulation/world.cpp src/simulation/snapshot.cpp src/simulation/scheduler.cpp src/simulation/spatial.cpp)
add_library(evo_simulation STATIC ${evo_simulation_sources})
add_library(evo::simulation ALIAS evo_simulation)
target_include_directories(evo_simulation PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_simulation PUBLIC cxx_std_23)
evo_owned_target(evo_simulation)
set(evo_world_sources src/world/coordinates.cpp src/world/generation.cpp src/world/chunks.cpp src/world/edits.cpp src/world/codec.cpp src/world/local_files.cpp src/world/environment_units.cpp src/world/fields.cpp src/world/environment.cpp src/world/transfers.cpp src/world/transfer_codec.cpp)
add_library(evo_world STATIC ${evo_world_sources})
add_library(evo::world ALIAS evo_world)
target_include_directories(evo_world PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_world PUBLIC cxx_std_23)
evo_owned_target(evo_world)
add_library(evo_accounting STATIC src/accounting/ledger.cpp src/accounting/rates.cpp)
add_library(evo::accounting ALIAS evo_accounting)
target_include_directories(evo_accounting PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_accounting PUBLIC cxx_std_23)
evo_owned_target(evo_accounting)
add_library(evo_biology STATIC
src/biology/genome.cpp src/biology/development.cpp src/biology/metabolism.cpp
src/biology/mutation.cpp src/biology/lineage.cpp src/biology/founder.cpp
src/biology/cellular_motion.cpp src/biology/cellular_uptake.cpp
src/biology/cellular_habitat.cpp src/biology/cellular_step.cpp
src/biology/cellular_region_step.cpp src/biology/budding.cpp)
add_library(evo::biology ALIAS evo_biology)
target_include_directories(evo_biology PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(evo_biology PUBLIC evo::accounting)
target_compile_features(evo_biology PUBLIC cxx_std_23)
evo_owned_target(evo_biology)
# M11.2 portable lifecycle orchestration; no dependency from the foundation proof.
add_library(evo_lifecycle STATIC src/server/lifecycle/primitive_lives.cpp
src/server/lifecycle/primitive_batch.cpp src/server/lifecycle/cellular_lives.cpp
src/server/lifecycle/cellular_batch.cpp src/server/lifecycle/wildlife_controller.cpp
src/server/lifecycle/cellular_play_summary.cpp)
add_library(evo::lifecycle ALIAS evo_lifecycle)
target_link_libraries(evo_lifecycle PUBLIC evo::biology)
evo_owned_target(evo_lifecycle)
add_library(evo_ecology STATIC src/ecology/cohort.cpp src/ecology/collapse.cpp src/ecology/population.cpp src/ecology/materialize.cpp)
add_library(evo::ecology ALIAS evo_ecology)
target_include_directories(evo_ecology PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(evo_ecology PUBLIC evo::accounting evo::biology)
target_compile_features(evo_ecology PUBLIC cxx_std_23)
evo_owned_target(evo_ecology)
add_library(evo_processes STATIC src/processes/producer.cpp src/processes/feeding.cpp src/processes/ecosystem.cpp src/processes/genome_strategy.cpp src/processes/ensemble.cpp src/processes/environmental_community.cpp src/processes/environmental_codec.cpp src/processes/environmental_schedule.cpp src/processes/lineage_region.cpp src/processes/development_opening.cpp)
add_library(evo::processes ALIAS evo_processes)
target_link_libraries(evo_processes PUBLIC evo::accounting evo::biology evo::world)
evo_owned_target(evo_processes)
add_executable(evo-sim apps/evo-sim/main.cpp)
target_link_libraries(evo-sim PRIVATE evo::simulation evo::processes)
evo_owned_target(evo-sim)
# Portable host-side lease timing contract; no database or simulation dependency.
add_library(evo_region_lease STATIC src/persistence/region_lease.cpp)
add_library(evo::region_lease ALIAS evo_region_lease)
target_include_directories(evo_region_lease PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_region_lease PUBLIC cxx_std_23)
evo_owned_target(evo_region_lease)
# Portable host status and bounded operational exposition (M7.8).
add_library(evo_ops STATIC src/server/ops.cpp src/server/load_governor.cpp)
add_library(evo::ops ALIAS evo_ops)
target_include_directories(evo_ops PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_ops PUBLIC cxx_std_23)
evo_owned_target(evo_ops)
# Portable checkpoint manifest codec and environmental-v1 payload validation.
add_library(evo_region_checkpoint STATIC src/persistence/region_checkpoint.cpp src/persistence/region_batch.cpp)
add_library(evo::region_checkpoint ALIAS evo_region_checkpoint)
target_link_libraries(evo_region_checkpoint PUBLIC evo::region_lease evo::processes evo::lifecycle)
evo_owned_target(evo_region_checkpoint)
include(CTest)
if(EVO_BUILD_CLIENT OR EVO_BUILD_NETWORK)
# SDL-free client value contracts (M9.3-M9.5), shared by the client and the dev
# session codec. They copy read-only world/biology views, never the reverse.
add_library(evo_client_controls STATIC src/client/camera/camera.cpp src/client/input/input.cpp src/client/input/bindings.cpp src/client/ui/ui_state.cpp src/client/ui/outcome_log.cpp)
target_include_directories(evo_client_controls PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
evo_owned_target(evo_client_controls)
if(BUILD_TESTING)
add_executable(evo-client-state-tests tests/client_ui_state.cpp)
target_link_libraries(evo-client-state-tests PRIVATE evo_client_controls)
evo_owned_target(evo-client-state-tests)
add_test(NAME client-ui-state COMMAND evo-client-state-tests)
set_tests_properties(client-ui-state PROPERTIES TIMEOUT 30 LABELS "client")
add_executable(evo-client-bindings-tests tests/client_bindings.cpp)
target_link_libraries(evo-client-bindings-tests PRIVATE evo_client_controls)
evo_owned_target(evo-client-bindings-tests)
add_test(NAME client-bindings COMMAND evo-client-bindings-tests)
set_tests_properties(client-bindings PROPERTIES TIMEOUT 30 LABELS "client")
endif()
add_library(evo_client_views STATIC src/client/views/environment_view.cpp src/client/views/organism_view.cpp)
target_link_libraries(evo_client_views PUBLIC evo::world evo::biology)
evo_owned_target(evo_client_views)
endif()
if(EVO_BUILD_NETWORK)
include(cmake/Network.cmake)
endif()
if(EVO_BUILD_QUIC)
# M10.2 (ADR-0090). Tests reuse the dev credential generator from the network build.
if(NOT EVO_BUILD_NETWORK)
message(FATAL_ERROR "EVO_BUILD_QUIC requires EVO_BUILD_NETWORK")
endif()
include(cmake/Quic.cmake)
# M10.2b transport: bounded channels and exact CA pinning over msquic.
add_library(evo_network_quic STATIC src/network/transport/quic_endpoint.cpp
src/network/transport/host_lookup.cpp)
target_include_directories(evo_network_quic PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_link_libraries(evo_network_quic PUBLIC evo_msquic PRIVATE mbedtls)
if(WIN32)
target_link_libraries(evo_network_quic PRIVATE ws2_32) # Host name lookup.
endif()
evo_owned_target(evo_network_quic)
# M10.3b session login over QUIC (ADR-0091): region side and client side.
add_library(evo_session_server STATIC src/server/session/region_sessions.cpp)
target_link_libraries(evo_session_server PUBLIC evo_network_quic evo_network_tls)
evo_owned_target(evo_session_server)
add_library(evo_session_client STATIC src/client/session/region_session.cpp)
target_link_libraries(evo_session_client PUBLIC evo_network_quic evo_network_protocol)
evo_owned_target(evo_session_client)
# M11.3d: bind reliable cellular session actions to the complete life-ordered trace.
add_library(evo_cellular_session_adapter STATIC
src/server/session/cellular_session_batch.cpp)
target_link_libraries(evo_cellular_session_adapter PUBLIC evo::lifecycle evo_network_protocol)
evo_owned_target(evo_cellular_session_adapter)
# M10.4c headless session client (development and test only; ADR-0092).
add_executable(evo-session-probe apps/evo-session-probe/main.cpp)
target_link_libraries(evo-session-probe PRIVATE evo_session_client evo_network_tls)
evo_owned_target(evo-session-probe)
evo_msquic_runtime(evo-session-probe)
# M10.9b multi-client load generator (development and qualification; ADR-0097).
find_package(Threads REQUIRED)
add_executable(evo-load tools/network/load.cpp)
target_link_libraries(evo-load PRIVATE evo_session_client evo_network_tls evo_client_prediction
Threads::Threads)
evo_owned_target(evo-load)
evo_msquic_runtime(evo-load)
if(BUILD_TESTING)
# Owned impairment relay (tests and measurements only).
add_library(evo_network_impair STATIC tools/network/impair/udp_relay.cpp)
target_include_directories(evo_network_impair PUBLIC "${PROJECT_SOURCE_DIR}/tools/network/impair")
if(WIN32)
target_link_libraries(evo_network_impair PUBLIC ws2_32 winmm)
endif()
evo_owned_target(evo_network_impair)
add_executable(evo-quic-transport-tests tests/quic_transport.cpp)
target_link_libraries(evo-quic-transport-tests PRIVATE evo_network_quic evo_network_impair evo_network_tls)
evo_owned_target(evo-quic-transport-tests)
evo_msquic_runtime(evo-quic-transport-tests)
# M10.2c measurement tool (development reference; not a test).
add_executable(evo-quic-hol-measure tools/network/quic_hol.cpp)
target_link_libraries(evo-quic-hol-measure PRIVATE evo_network_quic evo_network_impair evo_network_tls)
evo_owned_target(evo-quic-hol-measure)
evo_msquic_runtime(evo-quic-hol-measure)
add_test(NAME quic-transport COMMAND evo-quic-transport-tests)
set_tests_properties(quic-transport PROPERTIES TIMEOUT 180 LABELS "quic")
add_executable(evo-quic-session-tests tests/quic_sessions.cpp)
target_link_libraries(evo-quic-session-tests PRIVATE evo_session_server evo_session_client)
evo_owned_target(evo-quic-session-tests)
evo_msquic_runtime(evo-quic-session-tests)
add_test(NAME quic-sessions COMMAND evo-quic-session-tests)
set_tests_properties(quic-sessions PROPERTIES TIMEOUT 120 LABELS "quic;quic-session")
add_executable(evo-cellular-session-batch-tests tests/cellular_session_batch_tests.cpp)
target_link_libraries(evo-cellular-session-batch-tests PRIVATE evo_cellular_session_adapter)
evo_owned_target(evo-cellular-session-batch-tests)
add_test(NAME cellular-session-batch COMMAND evo-cellular-session-batch-tests)
set_tests_properties(cellular-session-batch PROPERTIES TIMEOUT 60 LABELS "quic;cellular")
add_executable(evo-quic-smoke-tests tests/quic_smoke.cpp)
target_link_libraries(evo-quic-smoke-tests PRIVATE evo_msquic evo_network_tls)
evo_owned_target(evo-quic-smoke-tests)
evo_msquic_runtime(evo-quic-smoke-tests)
add_test(NAME quic-smoke COMMAND evo-quic-smoke-tests)
set_tests_properties(quic-smoke PROPERTIES TIMEOUT 60 LABELS "quic")
endif()
endif()
if(EVO_BUILD_CLIENT_PROBE OR EVO_BUILD_CLIENT OR EVO_BUILD_UI_PROBE)
include(cmake/ClientProbe.cmake)
endif()
if(EVO_BUILD_POSTGRES)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "The initial PostgreSQL adapter is qualified on Linux only")
endif()
find_package(PostgreSQL 18.6 EXACT REQUIRED)
find_package(Threads REQUIRED)
add_library(evo_postgres STATIC src/persistence/postgres.cpp src/persistence/region_lease_store.cpp)
add_library(evo::postgres ALIAS evo_postgres)
target_include_directories(evo_postgres PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(evo_postgres PUBLIC evo::region_lease PRIVATE PostgreSQL::PostgreSQL)
evo_owned_target(evo_postgres)
# SHA-256 via system OpenSSL libcrypto (already required by libpq TLS; ADR-0061).
find_package(OpenSSL 3 REQUIRED COMPONENTS Crypto)
add_library(evo_region_store STATIC src/persistence/sha256.cpp src/persistence/object_store.cpp
src/persistence/checkpoint_store.cpp src/persistence/primitive_checkpoint_store.cpp
src/persistence/cellular_checkpoint_store.cpp
src/persistence/region_clone.cpp)
add_library(evo::region_store ALIAS evo_region_store)
target_link_libraries(evo_region_store PUBLIC evo::postgres evo::region_checkpoint
PRIVATE OpenSSL::Crypto)
evo_owned_target(evo_region_store)
# M7.6 authoritative region host and its process (ADR-0064).
add_library(evo_region_host STATIC src/server/region_host.cpp
src/server/primitive_region_host.cpp src/server/cellular_region_host.cpp
src/server/ops_http.cpp)
add_library(evo::region_host ALIAS evo_region_host)
target_link_libraries(evo_region_host PUBLIC evo::region_store evo::ops)
evo_owned_target(evo_region_host)
add_executable(evo-server apps/evo-server/main.cpp)
target_link_libraries(evo-server PRIVATE evo::region_host)
if(EVO_BUILD_NETWORK)
# M9.7 dev sessions inside the region process (ADR-0083).
target_link_libraries(evo-server PRIVATE evo_network_session)
target_compile_definitions(evo-server PRIVATE EVO_SERVER_SESSIONS=1)
endif()
if(EVO_BUILD_QUIC)
# M10.4c QUIC sessions inside the region process (ADR-0091/0092); opt-in by flags.
target_link_libraries(evo-server PRIVATE evo_session_server evo_control_ledger_postgres
evo_cellular_session_adapter)
target_compile_definitions(evo-server PRIVATE EVO_SERVER_M10=1)
endif()
evo_owned_target(evo-server)
if(EVO_BUILD_NETWORK)
# M10.3c durable account control, M10.4b durable action records and M10.8b ticket
# handoffs for region sessions (ADR-0091 schema v10, ADR-0092 v11, ADR-0096 v12).
add_library(evo_control_ledger_postgres STATIC src/server/session/postgres_control_ledger.cpp
src/server/session/postgres_action_ledger.cpp src/server/session/postgres_handoff_ledger.cpp)
target_link_libraries(evo_control_ledger_postgres PUBLIC evo::postgres evo_network_protocol)
evo_owned_target(evo_control_ledger_postgres)
# ADR-0131 Keycloak grant broker (schema v39).
add_library(evo_grant_broker STATIC
src/server/broker/access_token.cpp src/server/broker/grant_broker.cpp)
target_link_libraries(evo_grant_broker PUBLIC evo_json evo::region_host evo_network_tls
PRIVATE OpenSSL::Crypto)
evo_owned_target(evo_grant_broker)
add_executable(evo-grant-broker apps/evo-grant-broker/main.cpp)
target_link_libraries(evo-grant-broker PRIVATE evo_grant_broker)
evo_owned_target(evo-grant-broker)
endif()
# M7.9 clone and history audit tool (ADR-0067).
add_executable(evo-world-clone apps/evo-world-clone/main.cpp)
target_link_libraries(evo-world-clone PRIVATE evo::region_store)
evo_owned_target(evo-world-clone)
if(BUILD_TESTING)
# Contention tests use one thread and one connection per contender.
add_executable(evo-postgres-tests tests/postgres_tests.cpp tests/region_lease_store_tests.cpp
tests/cellular_publication_tests.cpp
tests/account_control_store_tests.cpp tests/probe_handoff_store_tests.cpp
tests/life_reservation_store_tests.cpp
tests/primitive_publication_tests.cpp
tests/region_action_tests.cpp
tests/region_checkpoint_store_tests.cpp tests/region_host_tests.cpp
tests/region_server_process_tests.cpp tests/region_recovery_tests.cpp
tests/region_ops_tests.cpp tests/region_clone_tests.cpp
tests/region_migration_tests.cpp tests/region_store_tests.cpp
tests/region_load_tests.cpp tests/region_upgrade_tests.cpp)
target_link_libraries(evo-postgres-tests PRIVATE evo::region_host Threads::Threads)
if(EVO_BUILD_NETWORK)
# M9.7: real evo-server sessions over TLS (ADR-0083).
target_sources(evo-postgres-tests PRIVATE tests/region_session_tests.cpp
tests/grant_broker_tests.cpp)
target_link_libraries(evo-postgres-tests PRIVATE evo_network_session evo_control_ledger_postgres
evo_grant_broker OpenSSL::Crypto)
target_compile_definitions(evo-postgres-tests PRIVATE EVO_POSTGRES_SESSIONS=1)
endif()
if(EVO_BUILD_QUIC)
# M10.4c: evo-server with the QUIC listener, real clients and the probe (ADR-0092).
# M10.8d: two evo-server processes handing probes over (ADR-0096).
target_sources(evo-postgres-tests PRIVATE tests/region_m10_session_tests.cpp
tests/region_handoff_process_tests.cpp)
target_link_libraries(evo-postgres-tests PRIVATE evo_session_client)
target_compile_definitions(evo-postgres-tests PRIVATE EVO_POSTGRES_M10=1)
add_dependencies(evo-postgres-tests evo-session-probe evo-load)
endif()
add_dependencies(evo-postgres-tests evo-server evo-world-clone) # Spawned by process tests.
evo_owned_target(evo-postgres-tests)
# Intentionally not an ordinary CTest: tools/ci/postgres-check.sh owns its private DB.
endif()
endif()
if(BUILD_TESTING)
add_executable(evo-session-window-tests tests/session_window_tests.cpp)
target_include_directories(evo-session-window-tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
evo_owned_target(evo-session-window-tests)
add_test(NAME session-window-contracts COMMAND evo-session-window-tests)
set_tests_properties(session-window-contracts PROPERTIES TIMEOUT 30)
add_executable(evo-region-lease-tests tests/region_lease_tests.cpp)
target_link_libraries(evo-region-lease-tests PRIVATE evo::region_lease)
evo_owned_target(evo-region-lease-tests)
add_test(NAME region-lease-contracts COMMAND evo-region-lease-tests)
set_tests_properties(region-lease-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-lineage-region-tests tests/lineage_region_tests.cpp)
target_link_libraries(evo-lineage-region-tests PRIVATE evo::processes)
evo_owned_target(evo-lineage-region-tests)
add_test(NAME lineage-region-contracts COMMAND evo-lineage-region-tests)
set_tests_properties(lineage-region-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-ops-tests tests/ops_tests.cpp)
target_link_libraries(evo-ops-tests PRIVATE evo::ops)
evo_owned_target(evo-ops-tests)
add_test(NAME ops-contracts COMMAND evo-ops-tests)
set_tests_properties(ops-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-region-batch-tests tests/region_batch_tests.cpp)
target_link_libraries(evo-region-batch-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-region-batch-tests)
add_test(NAME region-batch-contracts COMMAND evo-region-batch-tests)
set_tests_properties(region-batch-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-region-checkpoint-tests tests/region_checkpoint_tests.cpp)
target_link_libraries(evo-region-checkpoint-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-region-checkpoint-tests)
add_test(NAME region-checkpoint-contracts COMMAND evo-region-checkpoint-tests)
set_tests_properties(region-checkpoint-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environmental-qualification tests/environmental_qualification.cpp)
target_link_libraries(evo-environmental-qualification PRIVATE evo::processes)
evo_owned_target(evo-environmental-qualification)
add_test(NAME environmental-qualification COMMAND evo-environmental-qualification)
set_tests_properties(environmental-qualification PROPERTIES TIMEOUT 120)
add_executable(evo-environmental-community-tests tests/environmental_community_tests.cpp)
target_link_libraries(evo-environmental-community-tests PRIVATE evo::processes)
evo_owned_target(evo-environmental-community-tests)
add_test(NAME environmental-community-contracts COMMAND evo-environmental-community-tests)
set_tests_properties(environmental-community-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environment-transfers-tests tests/environment_transfers_tests.cpp)
target_link_libraries(evo-environment-transfers-tests PRIVATE evo::world)
evo_owned_target(evo-environment-transfers-tests)
add_test(NAME environment-transfers-contracts COMMAND evo-environment-transfers-tests)
set_tests_properties(environment-transfers-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environment-views-tests tests/environment_views_tests.cpp)
target_link_libraries(evo-environment-views-tests PRIVATE evo::world)
evo_owned_target(evo-environment-views-tests)
add_test(NAME environment-views-contracts COMMAND evo-environment-views-tests)
set_tests_properties(environment-views-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-fields-tests tests/world_fields_tests.cpp)
target_link_libraries(evo-world-fields-tests PRIVATE evo::world)
evo_owned_target(evo-world-fields-tests)
add_test(NAME world-fields-contracts COMMAND evo-world-fields-tests)
set_tests_properties(world-fields-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environment-units-tests tests/environment_units_tests.cpp)
target_link_libraries(evo-environment-units-tests PRIVATE evo::world evo::accounting)
evo_owned_target(evo-environment-units-tests)
add_test(NAME environment-units-contracts COMMAND evo-environment-units-tests)
set_tests_properties(environment-units-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-codec-fuzz-smoke tests/fuzz/world_codec_fuzz.cpp tests/fuzz/world_codec_smoke.cpp)
target_link_libraries(evo-world-codec-fuzz-smoke PRIVATE evo::world)
evo_owned_target(evo-world-codec-fuzz-smoke)
add_test(NAME world-codec-fuzz-smoke COMMAND evo-world-codec-fuzz-smoke)
set_tests_properties(world-codec-fuzz-smoke PROPERTIES TIMEOUT 120)
add_executable(evo-world-codec-tests tests/world_codec_tests.cpp)
target_link_libraries(evo-world-codec-tests PRIVATE evo::world)
evo_owned_target(evo-world-codec-tests)
add_test(NAME world-codec-contracts COMMAND evo-world-codec-tests)
set_tests_properties(world-codec-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-world-local-files-tests tests/world_local_files_tests.cpp)
target_link_libraries(evo-world-local-files-tests PRIVATE evo::world)
evo_owned_target(evo-world-local-files-tests)
add_test(NAME world-local-files-contracts COMMAND evo-world-local-files-tests)
set_tests_properties(world-local-files-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-world-edit-tests tests/world_edit_tests.cpp)
target_link_libraries(evo-world-edit-tests PRIVATE evo::world)
evo_owned_target(evo-world-edit-tests)
add_test(NAME world-edit-contracts COMMAND evo-world-edit-tests)
set_tests_properties(world-edit-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-chunk-tests tests/world_chunk_tests.cpp)
target_link_libraries(evo-world-chunk-tests PRIVATE evo::world)
evo_owned_target(evo-world-chunk-tests)
add_test(NAME world-chunk-contracts COMMAND evo-world-chunk-tests)
set_tests_properties(world-chunk-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-generation-tests tests/world_generation_tests.cpp)
target_link_libraries(evo-world-generation-tests PRIVATE evo::world)
evo_owned_target(evo-world-generation-tests)
add_test(NAME world-generation-contracts COMMAND evo-world-generation-tests)
set_tests_properties(world-generation-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-coordinate-tests tests/world_coordinates_tests.cpp)
target_link_libraries(evo-world-coordinate-tests PRIVATE evo::world)
evo_owned_target(evo-world-coordinate-tests)
add_test(NAME world-coordinate-contracts COMMAND evo-world-coordinate-tests)
set_tests_properties(world-coordinate-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-feeding-tests tests/feeding_tests.cpp)
target_link_libraries(evo-feeding-tests PRIVATE evo::processes)
evo_owned_target(evo-feeding-tests)
add_test(NAME feeding-contracts COMMAND evo-feeding-tests)
set_tests_properties(feeding-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-ecosystem-tests tests/ecosystem_tests.cpp)
target_link_libraries(evo-ecosystem-tests PRIVATE evo::processes)
evo_owned_target(evo-ecosystem-tests)
add_test(NAME ecosystem-contracts COMMAND evo-ecosystem-tests)
set_tests_properties(ecosystem-contracts PROPERTIES TIMEOUT 300)
add_executable(evo-genome-tests tests/genome_tests.cpp)
target_link_libraries(evo-genome-tests PRIVATE evo::biology)
evo_owned_target(evo-genome-tests)
add_test(NAME genome-contracts COMMAND evo-genome-tests)
set_tests_properties(genome-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-development-tests tests/development_tests.cpp)
target_link_libraries(evo-development-tests PRIVATE evo::biology)
evo_owned_target(evo-development-tests)
add_test(NAME development-contracts COMMAND evo-development-tests)
set_tests_properties(development-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-metabolism-tests tests/metabolism_tests.cpp)
add_executable(evo-cellular-motion-tests tests/cellular_motion_tests.cpp)
target_link_libraries(evo-cellular-motion-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-motion-tests)
add_test(NAME cellular-motion-contracts COMMAND evo-cellular-motion-tests)
set_tests_properties(cellular-motion-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-uptake-tests tests/cellular_uptake_tests.cpp)
target_link_libraries(evo-cellular-uptake-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-uptake-tests)
add_test(NAME cellular-uptake-contracts COMMAND evo-cellular-uptake-tests)
set_tests_properties(cellular-uptake-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-habitat-tests tests/cellular_habitat_tests.cpp)
target_link_libraries(evo-cellular-habitat-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-habitat-tests)
add_test(NAME cellular-habitat-contracts COMMAND evo-cellular-habitat-tests)
set_tests_properties(cellular-habitat-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-step-tests tests/cellular_step_tests.cpp)
target_link_libraries(evo-cellular-step-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-step-tests)
add_test(NAME cellular-step-contracts COMMAND evo-cellular-step-tests)
set_tests_properties(cellular-step-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-region-step-tests tests/cellular_region_step_tests.cpp)
target_link_libraries(evo-cellular-region-step-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-region-step-tests)
add_test(NAME cellular-region-step-contracts COMMAND evo-cellular-region-step-tests)
set_tests_properties(cellular-region-step-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-primitive-lives-tests tests/primitive_lives_tests.cpp)
target_link_libraries(evo-primitive-lives-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-primitive-lives-tests)
add_test(NAME primitive-lives COMMAND evo-primitive-lives-tests)
add_executable(evo-cellular-lives-tests tests/cellular_lives_tests.cpp)
target_link_libraries(evo-cellular-lives-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-lives-tests)
add_test(NAME cellular-lives-owner COMMAND evo-cellular-lives-tests)
set_tests_properties(cellular-lives-owner PROPERTIES TIMEOUT 60)
target_link_libraries(evo-metabolism-tests PRIVATE evo::processes)
evo_owned_target(evo-metabolism-tests)
add_test(NAME metabolism-contracts COMMAND evo-metabolism-tests)
set_tests_properties(metabolism-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-mutation-tests tests/mutation_tests.cpp)
target_link_libraries(evo-mutation-tests PRIVATE evo::biology)
evo_owned_target(evo-mutation-tests)
add_test(NAME mutation-contracts COMMAND evo-mutation-tests)
set_tests_properties(mutation-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-budding-tests tests/budding_tests.cpp)
target_link_libraries(evo-budding-tests PRIVATE evo::biology)
evo_owned_target(evo-budding-tests)
add_test(NAME budding-contracts COMMAND evo-budding-tests)
set_tests_properties(budding-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-lineage-tests tests/lineage_tests.cpp)
target_link_libraries(evo-lineage-tests PRIVATE evo::biology)
evo_owned_target(evo-lineage-tests)
add_test(NAME lineage-contracts COMMAND evo-lineage-tests)
set_tests_properties(lineage-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-ensemble-tests tests/ensemble_tests.cpp)
target_link_libraries(evo-ensemble-tests PRIVATE evo::processes)
evo_owned_target(evo-ensemble-tests)
add_test(NAME ensemble-contracts COMMAND evo-ensemble-tests)
set_tests_properties(ensemble-contracts PROPERTIES TIMEOUT 300)
add_executable(evo-producer-tests tests/producer_tests.cpp)
target_link_libraries(evo-producer-tests PRIVATE evo::processes)
evo_owned_target(evo-producer-tests)
add_test(NAME producer-contracts COMMAND evo-producer-tests)
set_tests_properties(producer-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cohort-tests tests/cohort_tests.cpp)
target_link_libraries(evo-cohort-tests PRIVATE evo::ecology)
evo_owned_target(evo-cohort-tests)
add_test(NAME cohort-contracts COMMAND evo-cohort-tests)
set_tests_properties(cohort-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-collapse-tests tests/collapse_tests.cpp)
target_link_libraries(evo-collapse-tests PRIVATE evo::ecology)
evo_owned_target(evo-collapse-tests)
add_test(NAME collapse-contracts COMMAND evo-collapse-tests)
set_tests_properties(collapse-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-population-tests tests/population_tests.cpp)
target_link_libraries(evo-population-tests PRIVATE evo::ecology)
evo_owned_target(evo-population-tests)
add_test(NAME population-contracts COMMAND evo-population-tests)
set_tests_properties(population-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-materialize-tests tests/materialize_tests.cpp)
target_link_libraries(evo-materialize-tests PRIVATE evo::ecology)
evo_owned_target(evo-materialize-tests)
add_test(NAME materialize-contracts COMMAND evo-materialize-tests)
set_tests_properties(materialize-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-equivalence-tests tests/equivalence_tests.cpp)
target_link_libraries(evo-equivalence-tests PRIVATE evo::ecology)
evo_owned_target(evo-equivalence-tests)
add_test(NAME resolution-equivalence COMMAND evo-equivalence-tests)
set_tests_properties(resolution-equivalence PROPERTIES TIMEOUT 600)
add_executable(evo-ledger-tests tests/ledger_tests.cpp)
target_link_libraries(evo-ledger-tests PRIVATE evo::accounting)
evo_owned_target(evo-ledger-tests)
add_test(NAME ledger-contracts COMMAND evo-ledger-tests)
set_tests_properties(ledger-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-rate-tests tests/rate_tests.cpp)
target_link_libraries(evo-rate-tests PRIVATE evo::accounting)
evo_owned_target(evo-rate-tests)
add_test(NAME rate-contracts COMMAND evo-rate-tests)
set_tests_properties(rate-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-tests tests/simulation_tests.cpp)
target_link_libraries(evo-tests PRIVATE evo::simulation)
evo_owned_target(evo-tests)
add_test(NAME simulation-contracts COMMAND evo-tests)
add_test(NAME test-harness-failure COMMAND evo-tests --self-test-failure)
set_tests_properties(test-harness-failure PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-replay COMMAND evo-sim --seed 123456 --ticks 1000 --entities 8 --verify-replay)
set_tests_properties(cli-replay PROPERTIES PASS_REGULAR_EXPRESSION "d61ad5bf0c928c76")
add_test(NAME cli-invalid-number COMMAND evo-sim --ticks -1)
set_tests_properties(cli-invalid-number PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-ecosystem COMMAND evo-sim --ecosystem --seed 0 --episodes 32)
set_tests_properties(cli-ecosystem PROPERTIES TIMEOUT 120
PASS_REGULAR_EXPRESSION "2cd4a15f9fbe9949")
# An option belonging to the other mode must be rejected, never accepted and ignored.
add_test(NAME cli-ecosystem-conflict COMMAND evo-sim --ecosystem --verify-replay)
add_test(NAME cli-ecosystem-rejects-ticks COMMAND evo-sim --ecosystem --seed 0 --ticks 1)
add_test(NAME cli-ecosystem-rejects-entities COMMAND evo-sim --ecosystem --entities 4)
add_test(NAME cli-ecosystem-rejects-save COMMAND evo-sim --ecosystem --save episodes.evo)
add_test(NAME cli-episodes-require-ecosystem COMMAND evo-sim --episodes 2 --tick-limit 1)
add_test(NAME cli-tick-limit-requires-ecosystem COMMAND evo-sim --ticks 10 --tick-limit 1)
add_test(NAME cli-ecosystem-rejects-seeds-per-cell COMMAND evo-sim --ecosystem --seeds-per-cell 4)
set_tests_properties(cli-ecosystem-conflict cli-ecosystem-rejects-ticks
cli-ecosystem-rejects-entities cli-ecosystem-rejects-save
cli-episodes-require-ecosystem cli-tick-limit-requires-ecosystem
cli-ecosystem-rejects-seeds-per-cell
PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-ensemble COMMAND evo-sim --ensemble --seed 0 --seeds-per-cell 4
--strategies 3 --tick-limit 400)
# Repinned when survivors stopped being recorded as deaths and the report gained
# deaths/survivors/observed_ticks with a summed shortfall. The reported facts
# changed, so the old value describes a report this build no longer produces.
set_tests_properties(cli-ensemble PROPERTIES TIMEOUT 120
PASS_REGULAR_EXPRESSION "5ec59d390909b526")
# The two measurement modes are separate workloads, and neither may borrow the
# other's options: --episodes counts episodes, --seeds-per-cell counts seeds.
add_test(NAME cli-ensemble-conflict COMMAND evo-sim --ensemble --verify-replay)
add_test(NAME cli-ensemble-excludes-ecosystem COMMAND evo-sim --ensemble --ecosystem)
add_test(NAME cli-ensemble-rejects-episodes COMMAND evo-sim --ensemble --episodes 2)
add_test(NAME cli-ensemble-rejects-ticks COMMAND evo-sim --ensemble --ticks 1)
add_test(NAME cli-ensemble-rejects-entities COMMAND evo-sim --ensemble --entities 4)
# Halves need at least one seed each, and the driver caps strategies at four.
add_test(NAME cli-ensemble-rejects-single-seed COMMAND evo-sim --ensemble --seeds-per-cell 1)
add_test(NAME cli-ensemble-rejects-excess-strategies COMMAND evo-sim --ensemble --strategies 5)
add_test(NAME cli-seeds-per-cell-requires-ensemble COMMAND evo-sim --seeds-per-cell 4)
add_test(NAME cli-strategies-requires-ensemble COMMAND evo-sim --strategies 3)
set_tests_properties(cli-ensemble-conflict cli-ensemble-excludes-ecosystem
cli-ensemble-rejects-episodes cli-ensemble-rejects-ticks cli-ensemble-rejects-entities
cli-ensemble-rejects-single-seed cli-ensemble-rejects-excess-strategies
cli-seeds-per-cell-requires-ensemble cli-strategies-requires-ensemble
PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-file-integration COMMAND "${CMAKE_COMMAND}"
"-DEVO_SIM=$<TARGET_FILE:evo-sim>" "-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/cli-integration"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cli_integration.cmake")
set_tests_properties(simulation-contracts cli-replay cli-file-integration PROPERTIES TIMEOUT 60)
endif()
add_executable(evo-benchmark tests/benchmarks/simulation_benchmark.cpp)
target_link_libraries(evo-benchmark PRIVATE evo::simulation)
evo_owned_target(evo-benchmark)
add_executable(evo-world-proof apps/evo-tools/world_proof.cpp)
target_link_libraries(evo-world-proof PRIVATE evo::world)
evo_owned_target(evo-world-proof)
if(BUILD_TESTING)
add_test(NAME world-process-restart COMMAND "${CMAKE_COMMAND}"
"-DEVO_WORLD_PROOF=$<TARGET_FILE:evo-world-proof>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/world-proof"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/world_process_restart.cmake")
set_tests_properties(world-process-restart PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-resolution-benchmark tests/benchmarks/resolution_benchmark.cpp)
target_link_libraries(evo-resolution-benchmark PRIVATE evo::ecology)
evo_owned_target(evo-resolution-benchmark)
if(BUILD_TESTING)
add_test(NAME resolution-sensitivity COMMAND evo-resolution-benchmark --verify)
set_tests_properties(resolution-sensitivity PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-chunk-layout experiments/world/chunk_layout.cpp)
target_link_libraries(evo-chunk-layout PRIVATE evo::world)
evo_owned_target(evo-chunk-layout)
if(BUILD_TESTING)
add_test(NAME chunk-layout-contracts COMMAND evo-chunk-layout --verify)
set_tests_properties(chunk-layout-contracts PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-spatial-benchmark tests/benchmarks/spatial_benchmark.cpp)
target_link_libraries(evo-spatial-benchmark PRIVATE evo::simulation)
evo_owned_target(evo-spatial-benchmark)
if(EVO_BUILD_FUZZER)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR MSVC OR EVO_SANITIZER STREQUAL "thread")
message(FATAL_ERROR "Fuzzing requires Linux Clang and is incompatible with TSan")
endif()
add_executable(evo-world-codec-fuzz tests/fuzz/world_codec_fuzz.cpp ${evo_world_sources})
target_include_directories(evo-world-codec-fuzz PRIVATE include)
evo_owned_target(evo-world-codec-fuzz)
target_compile_options(evo-world-codec-fuzz PRIVATE -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer)
target_link_options(evo-world-codec-fuzz PRIVATE -fsanitize=fuzzer,address,undefined)
# Compile the kernel itself with coverage and sanitizer instrumentation.
add_executable(evo-snapshot-fuzz tests/fuzz/snapshot_fuzz.cpp ${evo_simulation_sources})
target_include_directories(evo-snapshot-fuzz PRIVATE include)
evo_owned_target(evo-snapshot-fuzz)
target_compile_options(evo-snapshot-fuzz PRIVATE -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer)
target_link_options(evo-snapshot-fuzz PRIVATE -fsanitize=fuzzer,address,undefined)
endif()
if(EVO_BUILD_ECS_EXPERIMENT)
include(tools/entt-pin.cmake)
set(entt_root "${CMAKE_SOURCE_DIR}/build/external/entt")
if(NOT EXISTS "${entt_root}/include/entt/entt.hpp" OR NOT EXISTS "${entt_root}/LICENSE")
message(FATAL_ERROR "Run cmake -P tools/prepare-entt.cmake explicitly before configuring the experiment")
endif()
file(SHA256 "${entt_root}/include/entt/entt.hpp" entt_header_hash)
file(SHA256 "${entt_root}/LICENSE" entt_license_hash)
if(NOT entt_header_hash STREQUAL EVO_ENTT_HEADER_SHA256 OR NOT entt_license_hash STREQUAL EVO_ENTT_LICENSE_SHA256)
message(FATAL_ERROR "Experimental EnTT dependency failed integrity validation")
endif()
add_executable(evo-ecs-experiment experiments/ecs/comparison.cpp)
target_include_directories(evo-ecs-experiment PRIVATE include)
target_include_directories(evo-ecs-experiment SYSTEM PRIVATE "${entt_root}/include")
evo_owned_target(evo-ecs-experiment)
if(BUILD_TESTING)
add_test(NAME ecs-experiment-contracts COMMAND evo-ecs-experiment --verify)
set_tests_properties(ecs-experiment-contracts PROPERTIES TIMEOUT 120)
endif()
endif()
find_program(EVO_CLANG_FORMAT NAMES clang-format-19 clang-format)
add_custom_target(format-check COMMAND "${CMAKE_COMMAND}"
"-DFORMATTER=${EVO_CLANG_FORMAT}" "-DSOURCE_ROOT=${CMAKE_CURRENT_SOURCE_DIR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tools/check-format.cmake" VERBATIM)