Address @robinlinden comments 2

This commit is contained in:
ArthurSonzogni 2025-05-07 21:11:03 +02:00
parent f917f7bcc8
commit 2fdd100b55
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C
5 changed files with 41 additions and 45 deletions

View File

@ -1,2 +1,7 @@
build --features=layering_check build --features=layering_check
build --enable_bzlmod build --enable_bzlmod
build --enable_platform_specific_config
build:linux --cxxopt=-std=c++17
build:macos --cxxopt=-std=c++17
build:windows --cxxopt=-std:c++17

View File

@ -1,26 +1,42 @@
matrix: matrix:
# Note that gcc 9 and earlier aren't supported due to using --std=c++2a
# instead of --std=c++20
platform:
- debian11
- ubuntu2204
- macos
- macos-arm64
- windows
bazel: bazel:
#- 6.x -> Build fails with bazel 6.x - 7.x
- 7.x - 8.x
- 8.x - rolling
unix_platform:
- debian11
- ubuntu2204
- macos
- macos_arm64
win_platform:
- windows
tasks: tasks:
verify_targets:
name: Build and test. unix_test:
platform: ${{ platform }} name: Verify build targets on Unix
platform: ${{ unix_platform }}
bazel: ${{ bazel }} bazel: ${{ bazel }}
build_flags:
- --cxxopt=-std=c++17
build_targets: build_targets:
- '@ftxui//:ftxui'
- '@ftxui//:screen'
- '@ftxui//:dom' - '@ftxui//:dom'
- '@ftxui//:component' - '@ftxui//:component'
- '@ftxui//:screen'
test_targets: test_targets:
- '@ftxui//:tests' - '@ftxui//:tests'
windows_test:
name: Verify build targets
platform: ${{ win_platform }}
bazel: ${{ bazel }}
build_flags:
- --cxxopt=/std:c++17
build_targets:
- '@ftxui//:dom'
- '@ftxui//:component'
- '@ftxui//:screen'
test_targets:
- '@ftxui//:tests'

View File

@ -12,7 +12,6 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load(":bazel/ftxui.bzl", "ftxui_cc_library") load(":bazel/ftxui.bzl", "ftxui_cc_library")
load(":bazel/ftxui.bzl", "generate_examples") load(":bazel/ftxui.bzl", "generate_examples")
load(":bazel/ftxui.bzl", "cpp20")
load(":bazel/ftxui.bzl", "windows_copts") load(":bazel/ftxui.bzl", "windows_copts")
load(":bazel/ftxui.bzl", "pthread_linkopts") load(":bazel/ftxui.bzl", "pthread_linkopts")
@ -258,7 +257,7 @@ cc_test(
"include", "include",
"src", "src",
], ],
copts = cpp20() + windows_copts(), copts = windows_copts(),
deps = [ deps = [
":screen", ":screen",
":dom", ":dom",

View File

@ -3,24 +3,6 @@
load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_binary") load("@rules_cc//cc:defs.bzl", "cc_binary")
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"],
})
# Microsoft terminal is a bit buggy ¯\_(ツ)_/¯ and MSVC uses bad defaults. # Microsoft terminal is a bit buggy ¯\_(ツ)_/¯ and MSVC uses bad defaults.
def windows_copts(): def windows_copts():
MSVC_COPTS = [ MSVC_COPTS = [
@ -90,7 +72,7 @@ def ftxui_cc_library(
"include", "include",
"src", "src",
], ],
copts = cpp17() + windows_copts(), copts = windows_copts(),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
@ -118,5 +100,5 @@ def generate_examples():
":dom", ":dom",
":screen", ":screen",
], ],
copts = cpp20() + windows_copts(), copts = windows_copts(),
) )

View File

@ -1,14 +1,8 @@
# This script tests the project with different versions of Bazel and compilers # This script tests the project with different versions of Bazel and compilers
# locally. This avoids waiting on the CI to run the tests. # locally. This avoids waiting on the CI to run the tests.
# Version
# -------
# - Version >= 7 are supported
# - Version <= 6 fail with the error:
# Error:
# external/googletest~1.14.0.bcr.1/googletest/include/gtest/internal/gtest-port.h:279:2:
# error: #error C++ versions less than C++14 are not supported.
for ver in \ for ver in \
"6.0.0" \
"7.0.0" \ "7.0.0" \
"8.0.0" "8.0.0"
do do