diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-06-25 10:39:04 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-06-25 16:55:00 +0800 |
commit | f12c921b3096f770938dfea61203b22e5085418d (patch) | |
tree | a1eab3604452b8fff231cbeef67792c5205f4cec /meson.build | |
parent | 93d941b0bde0fb5db84ddc5b051566f1925d99ec (diff) |
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.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 14 |
1 files changed, 14 insertions, 0 deletions
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 |