[pangomm/meson.msvc: 2/2] meson.build: Add MSVC-specific warning items



commit 3814b45f7f28ce5d8f12f3497d0ce4374832a445
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Oct 17 13:34:36 2019 +0800

    meson.build: Add MSVC-specific warning items
    
    Let MSVC report warnings that roughly match those reported by the GCC
    builds, but ignore the warnings that aren't really harmful, by referring
    to GLib's msvc_recommended_pragmas.h.

 meson.build | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index b0c9546..55cdfca 100644
--- a/meson.build
+++ b/meson.build
@@ -188,11 +188,23 @@ endif
 # Set compiler warnings.
 warning_flags = []
 if warning_level == 'min'
-  warning_flags = ['-Wall']
+  if is_msvc
+    warning_flags = ['/W3']
+  else
+    warning_flags = ['-Wall']
+  endif
 elif warning_level == 'max' or warning_level == 'fatal'
-  warning_flags = '-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow 
-Wno-long-long'.split()
+  if is_msvc
+    warning_flags = ['/W4']
+  else
+    warning_flags = '-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow 
-Wno-long-long'.split()
+  endif
   if warning_level == 'fatal'
-    warning_flags += ['-Werror']
+    if is_msvc
+      warning_flags += ['/WX']
+    else
+      warning_flags += ['-Werror']
+    endif
     deprecations = 'G PANGO GLIBMM SIGCXX'.split()
     foreach d : deprecations
       warning_flags += '-D@0@_DISABLE_DEPRECATED'.format(d)
@@ -203,6 +215,15 @@ endif
 warning_flags = cpp_compiler.get_supported_arguments(warning_flags)
 add_project_arguments(warning_flags, language: 'cpp')
 
+# MSVC: Ignore warnings that aren't really harmful, but make those
+#       that should not be overlooked stand out.
+if is_msvc
+  foreach wd : ['/FImsvc_recommended_pragmas.h', '/wd4267', '/wd4530']
+    disabled_warning = cpp_compiler.get_supported_arguments(wd)
+    add_project_arguments(disabled_warning, language: 'cpp')
+  endforeach
+endif
+
 subdir('tools/extra_defs_gen')
 subdir('MSVC_NMake/gendef')
 subdir('pango')


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