[meson] Further simplify generating hb-features.h

This commit is contained in:
Khaled Hosny 2023-01-24 00:07:45 +02:00
parent 2486d6d22f
commit 699485b349
1 changed files with 17 additions and 21 deletions

View File

@ -422,23 +422,17 @@ harfbuzz_deps = [thread_dep, m_dep] + harfbuzz_extra_deps
libharfbuzz_link_language = 'c'
hb_features = configuration_data()
if conf.get('HAVE_FREETYPE', 0) == 1
hb_sources += hb_ft_sources
hb_headers += hb_ft_headers
harfbuzz_deps += [freetype_dep]
endif
hb_features.set('HB_HAS_FREETYPE', conf.get('HAVE_FREETYPE', 0))
if conf.get('HAVE_GLIB', 0) == 1
hb_sources += hb_glib_sources
hb_headers += hb_glib_headers
harfbuzz_deps += [glib_dep]
endif
hb_features.set('HB_HAS_GLIB', conf.get('HAVE_GLIB', 0))
hb_features.set('HB_HAS_GOBJECT', conf.get('HAVE_GOBJECT', 0))
# We set those here to not include the sources below that are of no use to
# GObject Introspection
@ -450,20 +444,17 @@ if conf.get('HAVE_GDI', 0) == 1
hb_headers += hb_gdi_headers
harfbuzz_deps += gdi_uniscribe_deps
endif
hb_features.set('HB_HAS_GDI', conf.get('HAVE_GDI', 0))
if conf.get('HAVE_GRAPHITE2', 0) == 1
hb_sources += hb_graphite2_sources
hb_headers += hb_graphite2_headers
harfbuzz_deps += [graphite2_dep, graphite_dep]
endif
hb_features.set('HB_HAS_GRAPHITE', conf.get('HAVE_GRAPHITE', 0))
if conf.get('HAVE_UNISCRIBE', 0) == 1
hb_sources += hb_uniscribe_sources
hb_headers += hb_uniscribe_headers
endif
hb_features.set('HB_HAS_UNISCRIBE', conf.get('HAVE_UNISCRIBE', 0))
if conf.get('HAVE_DIRECTWRITE', 0) == 1
hb_sources += hb_directwrite_sources
@ -471,41 +462,46 @@ if conf.get('HAVE_DIRECTWRITE', 0) == 1
# hb-directwrite needs a C++ linker
libharfbuzz_link_language = 'cpp'
endif
hb_features.set('HB_HAS_DIRECTWRITE', conf.get('HAVE_DIRECTWRITE', 0))
if conf.get('HAVE_CORETEXT', 0) == 1
hb_sources += hb_coretext_sources
hb_headers += hb_coretext_headers
harfbuzz_deps += coretext_deps
endif
hb_features.set('HB_HAS_CORETEXT', conf.get('HAVE_CORETEXT', 0))
have_icu = conf.get('HAVE_ICU', 0) == 1
have_icu_builtin = conf.get('HAVE_ICU_BUILTIN', 0) == 1
if have_icu and have_icu_builtin
hb_sources += hb_icu_sources
hb_headers += hb_icu_headers
harfbuzz_deps += [icu_dep]
endif
hb_features.set('HB_HAS_ICU', conf.get('HAVE_ICU', 0))
hb_features.set('HB_HAS_CAIRO', conf.get('HAVE_CAIRO', 0))
features = [
'CAIRO',
'CORETEXT',
'DIRECTWRITE',
'FREETYPE',
'GDI',
'GLIB',
'GOBJECT',
'GRAPHITE',
'ICU',
'UNISCRIBE',
]
hb_enabled_features = configuration_data()
hb_supported_features = configuration_data()
foreach key : hb_features.keys()
# Set any feature to 1 here, see below
foreach feature : features
key = 'HB_HAS_@0@'.format(feature)
hb_enabled_features.set(key, conf.get('HAVE_@0@'.format(feature), false))
hb_supported_features.set(key, 1)
if hb_features.get(key) == 0
# Set to false so meson undefs them, instead of defining to 0.
hb_features.set(key, false)
endif
endforeach
# The enabled features. This file is installed.
hb_features_h = configure_file(input: 'hb-features.h.in',
output: 'hb-features.h',
configuration: hb_features,
configuration: hb_enabled_features,
install: true,
install_dir: get_option('includedir') / meson.project_name())