[glibmm] NMake Makefiles: Use Toolset version in DLL names by default



commit 31766b449c4f87ba31ad85002e8ba9c48327f953
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jun 16 15:16:57 2020 +0800

    NMake Makefiles: Use Toolset version in DLL names by default
    
    This updates the build to use the toolset version in the final DLL
    and .lib filenames, similar to what is done in Boost, instead of
    the Visual Studio version.
    
    This means that by default, we will use 'vc141' instead of 'vc150'
    in Visual Studio 2017 builds, and 'vc142' instead of 'vc160' in
    Visual Studio 2019 builds.
    
    If using the former naming is desired, use 'USE_COMPAT_LIBS=1' in
    the NMake command line, albeit all such binaries will now be named
    with 'vc150' in the DLL and library bames

 MSVC_NMake/config-msvc.mak    | 14 +++++++-------
 MSVC_NMake/detectenv-msvc.mak | 45 ++++++++++++++++++++++++++++---------------
 README.win32                  | 13 +++++++++++++
 3 files changed, 50 insertions(+), 22 deletions(-)
---
diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak
index 636ed398..9cd20422 100644
--- a/MSVC_NMake/config-msvc.mak
+++ b/MSVC_NMake/config-msvc.mak
@@ -47,22 +47,22 @@ LIBGIOMM_CFLAGS = /DGIOMM_BUILD /DSIZEOF_WCHAR_T=2 $(GIOMM_BASE_CFLAGS) $(GLIBMM
 GLIBMM_EX_CFLAGS = $(GLIBMM_BASE_CFLAGS) $(GLIBMM_EXTRA_INCLUDES)
 GIOMM_EX_CFLAGS = $(GIOMM_BASE_CFLAGS) $(GLIBMM_EXTRA_INCLUDES)
 
-# We build glibmm-vc$(VSVER)0-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll or
-#          glibmm-vc$(VSVER)0-d-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll at least
-#          giomm-vc$(VSVER)0-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll or
-#          giomm-vc$(VSVER)0-d-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll at least
+# We build glibmm-vc$(VSVER_LIB)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll or
+#          glibmm-vc$(VSVER_LIB)-d-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll at least
+#          giomm-vc$(VSVER_LIB)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll or
+#          giomm-vc$(VSVER_LIB)-d-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION).dll at least
 
 !ifdef USE_MESON_LIBS
 LIBSIGC_LIBNAME = sigc-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)
 LIBSIGC_DLL = $(LIBSIGC_LIBNAME)-0.dll
 !else
-LIBSIGC_LIBNAME = sigc-vc$(VSVER)0$(DEBUG_SUFFIX)-$(LIBSIGC_MAJOR_VERSION)_$(LIBSIGC_MINOR_VERSION)
+LIBSIGC_LIBNAME = sigc-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(LIBSIGC_MAJOR_VERSION)_$(LIBSIGC_MINOR_VERSION)
 LIBSIGC_DLL = $(LIBSIGC_LIBNAME).dll
 !endif
 
 LIBSIGC_LIB = $(LIBSIGC_LIBNAME).lib
 
-GLIBMM_LIBNAME = glibmm-vc$(VSVER)0$(DEBUG_SUFFIX)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION)
+GLIBMM_LIBNAME = glibmm-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION)
 
 GLIBMM_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(GLIBMM_LIBNAME).dll
 GLIBMM_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(GLIBMM_LIBNAME).lib
@@ -70,7 +70,7 @@ GLIBMM_EXTRA_DEFS_GEN_LIBNAME = glibmm_generate_extra_defs-$(GLIBMM_MAJOR_VERSIO
 GLIBMM_EXTRA_DEFS_GEN_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(GLIBMM_EXTRA_DEFS_GEN_LIBNAME).dll
 GLIBMM_EXTRA_DEFS_GEN_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(GLIBMM_EXTRA_DEFS_GEN_LIBNAME).lib
 
-GIOMM_LIBNAME = giomm-vc$(VSVER)0$(DEBUG_SUFFIX)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION)
+GIOMM_LIBNAME = giomm-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION)
 
 GIOMM_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(GIOMM_LIBNAME).dll
 GIOMM_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(GIOMM_LIBNAME).lib
diff --git a/MSVC_NMake/detectenv-msvc.mak b/MSVC_NMake/detectenv-msvc.mak
index e7ae937d..df6f2e67 100644
--- a/MSVC_NMake/detectenv-msvc.mak
+++ b/MSVC_NMake/detectenv-msvc.mak
@@ -79,34 +79,49 @@ _HASH=^#
 !if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
 !endif
 
+VSVER = 0
+PDBVER = 0
+VSVER_SUFFIX = 0
+
 !if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
-VSVER = 9
+PDBVER = 9
 !elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
-VSVER = 10
+PDBVER = 10
 !elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
-VSVER = 11
+PDBVER = 11
 !elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
-VSVER = 12
-!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 1910
-VSVER = 14
-!elseif $(VCVERSION) > 1909 && $(VCVERSION) < 2000
+PDBVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
+PDBVER = 14
+!if $(VCVERSION) > 1909 && $(VCVERSION) < 1920
+VSVER_SUFFIX = 1
 VSVER = 15
+!elseif $(VCVERSION) > 1919 && $(VCVERSION) < 2000
+VSVER_SUFFIX = 2
+VSVER = 16
 !else
-VSVER = 0
+VSVER = $(PDBVER)
+!endif
+!else
+VSVER = $(PDBVER)
+!endif
+
+!if $(VSVER) > 14 && "$(USE_COMPAT_LIBS)" != ""
+!if $(VSVER) > 15
+VSVER_LIB = 150
+!else
+VSVER_LIB = $(PDBVER)0
+!endif
+!else
+VSVER_LIB = $(PDBVER)$(VSVER_SUFFIX)
 !endif
 
 !if "$(VSVER)" == "0"
 MSG = ^
 This NMake Makefile set supports Visual Studio^
-9 (2008) through 15 (2017).  Your Visual Studio^
+9 (2008) through 16 (2019).  Your Visual Studio^
 version is not supported.
 !error $(MSG)
-!else
-!if $(VSVER) < 15
-PDBVER = $(VSVER)
-!else
-PDBVER = 14
-!endif
 !endif
 
 VALID_CFGSET = FALSE
diff --git a/README.win32 b/README.win32
index b4ef3a9e..1852bc53 100644
--- a/README.win32
+++ b/README.win32
@@ -57,6 +57,19 @@ it must be specified via passing in GLIB_COMPILE_SCHEMAS.  If using C++
 dependencies that are built with Meson, specify USE_MESON_LIBS=1 in your
 NMake command line.
 
+Note that $(VSVER) refers to 15 for Visual Studio 2017 and 16 for Visual
+Studio 2019.  Note that it is recommended and possibly required to build
+glibmm and anything that depends on glibmm with the same Visual Studio
+version, even for Visual Studio 2017 and 2019 which Microsoft tried
+very hard to make the binaries API and ABI compatible between these versions.
+
+The build now creates DLLs and .lib's based on the toolset version (i.e.
+'vc141' for Visual Studio 2017 builds and 'vc142' for Visual Studio 2019
+builds instead of vc$(VSVER)0 as before, to be consistent across the board).
+Since it might be desired to use the old naming scheme, a 'USE_COMPAT_LIBS=1'
+may be used for such situations, such as when re-building dependent code is
+inconvenient.
+
 A 'tests' target will build the test programs for glibmm and giomm, an
 'install' target is provided to copy the built DLLs and LIBs, along with
 with the public headers to appropriate subdirs of $(PREFIX).  A 'clean'


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