[gtkmm] Meson/Visual Studio builds: Include toolset version by default
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Meson/Visual Studio builds: Include toolset version by default
- Date: Tue, 30 Jun 2020 04:53:31 +0000 (UTC)
commit 5d22f786cf8cbd437018ed038a50f7c859f4ea8a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Jun 30 12:38:51 2020 +0800
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.
configure.ac | 1 +
gtk/gtkmm-uninstalled.pc.in | 2 +-
gtk/gtkmm.pc.in | 2 +-
gtk/gtkmm/meson.build | 4 ++--
meson.build | 15 +++++++++++++++
meson_options.txt | 2 ++
tools/extra_defs_gen/meson.build | 4 ++--
7 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a8c69885..6c868a69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,6 +136,7 @@ MM_ARG_WITH_TAGFILE_DOC([atkmm-2.30.tag], [atkmm-2.30])
# glib-compile-resources and C compiler are needed to generate and compile
# resource files in demo programs.
AC_SUBST(GLIB_COMPILE_RESOURCES, [`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`])
+AC_SUBST([MSVC_TOOLSET_VER], [''])
AC_PROG_CC
AC_LANG([C++])
diff --git a/gtk/gtkmm-uninstalled.pc.in b/gtk/gtkmm-uninstalled.pc.in
index ed85dd48..d57cc894 100644
--- a/gtk/gtkmm-uninstalled.pc.in
+++ b/gtk/gtkmm-uninstalled.pc.in
@@ -6,5 +6,5 @@ Description: C++ binding for the GTK+ toolkit, not installed
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: @GTKMM_MODULES@
-Libs: ${pc_top_builddir}/${pcfiledir}/gtkmm/libgtkmm-@GTKMM_API_VERSION@.la
+Libs: ${pc_top_builddir}/${pcfiledir}/gtkmm/libgtkmm@MSVC_TOOLSET_VER@-@GTKMM_API_VERSION@.la
Cflags: -I${pc_top_builddir}/${pcfiledir} -I${pc_top_builddir}/${pcfiledir}/@srcdir@
diff --git a/gtk/gtkmm.pc.in b/gtk/gtkmm.pc.in
index 89eb542e..fd21feac 100644
--- a/gtk/gtkmm.pc.in
+++ b/gtk/gtkmm.pc.in
@@ -17,5 +17,5 @@ Description: C++ binding for the GTK+ toolkit
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: @GTKMM_MODULES@
-Libs: -L${libdir} -lgtkmm-@GTKMM_API_VERSION@
+Libs: -L${libdir} -lgtkmm@MSVC_TOOLSET_VER@-@GTKMM_API_VERSION@
Cflags: -I${includedir}/@GTKMM_MODULE_NAME@ -I${libdir}/@GTKMM_MODULE_NAME@/include
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index 83694eb6..be28de04 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -4,7 +4,7 @@
# generate_binding_py, m4_files, gtkmm_libversion, install_includedir,
# python3, gtkmm_rc, dummy_header_py, gmmproc_dir
# build_deprecated_api, gmmproc_extra_m4_dirs, is_host_windows,
-# gdkmm_library, gdkmm_used_built_h_file_targets
+# gdkmm_library, gdkmm_used_built_h_file_targets, gtkmm_libname
# Output: gtkmm_hg_ccg_basenames, gtkmm_extra_h_files, built_files_root,
# gtkmm_built_h_file_targets, gtkmm_dep
@@ -454,7 +454,7 @@ if is_host_windows
extra_gtkmm_objects += gtkmm_res
endif
-gtkmm_library = library(gtkmm_pcname, extra_gtkmm_objects,
+gtkmm_library = library(gtkmm_libname, extra_gtkmm_objects,
gtk_gen_sources, built_dummy_h_file_target, gtkmm_extra_used_cc_files,
include_directories: extra_include_dirs,
cpp_args: gtkmm_cpp_args,
diff --git a/meson.build b/meson.build
index d2d85a0b..27a83c82 100644
--- a/meson.build
+++ b/meson.build
@@ -199,11 +199,26 @@ endif
gtkmm_script_dir = project_source_root / 'tools'
dummy_header_py = gtkmm_script_dir / 'dummy-header.py'
+# Include Visual Studio toolset version in DLL/.lib file names
+# in Visual Studio 2017 and later (enabled by default)
+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')
add_project_arguments(cpp_compiler.get_supported_arguments([ '/utf-8']), language: 'c')
+
+ 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'
+ endif
+ endif
endif
+gtkmm_libname = meson.project_name() + msvc14x_toolset_ver + '-' + gtkmm_api_version
+
# Set compiler warnings.
warning_flags = []
if warning_level == 'min'
diff --git a/meson_options.txt b/meson_options.txt
index 44f54f59..92724f20 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -12,3 +12,5 @@ option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-m
value: 'if-maintainer-mode', description: 'Build and install the documentation')
option('build-demos', type: 'boolean', value: true, description: 'Build demo programs')
option('build-tests', type: 'boolean', value: true, description: 'Build test 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 486fefb6..97e56728 100644
--- a/tools/extra_defs_gen/meson.build
+++ b/tools/extra_defs_gen/meson.build
@@ -1,11 +1,11 @@
# tools/extra_defs_gen
# Input: cpp_compiler, gdkmm_build_dep, gtkmm_build_dep, install_libdir,
-# gtkmm_pcname
+# gtkmm_pcname, msvc14x_toolset_ver
# Output: m4_files, install_m4dir
glibmm_generate_extra_defs_dep = cpp_compiler.find_library(
- 'glibmm_generate_extra_defs-2.66',
+ 'glibmm_generate_extra_defs@0@-2.66'.format(msvc14x_toolset_ver),
)
executable('generate_defs_gdk', 'generate_defs_gdk.cc',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]