Back to Ftxui

Configure (library only)

doc/installation_meson.md

7.0.02.8 KB
Original Source

@page installation_meson Meson

@tableofcontents

FTXUI supports Meson as an alternative build system.

Prerequisites

  • C++17 compatible compiler (GCC >= 7, Clang >= 5, MSVC >= 2017)
  • Meson >= 1.1.0
  • Ninja (recommended backend)

Quick Start

bash
# Configure (library only)
meson setup builddir

# Build
ninja -C builddir

# Install
ninja -C builddir install

Build Options

OptionDefaultDescription
examplesfalseBuild example applications
testsfalseBuild and run tests

Build with examples

bash
meson setup builddir -Dexamples=true
ninja -C builddir

Build with tests

bash
meson setup builddir -Dtests=true
ninja -C builddir
meson test -C builddir

Build everything

bash
meson setup builddir -Dexamples=true -Dtests=true
ninja -C builddir
meson test -C builddir

Dependencies

Google Test (tests only)

When tests are enabled, FTXUI depends on Google Test (v1.17.0).

The dependency resolution follows the same strategy as the CMake build:

  1. System-installed gtest: If gtest is available via pkg-config or system paths, it will be used directly.
  2. Automatic download (fallback): If not found on the system, Meson will automatically download gtest v1.17.0 via the WrapDB using the subprojects/gtest.wrap file.

No manual intervention is required — Meson handles this transparently.

Library Targets

The build produces three libraries:

LibraryDescription
libftxui-screenTerminal rendering and input
libftxui-domLayout and styling elements
libftxui-componentInteractive UI components

Dependencies between them:

component → dom → screen

Using FTXUI as a Meson Subproject

To use FTXUI in your own Meson project, create a wrap file at subprojects/ftxui.wrap:

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

[provide]
ftxui-screen = ftxui_screen_dep
ftxui-dom = ftxui_dom_dep
ftxui-component = ftxui_component_dep

Then in your meson.build:

meson
ftxui_component_dep = dependency('ftxui-component',
  fallback: ['ftxui', 'ftxui_component_dep'],
)

executable('my_app',
  'main.cpp',
  dependencies: ftxui_component_dep,
)

Reconfiguring

To change options after initial configuration:

bash
meson configure builddir -Dtests=true
ninja -C builddir

Clean Build

bash
rm -rf builddir
meson setup builddir