Compare commits

..

1 Commits

Author SHA1 Message Date
Miko
5dc053b690
Merge 9e1120c146 into 5cfed50702 2025-05-11 02:01:06 +00:00
2 changed files with 22 additions and 80 deletions

View File

@ -43,24 +43,15 @@ A simple cross-platform C++ library for terminal based user interfaces!
* Module support * Module support
* **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!). * **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
* Learn by [examples](#documentation), and [tutorials](#documentation) * Learn by [examples](#documentation), and [tutorials](#documentation)
* Multiple packages: * Multiple packages: CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred),Bazel, vcpkg, pkgbuild, conan.
- CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred)
- [Bazel](https://registry.bazel.build/modules/ftxui)
- [vcpkg](https://vcpkg.link/ports/ftxui)
- [Conan](https://conan.io/center/recipes/ftxui) [Debian package](https://tracker.debian.org/pkg/ftxui)
- [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui)
- [Arch Linux](https://aur.archlinux.org/packages/ftxui/)
- [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
* Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc... * Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
## Documentation ## Documentation
- [Starter CMake](https://github.com/ArthurSonzogni/ftxui-starter) - [Starter example project](https://github.com/ArthurSonzogni/ftxui-starter)
- [Starter Bazel](https://github.com/ArthurSonzogni/ftxui-bazel)
- [Documentation](https://arthursonzogni.github.io/FTXUI/) - [Documentation](https://arthursonzogni.github.io/FTXUI/)
- [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/) - [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/)
- [Build using CMake](https://arthursonzogni.github.io/FTXUI/#build-cmake) - [Build using CMake](https://arthursonzogni.github.io/FTXUI/#build-cmake)
- [Build using Bazel](https://arthursonzogni.github.io/FTXUI/#build-bazel)
## Example ## Example
~~~cpp ~~~cpp
@ -376,62 +367,33 @@ Several games using the FTXUI have been made during the Game Jam:
- [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md) - [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md)
- [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md) - [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md)
## Build using CMake ## Utilization
It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on. It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on.
```cmake ```cmake
include(FetchContent) include(FetchContent)
FetchContent_Declare(ftxui FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v6.1.9 GIT_TAG v6.1.9
) )
FetchContent_MakeAvailable(ftxui)
target_link_libraries(your_target PRIVATE FetchContent_GetProperties(ftxui)
# Chose a submodule if(NOT ftxui_POPULATED)
ftxui::component FetchContent_Populate(ftxui)
ftxui::dom add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
ftxui::screen endif()
)
``` ```
# Build using Bazel
**MODULE.bazel**
```starlark
bazel_dep(
name = "ftxui",
version = "v6.1.9",
)
```
**BUILD.bazel**
```starlark
cc_binary(
name = "your_target",
srcs = ["your_source.cc"],
deps = [
"@ftxui//:ftxui_component",
"@ftxui//:ftxui_dom",
"@ftxui//:ftxui_screen",
],
)
```
# Build with something else:
If you don't, FTXUI may be used from the following packages: If you don't, FTXUI may be used from the following packages:
- CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred), - [bazel](...)
- [Bazel](https://registry.bazel.build/modules/ftxui), - [vcpkg](https://vcpkgx.com/details.html?package=ftxui)
- [vcpkg](https://vcpkg.link/ports/ftxui), - [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/).
- [Conan](https://conan.io/center/recipes/ftxui) - [conan.io](https://conan.io/center/ftxui)
- [Debian package](https://tracker.debian.org/pkg/ftxui), - [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
- [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui), -
- [Arch Linux](https://aur.archlinux.org/packages/ftxui/),
- [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui),
[![Packaging status](https://repology.org/badge/vertical-allrepos/libftxui.svg)](https://repology.org/project/libftxui/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/libftxui.svg)](https://repology.org/project/libftxui/versions)
If you choose to build and link FTXUI yourself, `ftxui-component` must be first in the linking order relative to the other FTXUI libraries, i.e. If you choose to build and link FTXUI yourself, `ftxui-component` must be first in the linking order relative to the other FTXUI libraries, i.e.
```bash ```bash
g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . . g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . .

View File

@ -81,7 +81,7 @@ include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE) set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG 6.1.9 GIT_TAG main # Important: Specify a version or a commit hash here.
) )
FetchContent_MakeAvailable(ftxui) FetchContent_MakeAvailable(ftxui)
@ -94,33 +94,13 @@ target_link_libraries(ftxui-starter
) )
``` ```
### Using Bazel {#build-bazel} ## Build
See [ftxui module](https://registry.bazel.build/modules/ftxui) from the Bazel ```bash
Central Registry. mkdir build && cd build
cmake ..
See also this [starter](https://github.com/ArthurSonzogni/ftxui-bazel) project. make
./main
**Module.bazel**
```starlark
bazel_dep(
name = "ftxui",
version = "6.1.9",
)
```
**BUILD.bazel**
```starlark
cc_binary(
name = "main",
srcs = ["main.cpp"],
deps = [
# Choose one of the following:
"@ftxui//:dom",
"@ftxui//:screen",
"@ftxui//:component",
],
)
``` ```
# List of modules. {#modules} # List of modules. {#modules}