[gtk-doc/win-no-msys: 15/22] build: Use /utf-8 for MSVC if possible




commit 18bb23732c7903fba9372aba3d4e36ba14cae749
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Apr 14 12:04:54 2020 +0800

    build: Use /utf-8 for MSVC if possible
    
    This avoids seeing C4819 warnings/errors that may be triggered if building on
    an East Asian locale of Windows, as we do in most of the GTK stack.
    
    Also use /FImsvc_recommended_pragmas.h so that we are more careful about how
    the builds are done by filtering out the harmless warnings and flagging down
    the ones that really matter.

 meson.build                   | 1 +
 tests/gobject/src/meson.build | 7 +++++++
 2 files changed, 8 insertions(+)
---
diff --git a/meson.build b/meson.build
index 5d03db6..32306ba 100644
--- a/meson.build
+++ b/meson.build
@@ -168,6 +168,7 @@ configure_file(
 
 subdir('help')
 if get_option('tests')
+  cc = meson.get_compiler('c')
   subdir('tests')
 endif
 
diff --git a/tests/gobject/src/meson.build b/tests/gobject/src/meson.build
index aa1d4e4..155f5af 100644
--- a/tests/gobject/src/meson.build
+++ b/tests/gobject/src/meson.build
@@ -15,10 +15,17 @@ gobject_test_deps = [
   gobject_dep,
 ]
 
+extra_cflags = []
+if cc.get_id() == 'msvc'
+  extra_cflags += '/FImsvc_recommended_pragmas.h'
+  extra_cflags += cc.get_supported_arguments(['/utf-8'])
+endif
+
 gobject_test_lib = shared_library(
   'gobjecttester',
   sources: gobject_test_c,
   dependencies: gobject_test_deps,
+  c_args: extra_cflags,
   install: false,
 )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]