meson: Declare dependencies for use as a subproject

Also use fallbacks for dependencies that have meson build files
This commit is contained in:
Nirbheek Chauhan 2018-10-12 19:41:49 +05:30 committed by Ebrahim Byagowi
parent 14432b3ded
commit f65def4dc7
2 changed files with 39 additions and 6 deletions

View File

@ -26,16 +26,32 @@ check_funcs = [
['round'], ['round'],
] ]
freetype_dep = dependency('freetype2', required: false, fallback: ['freetype2', 'freetype_dep']) freetype_dep = dependency('freetype2', required: false,
glib_dep = dependency('glib-2.0', required: false, fallback: ['glib', 'libglib_dep']) fallback: ['freetype2', 'freetype_dep'])
gobject_dep = dependency('gobject-2.0', required: false, fallback: ['glib', 'libgobject_dep']) glib_dep = dependency('glib-2.0', required: false,
cairo_dep = dependency('cairo', required: false) fallback: ['glib', 'libglib_dep'])
cairo_ft_dep = dependency('cairo-ft', required: false) gobject_dep = dependency('gobject-2.0', required: false,
fontconfig_dep = dependency('fontconfig', required: false, fallback: ['fontconfig', 'fontconfig_dep']) fallback: ['glib', 'libgobject_dep'])
cairo_dep = dependency('cairo', required: false,
fallback: ['cairo', 'libcairo_dep'])
fontconfig_dep = dependency('fontconfig', required: false,
fallback: ['fontconfig', 'fontconfig_dep'])
graphite2_dep = dependency('graphite2', required: false) graphite2_dep = dependency('graphite2', required: false)
icu_dep = dependency('icu-uc', required: false) icu_dep = dependency('icu-uc', required: false)
m_dep = cpp.find_library('m', required: false) m_dep = cpp.find_library('m', required: false)
# Ensure that cairo-ft is fetched from the same library as cairo itself
if cairo_dep.found()
if cairo_dep.type_name() == 'pkgconfig'
cairo_ft_dep = dependency('cairo-ft', required: false)
else
cairo_ft_dep = cairo_dep
endif
else
# Not-found dependency
cairo_ft_dep = dependency('', required: false)
endif
deps = [] deps = []
conf = configuration_data() conf = configuration_data()

View File

@ -192,6 +192,11 @@ libharfbuzz = library('harfbuzz', hb_sources,
install: true, install: true,
name_prefix: 'lib') name_prefix: 'lib')
libharfbuzz_dep = declare_dependency(
link_with: libharfbuzz,
include_directories: [incbase, incucdn],
dependencies: deps)
libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources, libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
include_directories: incbase, include_directories: incbase,
link_with: [libharfbuzz], link_with: [libharfbuzz],
@ -202,6 +207,11 @@ libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
install: true, install: true,
name_prefix: 'lib') name_prefix: 'lib')
libharfbuzz_subset_dep = declare_dependency(
link_with: libharfbuzz_subset,
include_directories: incbase,
dependencies: deps)
pkgmod.generate(libharfbuzz, pkgmod.generate(libharfbuzz,
description: 'HarfBuzz text shaping library', description: 'HarfBuzz text shaping library',
subdirs: [meson.project_name()], subdirs: [meson.project_name()],
@ -264,11 +274,18 @@ if conf.get('HAVE_GOBJECT', 0) == 1
install: true, install: true,
name_prefix: 'lib') name_prefix: 'lib')
libharfbuzz_gobject_dep = declare_dependency(
link_with: libharfbuzz_gobject,
include_directories: incbase,
dependencies: deps)
pkgmod.generate(libharfbuzz_gobject, pkgmod.generate(libharfbuzz_gobject,
description: 'HarfBuzz text shaping library GObject integration', description: 'HarfBuzz text shaping library GObject integration',
subdirs: [meson.project_name()], subdirs: [meson.project_name()],
version: meson.project_version(), version: meson.project_version(),
) )
else
libharfbuzz_gobject_dep = dependency('', required: false)
endif endif
install_headers(hb_headers + hb_gobject_headers + hb_subset_headers, subdir: meson.project_name()) install_headers(hb_headers + hb_gobject_headers + hb_subset_headers, subdir: meson.project_name())