[gtkmm/meson-msvc-warnings-3-24] meson/MSVC: Apply /wd4828 when building gendef.exe only



commit f0eed85142d9f9571655bad17f5cef6e3f409c54
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon May 23 17:51:38 2022 +0800

    meson/MSVC: Apply /wd4828 when building gendef.exe only
    
    This warning only applies when compiling gendef.cc, when '/utf-8' is also being
    used, so only apply that compiler flag there.  Move the '/utf-8' to be with the
    other warning-related compiler flags for consistency's sake.
    
    Also, only build gendef.exe if it is really needed, i.e., glibmm's gmmproc is
    not able to produce headers that can export gtkmm's symbols via compiler
    directives.

 MSVC_NMake/gendef/meson.build | 7 ++++---
 meson.build                   | 3 +--
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/MSVC_NMake/gendef/meson.build b/MSVC_NMake/gendef/meson.build
index 32babb7d..0fa04f15 100644
--- a/MSVC_NMake/gendef/meson.build
+++ b/MSVC_NMake/gendef/meson.build
@@ -1,9 +1,10 @@
 # MSVC_NMake/gendef
 
 # Input: is_msvc
-# Output: gendef
+# Output: gendef, build_shared_libs_directly
 
 # Used to generate the .def file required to obtain the import .lib file
-if is_msvc
-  gendef = executable('gendef', 'gendef.cc', install: false,)
+if is_msvc and not build_shared_libs_directly
+  gendef_cxx_flags = cpp_compiler.get_supported_arguments(['/wd4828'])
+  gendef = executable('gendef', 'gendef.cc', cpp_args: gendef_cxx_flags, install: false,)
 endif
diff --git a/meson.build b/meson.build
index 0a1d2b3e..7d07eebd 100644
--- a/meson.build
+++ b/meson.build
@@ -275,8 +275,6 @@ use_msvc14x_toolset_ver = get_option('msvc14x-parallel-installable')
 msvc14x_toolset_ver = ''
 
 if is_msvc
-  add_project_arguments(cpp_compiler.get_supported_arguments([ '/utf-8', '/wd4828']), language: ['cpp','c'])
-
   # Check for the first line in a file generated with gmmproc,
   # to see which gmmproc version was used
   if maintainer_mode
@@ -369,6 +367,7 @@ if is_msvc
     '/FImsvc_recommended_pragmas.h', # Turn off harmless warnings but make potentially
                                      # dangerous ones glaring, distributed with GLib
     '/EHsc',  # avoid warnings caused by exception handling model used
+    '/utf-8', # Avoid C4819 unicode conversion warnings when building on CJK locales
     '/wd4152', # nonstandard extension, function/data pointer conversion in expression
     '/wd4245', # 'argument': conversion from 'int' to 'guint', signed/unsigned mismatch
     '/wd4250', # 'class1' : inherits 'class2::member' via dominance


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