[pangomm/cairomm-meson-improvements: 2/3] Meson/Visual Studio: Support cairomm lookup using pkg-config
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/cairomm-meson-improvements: 2/3] Meson/Visual Studio: Support cairomm lookup using pkg-config
- Date: Tue, 5 May 2020 09:41:58 +0000 (UTC)
commit e369597843153077694e8debe3ba82ee13f3107e
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue May 5 15:31:33 2020 +0800
Meson/Visual Studio: Support cairomm lookup using pkg-config
cairomm recently received Meson build support, which will generate the
pkg-config files for us, so try to look for cairomm first using
pkg-config, before looking for it manually.
Since cairomm's pkg-config file also pulls in libsigc++, we can also
skip looking for libsigc++ if we found cairomm via pkg-config.
meson.build | 54 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5ab6eed..6a54a07 100644
--- a/meson.build
+++ b/meson.build
@@ -93,36 +93,49 @@ 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
+# cairomm and glibmm recently gained Meson build support, so we can try looking
# for its pkg-config files on Visual Studio as well
+cairomm_req = '>= 1.15.1'
glibmm_req = '>= 2.65.1'
-# The -mm libraries do not yet have pkg-config files for MSVC builds,
-# so check for them manually
+# The -mm libraries may have pkg-config files for MSVC builds,
+# so check for them manually, if needed
glibmm_req_minor_ver = '66'
cairomm_req_minor_ver = '16'
+cairomm_dep = dependency('cairomm-1.@0@'.format(cairomm_req_minor_ver), version: cairomm_req, required: not
is_msvc)
+glibmm_dep = dependency('glibmm-2.@0@'.format(glibmm_req_minor_ver), version: glibmm_req, required: not
is_msvc)
+
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')
sigc_major_ver = '3'
- glibmm_dep = dependency('glibmm-2.@0@'.format(glibmm_req_minor_ver), version: glibmm_req, required: false)
+ # The glibmm and cairomm pkg-config files pulls in libsigc++,
+ # so only look for libsigc++ if glibmm's nor cairomm's pkg-config
+ # files can't be found
+ if not glibmm_dep.found() and not cairomm_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'.format(sigc_major_ver))
+ else
+ sigc_dep = dependency('', required: false) # cairomm/glibmm covers for libsigc++ in their pkg-config
files
+ endif
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)),
+ if not cairomm_dep.found()
+ 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++-@2@.x'.format(glibmm_req_minor_ver, cairomm_req_minor_ver,
sigc_major_ver))
+ endif
+
+ if not glibmm_dep.found() or not cairomm_dep.found()
+ 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))
+ endif
# Visual Studio 2019 can consume libraries built with 2017, so check for
# 2017-built libraries as well if 2019-built libraries cannot be found
@@ -140,14 +153,14 @@ 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
- cairomm_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)
endforeach
- if glibmm_dep.type_name() == 'library'
+ if glibmm_dep.type_name() == 'library' and \
+ cairomm_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
@@ -156,17 +169,20 @@ if is_msvc
endif
# Now make sure the appropriate -mm libraries are found
- 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))
+ assert(glibmm_dep.found() and cairomm_dep.found() and (glibmm_dep.type_name() == 'pkgconfig' or
cairomm_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.
+ # Put glibmm and cairomm in the required packages if we find it by pkg-config
mm_lib_requires = ''
if glibmm_dep.type_name() == 'pkgconfig'
mm_lib_requires += ' '.join([
'glibmm-2.@0@'.format(glibmm_req_minor_ver), glibmm_req,
]) + ' '
endif
+ if cairomm_dep.type_name() == 'pkgconfig'
+ mm_lib_requires += ' '.join([
+ 'cairomm-1.@0@'.format(cairomm_req_minor_ver), cairomm_req,
+ ]) + ' '
+ endif
pangomm_requires = mm_lib_requires + ' '.join([
'pangocairo', pangocairo_req,
@@ -174,9 +190,7 @@ if is_msvc
pangomm_build_dep = [glibmm_dep, cairomm_dep, sigc_dep, pangocairo_dep]
else
- 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)
+ # not MSVC
pangomm_build_dep = [glibmm_dep, cairomm_dep, pangocairo_dep]
pangomm_requires = ' '.join([
'glibmm-2.@0@'.format(glibmm_req_minor_ver), glibmm_req,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]