[pangomm/master.msvc-meson.improvements: 2/4] meson.build: Look for glibmm with pkg-config on MSVC too
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/master.msvc-meson.improvements: 2/4] meson.build: Look for glibmm with pkg-config on MSVC too
- Date: Wed, 11 Mar 2020 10:49:52 +0000 (UTC)
commit 4217632d3ed975114b2e53e91d5902495ec8d7b1
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Sat Feb 22 11:11:05 2020 +0800
meson.build: Look for glibmm with pkg-config on MSVC too
glibmm gained Meson build support for Visual Studio, so we can first
try to look for glibmm with pkg-config first, and then fall back to
manual searching if that cannot be found.
Note that libsigc++ also has a Meson build system as well, but either we
look for it via glibmm's pkg-config files, or we look for both glibmm
and libsigc++ manually.
Also support looking for Meson-built libsigc++ .lib's as well if glibmm
is to be looked for manually.
meson.build | 50 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 39 insertions(+), 11 deletions(-)
---
diff --git a/meson.build b/meson.build
index 4aee909..1879379 100644
--- a/meson.build
+++ b/meson.build
@@ -82,6 +82,10 @@ install_pkgconfigdir = install_libdir / 'pkgconfig'
pangocairo_req = '>= 1.41.0'
pangocairo_dep = dependency('pangocairo', version: pangocairo_req)
+# glibmm recently gained Meson build support, so we can try looking
+# for its pkg-config files on Visual Studio as well
+glibmm_req = '>= 2.63.1'
+
# The -mm libraries do not yet have pkg-config files for MSVC builds,
# so check for them manually
glibmm_req_minor_ver = '64'
@@ -91,13 +95,23 @@ if is_msvc
# We must have Visual Studio 2017 15.7 or later...
assert(cpp_compiler.version().split('.')[0].to_int() >= 19 and
cpp_compiler.version().split('.')[1].to_int() >= 15, 'Visual Studio 2017 15.7 or later is required')
- assert(cpp_compiler.has_header('sigc++-3.0/sigc++/sigc++.h') and
cpp_compiler.has_header('sigc++-3.0/include/sigc++config.h'),
- 'sigc++-3.x headers are required')
- assert(cpp_compiler.has_header('glibmm-2.@0@/glibmm.h'.format(glibmm_req_minor_ver)) and
cpp_compiler.has_header('glibmm-2.@0@/include/glibmmconfig.h'.format(glibmm_req_minor_ver)),
- 'glibmm-2.@0@ headers are required'.format(glibmm_req_minor_ver))
+ sigc_major_ver = '3'
+
+ glibmm_dep = dependency('glibmm-2.@0@'.format(glibmm_req_minor_ver), version: glibmm_req, required: false)
+
+ if not glibmm_dep.found()
+ assert(cpp_compiler.has_header('sigc++-@0@.0/sigc++/sigc++.h'.format(sigc_major_ver)) and \
+ cpp_compiler.has_header('sigc++-@0@.0/include/sigc++config.h'.format(sigc_major_ver)),
+ 'sigc++-@0@.x headers are required')
+ assert(cpp_compiler.has_header('glibmm-2.@0@/glibmm.h'.format(glibmm_req_minor_ver)) and
cpp_compiler.has_header('glibmm-2.@0@/include/glibmmconfig.h'.format(glibmm_req_minor_ver)),
+ 'glibmm-2.@0@ headers are required'.format(glibmm_req_minor_ver))
+ else
+ sigc_dep = dependency ('', required: false) # glibmm covers for libsigc++ in its pkg-config file
+ endif
+
assert(cpp_compiler.has_header('cairomm-1.@0@/cairomm/cairomm.h'.format(cairomm_req_minor_ver)) and
cpp_compiler.has_header('cairomm-1.@0@/include/cairommconfig.h'.format(cairomm_req_minor_ver)),
'cairomm-1.@0@ headers are required'.format(cairomm_req_minor_ver))
- message('Ensure your INCLUDE and LIB contain the paths that lead to the appropriate headers and .lib\'s
for glibmm-2.@0@, cairomm-1.@1@ and libsigc++-3.x'.format(glibmm_req_minor_ver, cairomm_req_minor_ver))
+ message('Ensure your INCLUDE and LIB contain the paths that lead to the appropriate headers and .lib\'s
for glibmm-2.@0@, cairomm-1.@1@ and libsigc++-@2@.x'.format(glibmm_req_minor_ver, cairomm_req_minor_ver,
sigc_major_ver))
# Visual Studio 2019 can consume libraries built with 2017, so check for
# 2017-built libraries as well if 2019-built libraries cannot be found
@@ -115,26 +129,40 @@ if is_msvc
# We can be looking for MSVC 2017-built libraries on 2019 builds as well,
# so we can't just assume that libraries exist, but check that compatible
# versions are really found
- glibmm_dep = dependency('', required: false)
cairomm_dep = dependency('', required: false)
- sigc_dep = dependency('', required: false)
foreach v : msvc_check_range
glibmm_dep = glibmm_dep.found() ? glibmm_dep :
cpp_compiler.find_library('glibmm-vc@0@0@1@-2_@2@'.format(v.to_string(), debugsuffix, glibmm_req_minor_ver),
required: false)
cairomm_dep = cairomm_dep.found() ? cairomm_dep :
cpp_compiler.find_library('cairomm-vc@0@0@1@-1_@2@'.format(v.to_string(), debugsuffix,
cairomm_req_minor_ver), required: false)
- sigc_dep = sigc_dep.found() ? sigc_dep :
cpp_compiler.find_library('sigc-vc@0@0@1@-3_0'.format(v.to_string(), debugsuffix), required: false)
endforeach
+ if glibmm_dep.type_name() == 'library'
+ warning('Note: Be sure to check that this finds the same libsigc++ .lib your glibmm is linked to')
+ sigc_dep = cpp_compiler.find_library('sigc-@0@.0'.format(sigc_major_ver), required: false)
+ foreach v : msvc_check_range
+ sigc_dep = sigc_dep.found() ? sigc_dep :
cpp_compiler.find_library('sigc-vc@0@0@1@-@2@_0'.format(v.to_string(), debugsuffix, sigc_major_ver),
required: false)
+ endforeach
+ endif
+
# Now make sure the appropriate -mm libraries are found
- assert(glibmm_dep.found() and cairomm_dep.found() and sigc_dep.found(), 'Appropriate
glibmm-vcxx0@0@-2_@1@.lib, cairomm-vcxx0@0@-1_@2@.lib and sigc-vcxx0@0@-3_0.lib are
required'.format(debugsuffix, glibmm_req_minor_ver, cairomm_req_minor_ver))
+ assert(glibmm_dep.found() and cairomm_dep.found() and (glibmm_dep.type_name() == 'pkgconfig' or
sigc_dep.found()), 'Appropriate glibmm-vcxx0@0@-2_@1@.lib, cairomm-vcxx0@0@-1_@2@.lib and
sigc-vcxx0@0@-@3@_0.lib are required'.format(debugsuffix, glibmm_req_minor_ver, cairomm_req_minor_ver,
sigc_major_ver))
+
+ # Put glibmm in the required packages if we find it by pkg-config
+ # When cairomm gains Meson build support, we can replace
+ # this with what is done on other build systems.
+ mm_lib_requires = ''
+ if glibmm_dep.type_name() == 'pkgconfig'
+ mm_lib_requires += ' '.join([
+ 'glibmm-2.@0@'.format(glibmm_req_minor_ver), glibmm_req,
+ ]) + ' '
+ endif
- pangomm_requires = ' '.join([
+ pangomm_requires = mm_lib_requires + ' '.join([
'pangocairo', pangocairo_req,
])
pangomm_build_dep = [glibmm_dep, cairomm_dep, sigc_dep, pangocairo_dep]
else
- glibmm_req = '>= 2.63.1'
cairomm_req = '>= 1.15.1'
glibmm_dep = dependency('glibmm-2.@0@'.format(glibmm_req_minor_ver), version: glibmm_req)
cairomm_dep = dependency('cairomm-1.@0@'.format(cairomm_req_minor_ver), version: cairomm_req)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]