Compare commits

...

8 Commits

Author SHA1 Message Date
ArthurSonzogni
8e055a5a61
update workflow 2025-04-26 01:29:39 +02:00
ArthurSonzogni
378e30bef0
update workflow 2025-04-26 01:25:29 +02:00
ArthurSonzogni
2270fe628f
tmp 2025-04-26 01:14:09 +02:00
ArthurSonzogni
44d25564ee
Fix MSVC 2025-04-26 01:10:42 +02:00
ArthurSonzogni
a9b54106d4
Fix /utf-8 2025-04-26 00:55:47 +02:00
ArthurSonzogni
31ec197811
Set c++ standard. 2025-04-26 00:44:44 +02:00
ArthurSonzogni
3184033f4d
update workdflow. 2025-04-26 00:16:41 +02:00
ArthurSonzogni
632f8032bc
Update workflow. 2025-04-26 00:05:25 +02:00
4 changed files with 67 additions and 28 deletions

View File

@ -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 ...

View File

@ -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",

View File

@ -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">

View File

@ -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(),
)