From 306645503d1d019b4ec011e9bacec43bb7a46a9a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 25 Dec 2022 19:03:50 -0500 Subject: [PATCH] Work on proper build integration Install hb-cairo.h and define HB_HAS_CAIRO. --- docs/harfbuzz-sections.txt | 1 + src/hb-features.h.in | 7 ++++++ src/meson.build | 51 ++++++++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 5dedc07d9..ca99c1d07 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -170,6 +170,7 @@ HB_HAS_CORETEXT HB_HAS_FREETYPE HB_HAS_GLIB HB_HAS_GRAPHITE +HB_HAS_CAIRO HB_BEGIN_DECLS HB_END_DECLS diff --git a/src/hb-features.h.in b/src/hb-features.h.in index 6a294e81e..58646f978 100644 --- a/src/hb-features.h.in +++ b/src/hb-features.h.in @@ -84,6 +84,13 @@ HB_BEGIN_DECLS */ #mesondefine HB_HAS_ICU +/** + * HB_HAS_CAIRO: + * + * Defined if Harfbuzz has been built with cairo support. + */ +#mesondefine HB_HAS_CAIRO + HB_END_DECLS diff --git a/src/meson.build b/src/meson.build index f1a686b63..14b4a2605 100644 --- a/src/meson.build +++ b/src/meson.build @@ -483,6 +483,10 @@ if have_icu and have_icu_builtin hb_features.set('HB_HAS_ICU', 1) endif +if conf.get('HAVE_CAIRO', 0) == 1 + hb_features.set('HB_HAS_CAIRO', 1) +endif + hb_features_h = configure_file(input: 'hb-features.h.in', output: 'hb-features.h', configuration: hb_features, @@ -577,24 +581,39 @@ libharfbuzz_subset_dep = declare_dependency( dependencies: [m_dep]) meson.override_dependency('harfbuzz-subset', libharfbuzz_subset_dep) -hb_cairo_sources = [ - 'hb-cairo.cc', - 'hb-cairo-utils.cc' -] +libharfbuzz_cairo_dep = null_dep +if conf.get('HAVE_CAIRO', 0) == 1 + hb_cairo_sources = [ + 'hb-cairo.cc', + 'hb-cairo-utils.cc' + ] -cairo_dep = dependency('cairo') + hb_cairo_headers = [ + 'hb-cairo.h', + ] -libharfbuzz_cairo = library('harfbuzz-cairo', hb_cairo_sources, - include_directories: incconfig, - dependencies: [m_dep, cairo_dep], - link_with: [libharfbuzz], - cpp_args: cpp_args + extra_hb_cpp_args, - soversion: hb_so_version, - version: version, - install: true, - darwin_versions: darwin_versions, - link_language: 'c', -) + cairo_dep = dependency('cairo') + + libharfbuzz_cairo = library('harfbuzz-cairo', hb_cairo_sources, + include_directories: incconfig, + dependencies: [m_dep, cairo_dep], + link_with: [libharfbuzz], + cpp_args: cpp_args + extra_hb_cpp_args, + soversion: hb_so_version, + version: version, + install: true, + darwin_versions: darwin_versions, + link_language: 'c', + ) + + install_headers(hb_cairo_headers, subdir: meson.project_name()) + + libharfbuzz_cairo_dep = declare_dependency( + link_with: libharfbuzz_cairo, + include_directories: incsrc, + dependencies: [m_dep, cairo_dep]) + meson.override_dependency('harfbuzz-cairo', libharfbuzz_cairo_dep) +endif if get_option('tests').enabled() # TODO: MSVC gives the following,