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