[atkmm] Meson/Visual Studio builds: Include toolset version by default
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atkmm] Meson/Visual Studio builds: Include toolset version by default
- Date: Mon, 29 Jun 2020 10:00:40 +0000 (UTC)
commit c45ad1d81f210c94915224bf574a9c9295dd8159
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Jun 29 17:33:16 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 can be subtle problems when, for
instance, one tries to link to a Visual Studio 2017-built atkmm when building
items dependening on atkmm 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 can hit 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.
atk/atkmm-uninstalled.pc.in | 2 +-
atk/atkmm.pc.in | 2 +-
atk/atkmm/meson.build | 9 +++++----
atk/meson.build | 4 +++-
codegen/extradefs/meson.build | 5 +++--
configure.ac | 1 +
meson.build | 17 +++++++++++++++++
meson_options.txt | 2 ++
8 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/atk/atkmm-uninstalled.pc.in b/atk/atkmm-uninstalled.pc.in
index 3937f99..1947560 100644
--- a/atk/atkmm-uninstalled.pc.in
+++ b/atk/atkmm-uninstalled.pc.in
@@ -6,5 +6,5 @@ Description: C++ binding for the ATK accessibility toolkit, uninstalled
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: @ATKMM_MODULES@
-Libs: ${pc_top_builddir}/${pcfiledir}/atkmm/libatkmm-@ATKMM_API_VERSION@.la
+Libs: ${pc_top_builddir}/${pcfiledir}/atkmm/libatkmm@MSVC_TOOLSET_VER@-@ATKMM_API_VERSION@.la
Cflags: -I${pc_top_builddir}/${pcfiledir} -I${pc_top_builddir}/${pcfiledir}/@srcdir@
diff --git a/atk/atkmm.pc.in b/atk/atkmm.pc.in
index eeb2dea..764ee88 100644
--- a/atk/atkmm.pc.in
+++ b/atk/atkmm.pc.in
@@ -17,5 +17,5 @@ Description: C++ binding for the ATK accessibility toolkit
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
Requires: @ATKMM_MODULES@
-Libs: -L${libdir} -latkmm-@ATKMM_API_VERSION@
+Libs: -L${libdir} -latkmm@MSVC_TOOLSET_VER@-@ATKMM_API_VERSION@
Cflags: -I${includedir}/@ATKMM_MODULE_NAME@ -I${libdir}/@ATKMM_MODULE_NAME@/include
diff --git a/atk/atkmm/meson.build b/atk/atkmm/meson.build
index bfc1d01..d393cfa 100644
--- a/atk/atkmm/meson.build
+++ b/atk/atkmm/meson.build
@@ -2,7 +2,7 @@
# Input: atkmm_build_dep, atkmm_pcname, maintainer_mode, project_source_root,
# generate_binding_py, m4_files, atkmm_libversion, install_includedir,
-# python3, atkmm_rc, dummy_header_py, gmmproc_dir
+# python3, atkmm_rc, dummy_header_py, gmmproc_dir, msvc14x_toolset_ver
# Output: hg_ccg_basenames, extra_h_files, built_h_file_targets, built_files_root,
# atkmm_dep
@@ -70,6 +70,8 @@ if host_machine.system() == 'windows'
extra_atkmm_objects += atkmm_res
endif
+atkmm_libname = meson.project_name() + msvc14x_toolset_ver + '-' + atkmm_api_version
+
if maintainer_mode
# Maintainer mode. Generate .h and .cc files from .hg and .ccg files in ../src.
@@ -145,7 +147,7 @@ if maintainer_mode
extra_include_dirs = ['..']
- atkmm_library = library(atkmm_pcname, extra_atkmm_objects,
+ atkmm_library = library(atkmm_libname, extra_atkmm_objects,
built_cc_file_targets, extra_cc_files, built_dummy_h_file_target,
version: atkmm_libversion,
include_directories: extra_include_dirs,
@@ -188,7 +190,7 @@ else # not maintainer_mode
extra_include_dirs = [ '..', '..' / '..' / 'untracked' / 'atk' ]
- atkmm_library = library(atkmm_pcname, extra_atkmm_objects,
+ atkmm_library = library(atkmm_libname, extra_atkmm_objects,
built_cc_files, extra_cc_files,
version: atkmm_libversion,
include_directories: extra_include_dirs,
@@ -198,7 +200,6 @@ else # not maintainer_mode
)
built_h_cc_dir = src_untracked_atkmm
-
endif
# Install built .h and _p.h files.
diff --git a/atk/meson.build b/atk/meson.build
index ba29d23..dc34911 100644
--- a/atk/meson.build
+++ b/atk/meson.build
@@ -3,7 +3,8 @@
# Input: install_prefix, install_datadir, install_includedir,
# atkmm_pcname, atkmm_api_version, atkmm_requires,
# install_pkgconfigdir, install_libdir, build_deprecated_api,
-# atkmm_major_version, atkmm_minor_version, atkmm_micro_version
+# atkmm_major_version, atkmm_minor_version, atkmm_micro_version,
+# msvc14x_toolset_ver
# Output: pkg_conf_data, install_includeconfigdir, atkmmconfig_h
pkg_conf_data = configuration_data()
@@ -25,6 +26,7 @@ endif
pkg_conf_data.set('ATKMM_MAJOR_VERSION', atkmm_major_version)
pkg_conf_data.set('ATKMM_MINOR_VERSION', atkmm_minor_version)
pkg_conf_data.set('ATKMM_MICRO_VERSION', atkmm_micro_version)
+pkg_conf_data.set('MSVC_TOOLSET_VER', msvc14x_toolset_ver)
library_build_type = get_option('default_library')
diff --git a/codegen/extradefs/meson.build b/codegen/extradefs/meson.build
index b39d114..3dfe461 100644
--- a/codegen/extradefs/meson.build
+++ b/codegen/extradefs/meson.build
@@ -1,10 +1,11 @@
# codegen/extradefs
-# Input: cpp_compiler, atkmm_build_dep, install_libdir, atkmm_pcname
+# Input: cpp_compiler, atkmm_build_dep, install_libdir, atkmm_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_extra_defs', 'generate_extra_defs_atk.cc',
diff --git a/configure.ac b/configure.ac
index f3bfbd6..2444557 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,7 @@ MM_CONFIG_DOCTOOL_DIR([doc])
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST([ATKMM_SO_VERSION], [2:0:1])
+AC_SUBST([MSVC_TOOLSET_VER], [''])
AC_PROG_CXX
MM_AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
diff --git a/meson.build b/meson.build
index bc20954..bf74ca6 100644
--- a/meson.build
+++ b/meson.build
@@ -151,6 +151,23 @@ endif
atkmm_script_dir = project_source_root / 'codegen'
dummy_header_py = atkmm_script_dir / 'dummy-header.py'
+# Whether to include toolset version in .lib and DLL file names
+# on Visual Studio 2017 and later (default: yes)
+use_msvc14x_toolset_ver = get_option('msvc14x-parallel-installable')
+
+# Add toolset version in builds done with Visual Studio 2017 or later
+msvc14x_toolset_ver = ''
+
+if is_msvc
+ 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
+
# Set compiler warnings.
warning_flags = []
if warning_level == 'min'
diff --git a/meson_options.txt b/meson_options.txt
index cee7a28..940a398 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,5 @@ option('build-deprecated-api', type: 'boolean', value: true,
description: 'Build deprecated API and include it in the library')
option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-mode', 'true'],
value: 'if-maintainer-mode', description: 'Build and install the documentation')
+option('msvc14x-parallel-installable', type: 'boolean', value: true,
+ description: 'Use separate DLL and LIB filenames for Visual Studio 2017 and 2019')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]