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 | |
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.
-rw-r--r-- | MSVC_NMake/README | 8 | ||||
-rw-r--r-- | cairomm/meson.build | 4 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | data/cairomm.pc.in | 2 | ||||
-rw-r--r-- | data/meson.build | 3 | ||||
-rw-r--r-- | meson.build | 14 | ||||
-rw-r--r-- | meson_options.txt | 2 |
7 files changed, 28 insertions, 6 deletions
diff --git a/MSVC_NMake/README b/MSVC_NMake/README index 6a60d62..cf920ce 100644 --- a/MSVC_NMake/README +++ b/MSVC_NMake/README @@ -8,7 +8,11 @@ Building cairomm-1.16 with Visual Studio .NET 2017 or later * Run the tests. * Now the built DLL and .lib files use the toolset version ('vc141' for Visual Studio 2017 and 'vc142' for Visual Studio 2019) instead of the Visual Studio version ('vc150' for Visual Studio 2017) by default. If using the old naming style, - please note that libsigc++-3.x must be built with this option enabled as well, if building it with NMake. + please note that libsigc++-3.x must be built with this option enabled as well, if building it with NMake.
+ For the Meson builds, pass in the option '-Dmsvc14x-parallel-installable=false' to the Meson configure command line
+ to avoid having the toolset version in the final DLL and .lib filenames; again, this is only recommended if it is
+ inconvenient to re-build the dependent code, and this option should be used when building items that depend on cairomm,
+ if this option is provided. Cedric Gustin 08/18/2006 @@ -17,4 +21,4 @@ Armin Burgmeier 09/29/2010 Chun-wei Fan -09/10/2015 +09/10/2015
diff --git a/cairomm/meson.build b/cairomm/meson.build index afc724f..e12343b 100644 --- a/cairomm/meson.build +++ b/cairomm/meson.build @@ -1,7 +1,7 @@ # cairomm # Input: cairomm_build_dep, cairomm_pcname, cairomm_libversion, cairomm_rc, -# is_msvc +# is_msvc, cairomm_libname # Output: source_h_files, cairomm_dep # There are no built source files in cairomm. @@ -79,7 +79,7 @@ endif extra_include_dirs = ['..'] -cairomm_library = library(cairomm_pcname, +cairomm_library = library(cairomm_libname, cairomm_cc, extra_cairomm_objects, version: cairomm_libversion, include_directories: extra_include_dirs, diff --git a/configure.ac b/configure.ac index 0edd14e..28bf883 100644 --- a/configure.ac +++ b/configure.ac @@ -48,6 +48,7 @@ PKG_PROG_PKG_CONFIG AC_SUBST([CAIROMM_EXTRA_LIBS], ['']) AC_SUBST([CAIROMM_MODULES], ['cairo >= 1.10.0 sigc++-3.0 >= 2.5.1']) +AC_SUBST([MSVC_TOOLSET_VER], ['']) cairomm_allmodules=$CAIROMM_MODULES CAIROMM_INSTALL_PC='data/cairomm-1.16.pc' diff --git a/data/cairomm.pc.in b/data/cairomm.pc.in index f7c2d69..b6d19a2 100644 --- a/data/cairomm.pc.in +++ b/data/cairomm.pc.in @@ -15,5 +15,5 @@ Description: C++ binding for the cairo graphics library Version: @PACKAGE_VERSION@ URL: http://www.cairographics.org/cairomm/ Requires: @CAIROMM_MODULES@ -Libs: -L${libdir} -lcairomm-@CAIROMM_API_VERSION@ @CAIROMM_EXTRA_LIBS@ +Libs: -L${libdir} -lcairomm@MSVC_TOOLSET_VER@-@CAIROMM_API_VERSION@ @CAIROMM_EXTRA_LIBS@ Cflags: -I${includedir}/@CAIROMM_MODULE_NAME@ -I${libdir}/@CAIROMM_MODULE_NAME@/include diff --git a/data/meson.build b/data/meson.build index 5d9567c..509ed36 100644 --- a/data/meson.build +++ b/data/meson.build @@ -2,7 +2,7 @@ # Input: install_prefix, install_libdir, install_datadir, install_includedir, # install_pkgconfigdir, cairomm_pcname, cairomm_api_version, -# cairomm_requires +# cairomm_requires, msvc14x_toolset_ver # Output: - pkg_conf_data = configuration_data() @@ -17,6 +17,7 @@ pkg_conf_data.set('CAIROMM_MODULE_NAME', cairomm_pcname) pkg_conf_data.set('CAIROMM_API_VERSION', cairomm_api_version) pkg_conf_data.set('CAIROMM_MODULES', cairomm_requires) pkg_conf_data.set('CAIROMM_EXTRA_LIBS', cairomm_extra_libs) +pkg_conf_data.set('MSVC_TOOLSET_VER', msvc14x_toolset_ver) configure_file( input: 'cairomm.pc.in', 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 diff --git a/meson_options.txt b/meson_options.txt index 4ada13e..df57c5a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,3 +16,5 @@ option('build-tests', type: 'combo', choices: ['false', 'if-dependencies-found', value: 'if-dependencies-found', description: 'Build test programs (requires Boost Test and Fontconfig or Windows)') option('boost-shared', type: 'boolean', value: false, description: 'Use shared version of boost') +option('msvc14x-parallel-installable', type: 'boolean', value: true, + description: 'Use separate DLL and LIB filenames for Visual Studio 2017 and 2019') |