[gtk/gtk-3-24-meson: 91/94] meson.build: Output DLL names similar to the MSVC projects



commit 55db1a028f1a04621977a65ade2f800e86cd5ca2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Apr 4 10:15:27 2019 +0800

    meson.build: Output DLL names similar to the MSVC projects
    
    This makes the DLL names match those that are produced by the Visual
    Studio projects by default.
    
    This, currently, however, names the .lib files same as the ones that
    are produced for other platforms (i.e. <libname>-3.lib).  This is
    actually not that bad as one can just copy those .lib's into
    <libname>-3.0.lib when needed and the binaries that link to those .lib's
    ultimately link to the same DLLs, so this should not harm binary
    compatibility.

 meson.build | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index bf91cf612f..b6a9ddd062 100644
--- a/meson.build
+++ b/meson.build
@@ -81,7 +81,29 @@ gtk_binary_age = 100 * gtk_minor_version + gtk_micro_version
 cc = meson.get_compiler('c')
 
 if cc.get_id() == 'msvc'
-  gtk_soversion = 'vs@0@'.format(cc.version().split('.')[0])
+  vsver = 0
+  mscver = cc.version().split('.')[0].to_int()
+
+  # pre-Visual Studio 2015 (18.xx.xxxxx or earlier): just subtract 6 from major
+  # version of cc.version() to get the Visual Studio version
+  if mscver < 19
+    vsver = mscver - 6
+  else
+    # Visual Studio 2015 and later (19.xx.xxxxx or later): look at the minor version.
+    # If minor version < 10: Visual Studio 2015,
+    #    10 < minor version < 20: Visual Studio 2017,
+    #    20 < minor version: Visual Studio 2019
+    mscsubver = cc.version().split('.')[1].to_int()
+    if mscsubver < 10
+      vsver = 14
+    elif mscsubver < 20
+      vsver = 15
+    else
+      vsver = 16
+    endif
+  endif
+
+  gtk_soversion = 'vs@0@'.format(vsver)
 else
   gtk_soversion = '0'
 endif


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