mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-07-31 10:01:13 +08:00
Compare commits
8 Commits
1d7d84c155
...
8e055a5a61
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8e055a5a61 | ||
![]() |
378e30bef0 | ||
![]() |
2270fe628f | ||
![]() |
44d25564ee | ||
![]() |
a9b54106d4 | ||
![]() |
31ec197811 | ||
![]() |
3184033f4d | ||
![]() |
632f8032bc |
28
.github/workflows/build.yaml
vendored
28
.github/workflows/build.yaml
vendored
@ -17,20 +17,19 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Linux GCC
|
||||
os: ubuntu-latest
|
||||
- os: ubuntu-latest
|
||||
compiler: gcc
|
||||
|
||||
- name: Linux Clang
|
||||
os: ubuntu-latest
|
||||
- os: ubuntu-latest
|
||||
compiler: llvm
|
||||
|
||||
- name: MacOS clang
|
||||
os: macos-latest
|
||||
- os: macos-latest
|
||||
compiler: llvm
|
||||
|
||||
- name: Windows MSVC
|
||||
os: windows-latest
|
||||
- os: macos-latest
|
||||
compiler: gcc
|
||||
|
||||
- os: windows-latest
|
||||
compiler: cl
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
@ -38,19 +37,6 @@ jobs:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Setup Cpp"
|
||||
uses: aminya/setup-cpp@v1
|
||||
with:
|
||||
compiler: ${{ matrix.compiler }}
|
||||
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
|
||||
|
||||
- name: "Install Bazel"
|
||||
uses: bazel-contrib/setup-bazel@0.14.0
|
||||
|
||||
# Need on macos. See https://github.com/bazelbuild/bazel/issues/21718
|
||||
- name: Clean Bazel cache
|
||||
run: bazel clean --expunge
|
||||
|
||||
- name: "Build with Bazel"
|
||||
run: bazel build ...
|
||||
|
||||
|
10
BUILD.bazel
10
BUILD.bazel
@ -14,7 +14,11 @@
|
||||
# - Support WebAssembly
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load(":bazel/ftxui.bzl", "ftxui_cc_library", "generate_examples")
|
||||
load(":bazel/ftxui.bzl", "ftxui_cc_library")
|
||||
load(":bazel/ftxui.bzl", "generate_examples")
|
||||
load(":bazel/ftxui.bzl", "cpp20")
|
||||
load(":bazel/ftxui.bzl", "msvc_copts")
|
||||
load(":bazel/ftxui.bzl", "pthread_linkopts")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
@ -181,7 +185,7 @@ ftxui_cc_library(
|
||||
"include/ftxui/component/screen_interactive.hpp",
|
||||
"include/ftxui/component/task.hpp",
|
||||
],
|
||||
linkopts = ["-lpthread"],
|
||||
linkopts = pthread_linkopts(),
|
||||
deps = [":dom"],
|
||||
)
|
||||
|
||||
@ -237,11 +241,11 @@ cc_test(
|
||||
# - "src/ftxui/component/screen_interactive_test.cpp",
|
||||
# - "src/ftxui/dom/selection_test.cpp",
|
||||
],
|
||||
copts = ["-std=c++20"],
|
||||
includes = [
|
||||
"include",
|
||||
"src",
|
||||
],
|
||||
copts = cpp20() + msvc_copts(),
|
||||
deps = [
|
||||
"//:ftxui",
|
||||
"@googletest//:gtest_main",
|
||||
|
@ -42,7 +42,7 @@ A simple cross-platform C++ library for terminal based user interfaces!
|
||||
* No dependencies
|
||||
* **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
|
||||
* 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), 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, vcpkg, pkgbuild, conan.
|
||||
* Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
|
||||
|
||||
## Documentation
|
||||
@ -383,6 +383,7 @@ endif()
|
||||
```
|
||||
|
||||
If you don't, FTXUI may be used from the following packages:
|
||||
- [bazel](...)
|
||||
- [vcpkg](https://vcpkgx.com/details.html?package=ftxui)
|
||||
- [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/).
|
||||
- [conan.io](https://conan.io/center/ftxui)
|
||||
@ -395,8 +396,6 @@ If you choose to build and link FTXUI yourself, `ftxui-component` must be first
|
||||
g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . .
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://github.com/ArthurSonzogni/FTXUI/graphs/contributors">
|
||||
|
@ -2,12 +2,61 @@
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def cpp17():
|
||||
return select({
|
||||
"@rules_cc//cc/compiler:msvc-cl": ["/std:c++17"],
|
||||
"@rules_cc//cc/compiler:clang-cl": ["/std:c++17"],
|
||||
"@rules_cc//cc/compiler:clang": ["-std=c++17"],
|
||||
"@rules_cc//cc/compiler:gcc": ["-std=c++17"],
|
||||
"//conditions:default": ["-std=c++17"],
|
||||
})
|
||||
|
||||
def cpp20():
|
||||
return select({
|
||||
"@rules_cc//cc/compiler:msvc-cl": ["/std:c++20"],
|
||||
"@rules_cc//cc/compiler:clang-cl": ["/std:c++20"],
|
||||
"@rules_cc//cc/compiler:clang": ["-std=c++20"],
|
||||
"@rules_cc//cc/compiler:gcc": ["-std=c++20"],
|
||||
"//conditions:default": ["-std=c++20"],
|
||||
})
|
||||
|
||||
def msvc_copts():
|
||||
MSVC_COPTS = [
|
||||
# Force Microsoft Visual Studio to decode sources files in UTF-8.
|
||||
"/utf-8",
|
||||
|
||||
# Force Microsoft Visual Studio to interpret the source files as
|
||||
# Unicode.
|
||||
"/DUNICODE",
|
||||
"/D_UNICODE",
|
||||
|
||||
# Fallback for Microsoft Terminal.
|
||||
"/DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
||||
]
|
||||
|
||||
return select({
|
||||
"@rules_cc//cc/compiler:msvc-cl": MSVC_COPTS,
|
||||
"@rules_cc//cc/compiler:clang-cl": MSVC_COPTS,
|
||||
"//conditions:default": [],
|
||||
})
|
||||
|
||||
def pthread_linkopts():
|
||||
return select({
|
||||
# With MSVC, threading is already built-in (you don't need -pthread.
|
||||
"@rules_cc//cc/compiler:msvc-cl": [],
|
||||
"@rules_cc//cc/compiler:clang-cl": [],
|
||||
"@rules_cc//cc/compiler:clang": ["-pthread"],
|
||||
"@rules_cc//cc/compiler:gcc": ["-pthread"],
|
||||
"//conditions:default": ["-pthread"],
|
||||
})
|
||||
|
||||
def ftxui_cc_library(
|
||||
name,
|
||||
srcs,
|
||||
hdrs,
|
||||
linkopts = [],
|
||||
deps = []):
|
||||
|
||||
cc_library(
|
||||
name = name,
|
||||
srcs = srcs,
|
||||
@ -20,7 +69,7 @@ def ftxui_cc_library(
|
||||
"include",
|
||||
"src",
|
||||
],
|
||||
copts = ["-std=c++17"],
|
||||
copts = cpp17() + msvc_copts(),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@ -41,4 +90,5 @@ def generate_examples():
|
||||
name = name,
|
||||
srcs = [src],
|
||||
deps = ["//:component"],
|
||||
copts = cpp20() + msvc_copts(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user