From d2d343e03123e9201574086908d28b915ef9a37f Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 4 Feb 2020 14:18:02 -0800 Subject: [PATCH 1/2] Minor GN fixes for Windows clang builds Fixes two issues that causes errors with Windows clang builds: - Turns off deprecation warnings related to codecvt until we decide on a replacement. - Allows the depracated POSIX names for functions on Windows in third_party/txt (until/unless we decide to wrap them all). --- fml/BUILD.gn | 3 +++ shell/platform/common/cpp/BUILD.gn | 5 +++++ third_party/txt/BUILD.gn | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/fml/BUILD.gn b/fml/BUILD.gn index ef0e996daea6d..d1d6f45870816 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -202,6 +202,9 @@ source_set("fml") { "platform/win/paths_win.cc", "platform/win/wstring_conversion.h", ] + + # For wstring_conversion. See issue #50053. + defines = [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ] } else { sources += [ "platform/posix/file_posix.cc", diff --git a/shell/platform/common/cpp/BUILD.gn b/shell/platform/common/cpp/BUILD.gn index 4646e5c68c9ca..b4d5b0a5bf88b 100644 --- a/shell/platform/common/cpp/BUILD.gn +++ b/shell/platform/common/cpp/BUILD.gn @@ -53,6 +53,11 @@ source_set("common_cpp") { # won't have a JSON dependency. defines = [ "USE_RAPID_JSON" ] deps += [ "//third_party/rapidjson" ] + + if (is_win) { + # For wstring_conversion. See issue #50053. + defines += [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ] + } } copy("publish_headers") { diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn index 63bf09e444457..e3f07f558736e 100644 --- a/third_party/txt/BUILD.gn +++ b/third_party/txt/BUILD.gn @@ -28,6 +28,14 @@ config("txt_config") { include_dirs = [ "src" ] } +config("allow_posix_names") { + if (is_win && is_clang) { + # POSIX names of many functions are marked deprecated by default; + # disable that since they are used for cross-platform compatibility. + defines = [ "_CRT_NONSTDC_NO_DEPRECATE" ] + } +} + source_set("txt") { defines = [] if (flutter_use_fontconfig) { @@ -296,6 +304,8 @@ executable("txt_unittests") { ] } + configs += [ ":allow_posix_names" ] + deps = [ ":txt", ":txt_test_utils", From 50e3c3a412a171c3cefc44071a421c237c0bb188 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 4 Feb 2020 14:22:13 -0800 Subject: [PATCH 2/2] Add missing is_win check --- fml/BUILD.gn | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fml/BUILD.gn b/fml/BUILD.gn index d1d6f45870816..04ce5527fef7d 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -203,8 +203,10 @@ source_set("fml") { "platform/win/wstring_conversion.h", ] - # For wstring_conversion. See issue #50053. - defines = [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ] + if (is_win) { + # For wstring_conversion. See issue #50053. + defines = [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ] + } } else { sources += [ "platform/posix/file_posix.cc",