Skip to content
You are viewing documentation for v6.1.8. Switch to latest (main).

Build Systems ​

Integrate FTXUI directly into CMake, Bazel, Meson, or build and install it manually from source.

CMake ​

cmake
include(FetchContent)

FetchContent_Declare(ftxui
  GIT_REPOSITORY https://github.com/ArthurSonzogni/FTXUI
  GIT_TAG v7.0.3 # Replace with a version, tag, or commit hash
)
FetchContent_MakeAvailable(ftxui)

add_executable(main main.cpp)
target_link_libraries(main
  PRIVATE ftxui::screen
  PRIVATE ftxui::dom
  PRIVATE ftxui::component
)
cmake
find_package(ftxui REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main
  PRIVATE ftxui::screen
  PRIVATE ftxui::dom
  PRIVATE ftxui::component
)
cmake
# First run:
#   git submodule add https://github.com/ArthurSonzogni/FTXUI external/ftxui
#   git submodule update --init --recursive

add_subdirectory(external/ftxui)

add_executable(main main.cpp)
target_link_libraries(main
  PRIVATE ftxui::screen
  PRIVATE ftxui::dom
  PRIVATE ftxui::component
)

CMake Options ​

OptionDescriptionDefault
FTXUI_BUILD_EXAMPLESBuild bundled examplesOFF
FTXUI_BUILD_DOCSBuild the documentationOFF
FTXUI_BUILD_TESTSEnable unit testsOFF
FTXUI_ENABLE_INSTALLGenerate install targetsON

Starter template: ftxui-starter.

Bazel (Bzlmod) ​

FTXUI is registered in the Bazel Central Registry.

python
bazel_dep(name = "ftxui", version = "7.0.3")
python
cc_binary(
    name = "main",
    srcs = ["main.cpp"],
    deps = [
        "@ftxui//:component",
        "@ftxui//:dom",
        "@ftxui//:screen",
    ],
)

Starter template: ftxui-bazel.

Meson ​

FTXUI supports Meson (≥ 1.1.0) both standalone and as a subproject.

ini
[wrap-git]
url = https://github.com/ArthurSonzogni/FTXUI.git
revision = v7.0.3

[provide]
ftxui-screen = ftxui_screen_dep
ftxui-dom = ftxui_dom_dep
ftxui-component = ftxui_component_dep
python
ftxui_component_dep = dependency('ftxui-component',
  fallback: ['ftxui', 'ftxui_component_dep'],
)

executable('my_app',
  'main.cpp',
  dependencies: ftxui_component_dep,
)
bash
meson setup builddir -Dexamples=true -Dtests=true
ninja -C builddir
meson test -C builddir

Manual Build from Source ​

bash
git clone https://github.com/ArthurSonzogni/FTXUI.git
cd FTXUI
cmake -S . -B build -DFTXUI_ENABLE_INSTALL=ON
cmake --build build -j
sudo cmake --install build

Then use find_package(ftxui REQUIRED) in your project's CMakeLists.txt.