meson: add options to enable/disable various features

And fix build without GLib. Fixes #2.
This commit is contained in:
Tim-Philipp Müller 2018-11-12 15:36:27 +00:00 committed by Ebrahim Byagowi
parent c5f2e5e5ab
commit 49ba211a9d
3 changed files with 33 additions and 8 deletions

View File

@ -26,24 +26,24 @@ check_funcs = [
['round'],
]
freetype_dep = dependency('freetype2', required: false,
freetype_dep = dependency('freetype2', required: get_option('freetype'),
fallback: ['freetype2', 'freetype_dep'])
glib_dep = dependency('glib-2.0', required: false,
glib_dep = dependency('glib-2.0', required: get_option('glib'),
fallback: ['glib', 'libglib_dep'])
gobject_dep = dependency('gobject-2.0', required: false,
gobject_dep = dependency('gobject-2.0', required: get_option('gobject'),
fallback: ['glib', 'libgobject_dep'])
cairo_dep = dependency('cairo', required: false,
cairo_dep = dependency('cairo', required: get_option('cairo'),
fallback: ['cairo', 'libcairo_dep'])
fontconfig_dep = dependency('fontconfig', required: false,
fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'),
fallback: ['fontconfig', 'fontconfig_dep'])
graphite2_dep = dependency('graphite2', required: false)
icu_dep = dependency('icu-uc', required: false)
graphite2_dep = dependency('graphite2', required: get_option('graphite'))
icu_dep = dependency('icu-uc', required: get_option('icu'))
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)
cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo'))
else
cairo_ft_dep = cairo_dep
endif

21
meson_options.txt Normal file
View File

@ -0,0 +1,21 @@
# HarfBuzz feature options
option('glib', type: 'feature', value: 'auto',
description: 'Enable GLib unicode functions')
option('gobject', type: 'feature', value: 'disabled',
description: 'Enable GObject bindings')
option('cairo', type: 'feature', value: 'auto',
description: 'Use Cairo graphics library')
option('fontconfig', type: 'feature', value: 'auto',
description: 'Use fontconfig')
option('icu', type: 'feature', value: 'auto',
description: 'Enable ICU library unicode functions')
option('graphite', type: 'feature', value: 'disabled',
description: 'Enable Graphite2 complementary shaper')
option('freetype', type: 'feature', value: 'auto',
description: 'Enable freetype interop helpers')
# Common feature options
#option('tests', type : 'feature', value : 'auto', yield : true,
# description: 'Enable or disable unit tests')
#option('introspection', type : 'feature', value : 'disabled', yield : true,
# description : 'Generate gobject-introspection bindings (.gir/.typelib files)')

View File

@ -57,4 +57,8 @@ if conf.get('HAVE_GLIB', 0) == 1
link_with: [libharfbuzz],
install: true,
)
else
# Disable tests that use this
hb_shape = disabler()
hb_subset = disabler()
endif