mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-06-24 16:21:12 +08:00
Fix MSVC
This commit is contained in:
parent
a9b54106d4
commit
44d25564ee
@ -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",
|
||||
|
@ -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(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user