This commit is contained in:
ArthurSonzogni 2025-04-26 01:10:42 +02:00
parent a9b54106d4
commit 44d25564ee
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C
2 changed files with 17 additions and 7 deletions

View File

@ -17,6 +17,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load(":bazel/ftxui.bzl", "ftxui_cc_library")
load(":bazel/ftxui.bzl", "generate_examples")
load(":bazel/ftxui.bzl", "cpp20")
load(":bazel/ftxui.bzl", "msvc_copts")
package(default_visibility = ["//visibility:public"])
@ -243,7 +244,7 @@ cc_test(
"include",
"src",
],
copts = cpp20(),
copts = cpp20() + msvc_copts(),
deps = [
"//:ftxui",
"@googletest//:gtest_main",

View File

@ -20,11 +20,20 @@ def cpp20():
"//conditions:default": ["-std=c++20"],
})
# Force Microsoft Visual Studio to decode sources files in UTF-8, as it should.
def utf8():
def msvc_copts():
return select({
"@rules_cc//cc/compiler:msvc-cl": ["/utf-8"],
"@rules_cc//cc/compiler:clang-cl": ["/utf-8"],
"@rules_cc//cc/compiler:msvc-cl": [
# 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",
],
"//conditions:default": [],
})
@ -47,7 +56,7 @@ def ftxui_cc_library(
"include",
"src",
],
copts = cpp17() + utf8(),
copts = cpp17() + msvc_copts(),
visibility = ["//visibility:public"],
)
@ -68,5 +77,5 @@ def generate_examples():
name = name,
srcs = [src],
deps = ["//:component"],
copts = cpp20() + utf8(),
copts = cpp20() + msvc_copts(),
)