mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-05-12 13:31:15 +08:00
Add documentation about Bazel (#1045)
Some checks are pending
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (cl, cl, windows-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (clang, clang++, macos-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (clang, clang++, ubuntu-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (gcc, g++, macos-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (gcc, g++, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (cl, Windows MSVC, windows-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (gcc, Linux GCC, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (llvm, llvm-cov gcov, MacOS clang, macos-latest) (push) Waiting to run
Documentation / documentation (push) Waiting to run
Some checks are pending
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (cl, cl, windows-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (clang, clang++, macos-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (clang, clang++, ubuntu-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (gcc, g++, macos-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (gcc, g++, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (cl, Windows MSVC, windows-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (gcc, Linux GCC, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (llvm, llvm-cov gcov, MacOS clang, macos-latest) (push) Waiting to run
Documentation / documentation (push) Waiting to run
This commit is contained in:
parent
5cfed50702
commit
08b8a3b28f
68
README.md
68
README.md
@ -42,15 +42,24 @@ A simple cross-platform C++ library for terminal based user interfaces!
|
|||||||
* No dependencies
|
* No dependencies
|
||||||
* **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: 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.
|
* Multiple packages:
|
||||||
|
- 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 example project](https://github.com/ArthurSonzogni/ftxui-starter)
|
- [Starter CMake](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
|
||||||
@ -365,33 +374,62 @@ 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)
|
||||||
|
|
||||||
## Utilization
|
## Build using CMake
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
FetchContent_GetProperties(ftxui)
|
target_link_libraries(your_target PRIVATE
|
||||||
if(NOT ftxui_POPULATED)
|
# Chose a submodule
|
||||||
FetchContent_Populate(ftxui)
|
ftxui::component
|
||||||
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
|
ftxui::dom
|
||||||
endif()
|
ftxui::screen
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# 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:
|
||||||
- [bazel](...)
|
- CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred),
|
||||||
- [vcpkg](https://vcpkgx.com/details.html?package=ftxui)
|
- [Bazel](https://registry.bazel.build/modules/ftxui),
|
||||||
- [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/).
|
- [vcpkg](https://vcpkg.link/ports/ftxui),
|
||||||
- [conan.io](https://conan.io/center/ftxui)
|
- [Conan](https://conan.io/center/recipes/ftxui)
|
||||||
- [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/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),
|
||||||
[](https://repology.org/project/libftxui/versions)
|
[](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 . . .
|
||||||
|
@ -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 main # Important: Specify a version or a commit hash here.
|
GIT_TAG 6.1.9
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(ftxui)
|
FetchContent_MakeAvailable(ftxui)
|
||||||
|
|
||||||
@ -94,13 +94,33 @@ target_link_libraries(ftxui-starter
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build
|
### Using Bazel {#build-bazel}
|
||||||
|
|
||||||
```bash
|
See [ftxui module](https://registry.bazel.build/modules/ftxui) from the Bazel
|
||||||
mkdir build && cd build
|
Central Registry.
|
||||||
cmake ..
|
|
||||||
make
|
See also this [starter](https://github.com/ArthurSonzogni/ftxui-bazel) project.
|
||||||
./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}
|
||||||
|
Loading…
Reference in New Issue
Block a user