From f12c921b3096f770938dfea61203b22e5085418d Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 25 Jun 2020 10:39:04 +0800 Subject: 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 may be subtle problems when, for instance, one tries to link to a Visual Studio 2017-built cairomm with Visual Studio 2019. This is unfortunate as Microsoft did try hard to make interoperating between binaries built with Visual Studio 2017 and 2019 as easy as possible in terms of ABI and API, but unfortunately this may 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 possible breakages caused by such subtle differences. --- meson.build | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index f6eacd8..b4bfc0c 100644 --- a/meson.build +++ b/meson.build @@ -79,6 +79,8 @@ build_documentation = build_documentation_opt == 'true' or \ build_examples = get_option('build-examples') build_tests_opt = get_option('build-tests') +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') @@ -207,6 +209,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 2017 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 @@ -214,8 +219,17 @@ if is_msvc disabled_warning = cpp_compiler.get_supported_arguments(wd) add_project_arguments(disabled_warning, language: 'cpp') endforeach + 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 +cairomm_libname = meson.project_name() + msvc14x_toolset_ver + '-' + cairomm_api_version + # Create cairommconfig.h. mm_conf_data = configuration_data() if not build_deprecated_api -- cgit v1.2.3