mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-06-24 16:21:12 +08:00
Update workflow
This commit is contained in:
parent
aa6d1df1dd
commit
ee80e956dd
@ -13,7 +13,7 @@ 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", "cpp20")
|
||||||
load(":bazel/ftxui.bzl", "msvc_copts")
|
load(":bazel/ftxui.bzl", "windows_copts")
|
||||||
load(":bazel/ftxui.bzl", "pthread_linkopts")
|
load(":bazel/ftxui.bzl", "pthread_linkopts")
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
@ -241,7 +241,7 @@ cc_test(
|
|||||||
"include",
|
"include",
|
||||||
"src",
|
"src",
|
||||||
],
|
],
|
||||||
copts = cpp20() + msvc_copts(),
|
copts = cpp20() + windows_copts(),
|
||||||
deps = [
|
deps = [
|
||||||
"//:ftxui",
|
"//:ftxui",
|
||||||
"@googletest//:gtest_main",
|
"@googletest//:gtest_main",
|
||||||
|
@ -20,23 +20,42 @@ def cpp20():
|
|||||||
"//conditions:default": ["-std=c++20"],
|
"//conditions:default": ["-std=c++20"],
|
||||||
})
|
})
|
||||||
|
|
||||||
def msvc_copts():
|
# Microsoft terminal is a bit buggy ¯\_(ツ)_/¯ and MSVC uses bad defaults.
|
||||||
|
def windows_copts():
|
||||||
MSVC_COPTS = [
|
MSVC_COPTS = [
|
||||||
# Force Microsoft Visual Studio to decode sources files in UTF-8.
|
# Microsoft Visual Studio must decode sources files as UTF-8.
|
||||||
"/utf-8",
|
"/utf-8",
|
||||||
|
|
||||||
# Force Microsoft Visual Studio to interpret the source files as
|
# Microsoft Visual Studio must interpret the codepoint using unicode.
|
||||||
# Unicode.
|
|
||||||
"/DUNICODE",
|
"/DUNICODE",
|
||||||
"/D_UNICODE",
|
"/D_UNICODE",
|
||||||
|
|
||||||
# Fallback for Microsoft Terminal.
|
# Fallback for Microsoft Terminal.
|
||||||
|
# This
|
||||||
|
# - Replace missing font symbols by others.
|
||||||
|
# - Reduce screen position pooling frequency to deals against a Microsoft
|
||||||
|
# race condition. This was fixed in 2020, but clients never not updated.
|
||||||
|
# - https://github.com/microsoft/terminal/pull/7583
|
||||||
|
# - https://github.com/ArthurSonzogni/FTXUI/issues/136
|
||||||
"/DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
"/DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
WINDOWS_COPTS = [
|
||||||
|
# Fallback for Microsoft Terminal.
|
||||||
|
# This
|
||||||
|
# - Replace missing font symbols by others.
|
||||||
|
# - Reduce screen position pooling frequency to deals against a Microsoft
|
||||||
|
# race condition. This was fixed in 2020, but clients never not updated.
|
||||||
|
# - https://github.com/microsoft/terminal/pull/7583
|
||||||
|
# - https://github.com/ArthurSonzogni/FTXUI/issues/136
|
||||||
|
"-DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
||||||
|
];
|
||||||
|
|
||||||
return select({
|
return select({
|
||||||
|
# MSVC:
|
||||||
"@rules_cc//cc/compiler:msvc-cl": MSVC_COPTS,
|
"@rules_cc//cc/compiler:msvc-cl": MSVC_COPTS,
|
||||||
"@rules_cc//cc/compiler:clang-cl": MSVC_COPTS,
|
"@rules_cc//cc/compiler:clang-cl": MSVC_COPTS,
|
||||||
|
"@platforms//os:windows": WINDOWS_COPTS,
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -69,10 +88,12 @@ def ftxui_cc_library(
|
|||||||
"include",
|
"include",
|
||||||
"src",
|
"src",
|
||||||
],
|
],
|
||||||
copts = cpp17() + msvc_copts(),
|
copts = cpp17() + windows_copts(),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Compile all the examples in the examples/ directory.
|
||||||
|
# This is useful to check the Bazel is synchronized with CMake definitions.
|
||||||
def generate_examples():
|
def generate_examples():
|
||||||
cpp_files = native.glob(["examples/**/*.cpp"])
|
cpp_files = native.glob(["examples/**/*.cpp"])
|
||||||
|
|
||||||
@ -90,5 +111,5 @@ def generate_examples():
|
|||||||
name = name,
|
name = name,
|
||||||
srcs = [src],
|
srcs = [src],
|
||||||
deps = ["//:component"],
|
deps = ["//:component"],
|
||||||
copts = cpp20() + msvc_copts(),
|
copts = cpp20() + windows_copts(),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user