# Strategic-layer formulas as pure functions (no game state, no I/O).
# Not yet wired into the root CMakeLists; add_subdirectory(src/game/sim) when the
# host build grows a game target. tests/game_sim/build_and_run.sh builds the same
# sources with plain g++ in the meantime.
add_library(sots_game_sim STATIC
  economy.cpp
  construction.cpp
  research.cpp
  colony.cpp
  movement.cpp
  visibility.cpp
  techgraph.cpp)
target_include_directories(sots_game_sim PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../..)
target_compile_features(sots_game_sim PUBLIC cxx_std_17)
if(NOT MSVC)
  target_compile_options(sots_game_sim PRIVATE -Wall -Wextra)
endif()

option(SOTS_GAME_SIM_TESTS "Build the game/sim unit tests" OFF)
if(SOTS_GAME_SIM_TESTS)
  enable_testing()
  set(_sim_tests economy research colony movement techgraph visibility construction)
  foreach(_t IN LISTS _sim_tests)
    add_executable(game_sim_test_${_t} ${CMAKE_CURRENT_SOURCE_DIR}/../../../tests/game_sim/test_${_t}.cpp)
    target_link_libraries(game_sim_test_${_t} PRIVATE sots_game_sim)
    add_test(NAME game_sim_${_t} COMMAND game_sim_test_${_t})
  endforeach()
  add_executable(game_sim_smoke_save ${CMAKE_CURRENT_SOURCE_DIR}/../../../tests/game_sim/smoke_real_save.cpp)
  target_link_libraries(game_sim_smoke_save PRIVATE sots_game_sim)
  add_test(NAME game_sim_smoke_save COMMAND game_sim_smoke_save)
endif()
