# TUI frontend (FTXUI). Builds the `essim` executable against essim_core.
#
# A frontend is self-contained here: it pulls its own GUI toolkit, compiles its
# sources into a library that links essim_core, and produces the `essim` binary
# from its own entry point (main.cpp). To add another frontend, create a sibling
# src/frontends/<name>/ with the same shape and select it with
# -DESSIM_FRONTEND=<name>.

set(FTXUI_BUILD_DOCS OFF CACHE INTERNAL "")
set(FTXUI_BUILD_EXAMPLES OFF CACHE INTERNAL "")
set(FTXUI_BUILD_TESTS OFF CACHE INTERNAL "")
set(FTXUI_ENABLE_INSTALL OFF CACHE INTERNAL "")

FetchContent_Declare(ftxui
  GIT_REPOSITORY https://github.com/ArthurSonzogni/FTXUI.git
  GIT_TAG v6.1.9
  GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(ftxui)

# Library essim_tui (sources here minus main.cpp) + the `essim` binary.
essim_add_frontend(tui LIBS ftxui::screen ftxui::dom ftxui::component)
