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 10:39:04 +0800 |
commit | 7ce9498b2420ed44893c302b118d61386e6bc4b3 (patch) | |
tree | cde0073ca8b37081cbe1d4a7e854d5e96f6ef71d /meson.build | |
parent | 9c901080099226d86ed4bc8f4d611500c1febf1b (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 2015 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 2015-built
cairomm with Visual Studio 2017 or 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 may hit the corner cases where
this compatibility does not work.
As the name suggests, this attempts to make Visual Studio 2015, 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 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 837a1ae..853ebe6 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') @@ -200,6 +202,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 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 @@ -207,8 +212,21 @@ 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' + 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 +cairomm_libname = meson.project_name() + msvc14x_toolset_ver + '-' + cairomm_api_version + # Create cairommconfig.h. mm_conf_data = configuration_data() if not build_deprecated_api |