summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2020-01-15 15:27:59 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2020-02-03 17:55:09 +0800
commitf8d3845b1a06036c3c85b4a52d119567432349fe (patch)
tree0682c1b92fd5eaf88c1a0c7f61acfd90278649c9 /meson.build
parent69ed4c90e5ef9302304dbdce796f899b8b43c703 (diff)
downloadgtk+-f8d3845b1a06036c3c85b4a52d119567432349fe.tar.gz
meson/MSVC builds: Use -utf-8 where available
This avoids the build from erroring out on C4819 (Unicode handling issue in Visual Studio compiler), notably when running on Chinese, Japanese and Korean locales. Also apply -D_USE_MATH_DEFINES, -FImsvc_recommended_pragmas.h and -utf-8 to the C++ compiler options as well.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build14
1 files changed, 11 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 1c3b93aab9..6c265dd41f 100644
--- a/meson.build
+++ b/meson.build
@@ -223,9 +223,17 @@ endif
if cc.get_id() == 'msvc'
# Compiler options taken from msvc_recommended_pragmas.h
# in GLib, based on _Win32_Programming_ by Rector and Newcomer
- test_cflags = []
- add_project_arguments('-FImsvc_recommended_pragmas.h', language: 'c')
- add_project_arguments('-D_USE_MATH_DEFINES', language: 'c')
+ test_cflags = [
+ '-FImsvc_recommended_pragmas.h',
+ '-D_USE_MATH_DEFINES',
+ '-utf-8',
+ ]
+ add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c')
+
+ cxx = meson.get_compiler('cpp')
+ if cxx.get_id() == 'msvc'
+ add_project_arguments(cxx.get_supported_arguments(test_cflags), language: 'cpp')
+ endif
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
test_cflags = [
'-fno-strict-aliasing',