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



commit f6b3e4d4b4ad1eb0329386966774c7295b032f44
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 021b117..5ef959b 100644
--- a/meson.build
+++ b/meson.build
@@ -192,11 +192,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)
@@ -207,6 +219,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]