Systèmes de build
Intégrez directement FTXUI avec CMake, Bazel, Meson, ou compilez-le et installez-le manuellement depuis les sources.
CMake
cmake
include(FetchContent)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/FTXUI
GIT_TAG v7.0.3 # Remplacez par une version, un tag ou un hash de commit
)
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
# Exécutez d'abord :
# 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
)Options CMake
| Option | Description | Valeur par défaut |
|---|---|---|
FTXUI_BUILD_EXAMPLES | Compiler les exemples fournis | OFF |
FTXUI_BUILD_DOCS | Compiler la documentation | OFF |
FTXUI_BUILD_TESTS | Activer les tests unitaires | OFF |
FTXUI_ENABLE_INSTALL | Générer les cibles d'installation | ON |
Modèle de démarrage : ftxui-starter.
Bazel (Bzlmod)
FTXUI est référencé dans le 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",
],
)Modèle de démarrage : ftxui-bazel.
Meson
FTXUI prend en charge Meson (≥ 1.1.0) aussi bien en autonomie que comme sous-projet.
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_deppython
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 builddirCompilation manuelle depuis les sources
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 buildUtilisez ensuite find_package(ftxui REQUIRED) dans le CMakeLists.txt de votre projet.