meson: add option and build system plumbing for CoreText on macOS/iOS

Untested though.
This commit is contained in:
Tim-Philipp Müller 2018-11-12 16:56:56 +00:00 committed by Ebrahim Byagowi
parent 83ebbe4ade
commit 4840c8237e
3 changed files with 28 additions and 4 deletions

View File

@ -146,6 +146,27 @@ if host_machine.system() == 'windows' and not get_option('directwrite').disabled
endif
endif
# CoreText (macOS) - FIXME: untested
if host_machine.system() == 'darwin' and not get_option('coretext').disabled()
app_services_dep = dependency('appleframeworks', modules : ['ApplicationServices'], required: false)
if cpp.has_type('CTFontRef', prefix: '#include <ApplicationServices/ApplicationServices.h>', dependencies: app_services_dep)
deps += [app_services_dep]
conf.set('HAVE_CORETEXT', 1)
# On iOS CoreText and CoreGraphics are stand-alone frameworks
# Check for a different symbol to avoid getting cached result
else
coretext_dep = dependency('appleframeworks', modules : ['CoreText'], required: false)
coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required: false)
corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required: false)
if cpp.has_type('CTRunRef', prefix: '#include <CoreText/CoreText.h>', dependencies: [coretext_dep, coregraphics_dep, corefoundation_dep])
deps += [coretext_dep, coregraphics_dep, corefoundation_dep]
conf.set('HAVE_CORETEXT', 1)
elif get_option('coretext').enabled()
error('CoreText was enabled explicitly, but required headers or frameworks are missing.')
endif
endif
endif
# threads
if host_machine.system() != 'windows'
thread_dep = dependency('threads', required: false)

View File

@ -19,6 +19,8 @@ option('uniscribe', type: 'feature', value: 'disabled',
description: 'Enable Uniscribe shaper backend (Windows only)')
option('directwrite', type: 'feature', value: 'disabled',
description: 'Enable DirectWrite shaper backend on Windows (experimental)')
option('coretext', type: 'feature', value: 'disabled',
description: 'Enable CoreText shaper backend on macOS')
# Common feature options
#option('tests', type : 'feature', value : 'auto', yield : true,

View File

@ -104,10 +104,6 @@ hb_graphite2_headers = [
'hb-graphite2.h',
]
hb_coretext_sources = [
'hb-coretext.cc',
]
hb_icu_sources = [
'hb-icu.cc',
]
@ -181,6 +177,11 @@ if conf.get('HAVE_DIRECTWRITE', 0) == 1
hb_headers += ['hb-directwrite.h']
endif
if conf.get('HAVE_CORETEXT', 0) == 1
hb_sources += ['hb-coretext.cc']
hb_headers += ['hb-coretext.h']
endif
version = '0.' + '0'.join(meson.project_version().split('.')) + '.0'
libharfbuzz = library('harfbuzz', hb_sources,