planetsim/CMakeLists.txt
Jonas Reith 53e371bb2f Add Biota stage: flora, fauna & funga (density + slot/point population)
World-Creation stage after biomes. Two layers (raylib-free engine):
- Per-cell density scalars (flora/fauna/funga in [0,1]) derived from the
  climate fields each tick (drive color modes 8/9/0). Flora = Liebig-min of
  temp & moisture; fauna ~ flora with carnivores gated on local prey; funga =
  moisture/organic-matter-led + cold-tolerant. Zero on water/ice.
- On-demand discrete population (key L, saved as v7): each land cell draws
  broad archetypes from a comprehensive table into a per-kind slot cap +
  density-scaled point budget (size -> cost), weighted by biome/climate
  suitability and a regional bonus for same-biome neighbours. Separate RNG
  seeded from cfg.seed so generating biota never perturbs tectonic determinism.

Organisms are labelled by taxonomy (Family + Size + role, e.g. "Felidae
(Big, Carnivore)") with the full Class > Order > Family tree stored, never an
informal common name. Cell-info panel word-wraps + aggregates duplicates so the
lists no longer get cut off.

New: src/sim/PlanetBiota.{hpp,cpp} + PlanetFlora/Fauna/FungiGen.cpp, color
modes/colors, bio* config knobs, save v7 (older saves load with empty
population), test_biota.cpp (densities, fauna<=capacity, carnivore gating,
slot/point budgets, determinism + RNG isolation, v7 round-trip). Docs updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 13:56:03 +02:00

59 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(PlanetSim CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 5.5
)
# Build raylib as a static lib, no examples.
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(raylib)
add_executable(planetsim
src/main.cpp
# Engine (raylib-free, testable headless) -- src/sim
src/sim/IcoSphere.cpp
src/sim/Planet.cpp
src/sim/PlanetTectonics.cpp
src/sim/PlanetDrift.cpp
src/sim/PlanetErosion.cpp
src/sim/PlanetHydrology.cpp
src/sim/PlanetBiomes.cpp
src/sim/PlanetClimate.cpp
src/sim/PlanetBiota.cpp
src/sim/PlanetFloraGen.cpp
src/sim/PlanetFaunaGen.cpp
src/sim/PlanetFungiGen.cpp
src/sim/PlanetIO.cpp
# Viewer (raylib) -- src/render
src/render/Colors.cpp
src/render/Map2D.cpp
src/render/Overlays.cpp
src/render/Picking.cpp
src/render/Panels.cpp
src/render/Viewer.cpp
src/render/ViewerInput.cpp
src/render/ViewerRender.cpp
)
# Flat includes ("Planet.hpp", "Viewer.hpp", ...) resolve across both folders.
target_include_directories(planetsim PRIVATE src/sim src/render)
target_link_libraries(planetsim PRIVATE raylib)
# OpenMP parallelizes the per-cell passes in Planet::step(). Optional: without
# it the #pragma omp lines are ignored and the sim runs (correctly) serial.
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(planetsim PRIVATE OpenMP::OpenMP_CXX)
endif()
# Linux system libs raylib needs at link time.
if(UNIX AND NOT APPLE)
target_link_libraries(planetsim PRIVATE m pthread dl)
endif()