summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2020-06-18 11:34:39 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2020-06-18 14:31:29 +0800
commitdfa750203deb26f57fc1d2024366bd9fbd17ad76 (patch)
treeae1dcf1c5be0dc1290118435c5ba79dc15d90710
parent2db1529957783a4f141892586a4d6a6528665a1f (diff)
downloadglibmm-dfa750203deb26f57fc1d2024366bd9fbd17ad76.tar.gz
Meson/Visual Studio builds: Include toolset version by default
This makes the built DLL and .lib's contain the toolset version if the build is carried out using Visual Studio 2017 or later, unless the 'msvc14x-parallel-installable' option is set to be false during configuration. The reasoning behind this change is that there are subtle problems when, for instance, one tries to link to a Visual Studio 2017-built glibmm when building gtkmm and libxml++ with Visual Studio 2019. This is unfortunate as Microsoft did try hard to make interoperating between binaries built with Visual Studio 2015, 2017 and 2019 as easy as possible in terms of ABI and API, but unfortunately this hits the corner cases where this compatibility does not work. As the name suggests, this attempts to make Visual Studio 2017 and 2019 builds share a single set of underlying C DLLs easier, while avoiding breakages caused by such subtle differences.
-rw-r--r--README.win326
-rw-r--r--configure.ac1
-rw-r--r--gio/giomm-uninstalled.pc.in2
-rw-r--r--gio/giomm.pc.in2
-rw-r--r--gio/giomm/meson.build6
-rw-r--r--glib/glibmm-uninstalled.pc.in2
-rw-r--r--glib/glibmm.pc.in2
-rw-r--r--glib/glibmm/meson.build6
-rw-r--r--glib/meson.build3
-rw-r--r--meson.build20
-rw-r--r--meson_options.txt2
-rw-r--r--tools/extra_defs_gen/meson.build4
12 files changed, 42 insertions, 14 deletions
diff --git a/README.win32 b/README.win32
index 1852bc53..ecf547a1 100644
--- a/README.win32
+++ b/README.win32
@@ -68,7 +68,11 @@ The build now creates DLLs and .lib's based on the toolset version (i.e.
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.
+inconvenient. For the Meson builds, pass in the option
+'-Dmsvc14x-parallel-installable=false' to the Meson configure command line
+to avoid having the toolset version in the final DLL and .lib filenames;
+again, this is only recommended if it is inconvenient to re-build the
+dependent code.
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
diff --git a/configure.ac b/configure.ac
index 24bc614b..dbed094a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,7 @@ MM_CONFIG_DOCTOOL_DIR([docs])
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST([LIBGLIBMM_SO_VERSION], [4:0:3])
+AC_SUBST([MSVC_TOOLSET_VER], [''])
AC_PROG_CXX
MM_AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
diff --git a/gio/giomm-uninstalled.pc.in b/gio/giomm-uninstalled.pc.in
index a72da5b9..be132c61 100644
--- a/gio/giomm-uninstalled.pc.in
+++ b/gio/giomm-uninstalled.pc.in
@@ -6,5 +6,5 @@ Description: C++ binding for gio, not installed
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: gio-2.0 @GLIBMM_MODULE_NAME@-uninstalled
-Libs: ${pc_top_builddir}/${pcfiledir}/giomm/libgiomm-@GIOMM_API_VERSION@.la
+Libs: ${pc_top_builddir}/${pcfiledir}/giomm/libgiomm@MSVC_TOOLSET_VER@-@GIOMM_API_VERSION@.la
Cflags: -I${pc_top_builddir}/${pcfiledir} -I${pc_top_builddir}/${pcfiledir}/@srcdir@
diff --git a/gio/giomm.pc.in b/gio/giomm.pc.in
index 2ec76a72..702fd777 100644
--- a/gio/giomm.pc.in
+++ b/gio/giomm.pc.in
@@ -15,5 +15,5 @@ Description: C++ binding for gio
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: gio-2.0 @GLIBMM_MODULE_NAME@
-Libs: -L${libdir} -lgiomm-@GIOMM_API_VERSION@
+Libs: -L${libdir} -lgiomm@MSVC_TOOLSET_VER@-@GIOMM_API_VERSION@
Cflags: -I${includedir}/@GIOMM_MODULE_NAME@ -I${libdir}/@GIOMM_MODULE_NAME@/include
diff --git a/gio/giomm/meson.build b/gio/giomm/meson.build
index b60435ef..0e9c3115 100644
--- a/gio/giomm/meson.build
+++ b/gio/giomm/meson.build
@@ -3,7 +3,7 @@
# Input: giomm_build_dep, giomm_pcname, maintainer_mode, project_source_root,
# generate_binding_py, handle_built_files_py, m4_files, pm_files,
# glibmm_libversion, install_includedir, python3, giomm_rc, gmmproc_dir,
-# is_host_windows, gmmproc, generate_wrap_init_pl
+# is_host_windows, gmmproc, generate_wrap_init_pl, giomm_libname
# Output: giomm_hg_ccg_basenames, giomm_extra_h_files, built_files_root,
# giomm_built_h_file_targets, giomm_dep
@@ -303,7 +303,7 @@ if maintainer_mode
extra_include_dirs = ['..', '..' / '..' / 'glib']
- giomm_library = library(giomm_pcname, extra_giomm_objects,
+ giomm_library = library(giomm_libname, extra_giomm_objects,
giomm_used_built_cc_file_targets, giomm_extra_cc_files, built_dummy_h_file_target,
version: glibmm_libversion,
include_directories: extra_include_dirs,
@@ -351,7 +351,7 @@ else # not maintainer_mode
'..' / '..' / 'glib', '..' / '..' / 'untracked' / 'glib',
]
- giomm_library = library(giomm_pcname, extra_giomm_objects,
+ giomm_library = library(giomm_libname, extra_giomm_objects,
built_cc_files, giomm_extra_cc_files,
version: glibmm_libversion,
include_directories: extra_include_dirs,
diff --git a/glib/glibmm-uninstalled.pc.in b/glib/glibmm-uninstalled.pc.in
index af8c482a..c060b44d 100644
--- a/glib/glibmm-uninstalled.pc.in
+++ b/glib/glibmm-uninstalled.pc.in
@@ -8,5 +8,5 @@ Description: C++ binding for GLib, not installed
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: gobject-2.0 sigc++-3.0
-Libs: ${pc_top_builddir}/${pcfiledir}/glibmm/libglibmm-@GLIBMM_API_VERSION@.la
+Libs: ${pc_top_builddir}/${pcfiledir}/glibmm/libglibmm@MSVC_TOOLSET_VER@-@GLIBMM_API_VERSION@.la
Cflags: -I${pc_top_builddir}/${pcfiledir} -I${pc_top_builddir}/${pcfiledir}/@srcdir@
diff --git a/glib/glibmm.pc.in b/glib/glibmm.pc.in
index 25e6c167..0ab1168e 100644
--- a/glib/glibmm.pc.in
+++ b/glib/glibmm.pc.in
@@ -17,5 +17,5 @@ Description: C++ wrapper for GLib
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: gobject-2.0 sigc++-3.0
-Libs: -L${libdir} -lglibmm-@GLIBMM_API_VERSION@
+Libs: -L${libdir} -lglibmm@MSVC_TOOLSET_VER@-@GLIBMM_API_VERSION@
Cflags: -I${includedir}/@GLIBMM_MODULE_NAME@ -I${libdir}/@GLIBMM_MODULE_NAME@/include
diff --git a/glib/glibmm/meson.build b/glib/glibmm/meson.build
index 7bda0eaa..b06e91fe 100644
--- a/glib/glibmm/meson.build
+++ b/glib/glibmm/meson.build
@@ -3,7 +3,7 @@
# Input: glibmm_build_dep, glibmm_pcname, maintainer_mode, project_source_root,
# generate_binding_py, handle_built_files_py, m4_files, pm_files,
# glibmm_libversion, install_includedir, python3, glibmm_rc, gmmproc_dir,
-# is_host_windows, gendef, gmmproc, generate_wrap_init_pl
+# is_host_windows, gendef, gmmproc, generate_wrap_init_pl, glibmm_libname
# Output: glibmm_hg_ccg_basenames, glibmm_extra_h_files, built_files_root,
# glibmm_built_h_file_targets, glibmm_dep
@@ -243,7 +243,7 @@ if maintainer_mode
extra_include_dirs = ['..']
- glibmm_library = library(glibmm_pcname, extra_glibmm_objects,
+ glibmm_library = library(glibmm_libname, extra_glibmm_objects,
glibmm_built_cc_file_targets, glibmm_extra_cc_files, built_dummy_h_file_target,
include_directories: extra_include_dirs,
cpp_args: glibmm_cpp_args,
@@ -295,7 +295,7 @@ else # not maintainer_mode
extra_include_dirs = [ '..', '..' / '..' / 'untracked' / 'glib' ]
- glibmm_library = library(glibmm_pcname, extra_glibmm_objects,
+ glibmm_library = library(glibmm_libname, extra_glibmm_objects,
built_cc_files, glibmm_extra_cc_files,
include_directories: extra_include_dirs,
cpp_args: glibmm_cpp_args,
diff --git a/glib/meson.build b/glib/meson.build
index 7b810d3a..0c20a912 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -4,7 +4,7 @@
# glibmm_pcname, giomm_pcname, glibmm_api_version, glibmm_requires,
# giomm_requires, build_deprecated_api, install_pkgconfigdir,
# is_os_cocoa, cpp_compiler, glibmm_major_version, glibmm_minor_version,
-# glibmm_micro_version
+# glibmm_micro_version, msvc14x_toolset_ver
# Output: pkg_conf_data, install_glibmmconfigdir, glibmmconfig_h
pkg_conf_data = configuration_data()
@@ -32,6 +32,7 @@ pkg_conf_data.set('GLIBMM_MICRO_VERSION', glibmm_micro_version)
pkg_conf_data.set('GIOMM_MAJOR_VERSION', glibmm_major_version)
pkg_conf_data.set('GIOMM_MINOR_VERSION', glibmm_minor_version)
pkg_conf_data.set('GIOMM_MICRO_VERSION', glibmm_micro_version)
+pkg_conf_data.set('MSVC_TOOLSET_VER', msvc14x_toolset_ver)
library_build_type = get_option('default_library')
diff --git a/meson.build b/meson.build
index 5464e0ad..20ae62eb 100644
--- a/meson.build
+++ b/meson.build
@@ -94,6 +94,8 @@ build_documentation = build_documentation_opt == 'true' or \
(build_documentation_opt == 'if-maintainer-mode' and maintainer_mode)
build_examples = get_option('build-examples')
+use_msvc14x_toolset_ver = get_option('msvc14x-parallel-installable')
+
# Installation directories are relative to {prefix}.
install_prefix = get_option('prefix')
install_includedir = get_option('includedir')
@@ -209,6 +211,9 @@ endif
warning_flags = cpp_compiler.get_supported_arguments(warning_flags)
add_project_arguments(warning_flags, language: 'cpp')
+# Add toolset version in builds done with Visual Studio 2015 (v14x) or later
+msvc14x_toolset_ver = ''
+
# MSVC: Ignore warnings that aren't really harmful, but make those
# that should not be overlooked stand out.
if is_msvc
@@ -216,8 +221,23 @@ if is_msvc
'/FImsvc_recommended_pragmas.h', '/wd4251', '/wd4275', '/wd4267', '/wd4530', '/wd4589', '/utf-8'
])
add_project_arguments(disabled_warnings, language: 'cpp')
+
+ if use_msvc14x_toolset_ver
+ if cpp_compiler.version().version_compare('>=19.20')
+ msvc14x_toolset_ver = '-vc142'
+ elif cpp_compiler.version().version_compare('>=19.10')
+ msvc14x_toolset_ver = '-vc141'
+ elif cpp_compiler.version().version_compare('>=19.00')
+ msvc14x_toolset_ver = '-vc140'
+ else
+ message('Visual Studio toolset version not applied for pre-Visual Studio 2015 builds')
+ endif
+ endif
endif
+glibmm_libname = meson.project_name() + msvc14x_toolset_ver + '-' + glibmm_api_version
+giomm_libname = 'giomm' + msvc14x_toolset_ver + '-' + glibmm_api_version
+
subdir('tools')
subdir('glib')
subdir('MSVC_NMake/glibmm')
diff --git a/meson_options.txt b/meson_options.txt
index 0fc1e1d7..01add18c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -12,3 +12,5 @@ option('debug-refcounting', type: 'boolean', value: false,
description: 'Print debug messages in connection with reference counting')
option('build-examples', type: 'boolean', value: true,
description: 'Build example programs')
+option('msvc14x-parallel-installable', type: 'boolean', value: true,
+ description: 'Use separate DLL and LIB filenames for Visual Studio 2017 and 2019')
diff --git a/tools/extra_defs_gen/meson.build b/tools/extra_defs_gen/meson.build
index 65b56e96..5080b7d5 100644
--- a/tools/extra_defs_gen/meson.build
+++ b/tools/extra_defs_gen/meson.build
@@ -1,11 +1,11 @@
# tools/extra_defs_gen
# Input: glibmm_build_dep, giomm_build_dep, glibmm_api_version,
-# glibmm_libversion, glibmm_pcname
+# glibmm_libversion, glibmm_pcname, msvc14x_toolset_ver
# Output: -
glibmm_generate_extra_defs_library = library(
- 'glibmm_generate_extra_defs-' + glibmm_api_version,
+ 'glibmm_generate_extra_defs' + msvc14x_toolset_ver + '-' + glibmm_api_version,
'generate_extra_defs.cc',
version: glibmm_libversion,
cpp_args: '-DGLIBMM_GEN_EXTRA_DEFS_BUILD',