From 0432b22e0208289a3ddf459de183a001b93b0323 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 4 Apr 2019 10:15:27 +0800 Subject: [PATCH] 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. -3.lib). This is actually not that bad as one can just copy those .lib's into -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