Generate and install hb-features.h
This header has defines for all the optional dependendencies that come with their own Harfbuzz headers, so you can do: #include <hb-features.h> #ifdef HB_HAS_DIRECTWRITE #include <hb-directwrite.h> #endif
This commit is contained in:
parent
40634ceeb0
commit
c6d616cc41
|
@ -47,6 +47,9 @@ HBLIBS += $(GLIB_LIBS)
|
||||||
HBDEPS += $(GLIB_DEPS)
|
HBDEPS += $(GLIB_DEPS)
|
||||||
HBSOURCES += $(HB_GLIB_sources)
|
HBSOURCES += $(HB_GLIB_sources)
|
||||||
HBHEADERS += $(HB_GLIB_headers)
|
HBHEADERS += $(HB_GLIB_headers)
|
||||||
|
HB_HAS_GLIB_DEF = define HB_HAS_GLIB 1
|
||||||
|
else
|
||||||
|
HB_HAS_GLIB_DEF = undef HB_HAS_GLIB
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_FREETYPE
|
if HAVE_FREETYPE
|
||||||
|
@ -55,6 +58,9 @@ HBLIBS += $(FREETYPE_LIBS)
|
||||||
HBDEPS += $(FREETYPE_DEPS)
|
HBDEPS += $(FREETYPE_DEPS)
|
||||||
HBSOURCES += $(HB_FT_sources)
|
HBSOURCES += $(HB_FT_sources)
|
||||||
HBHEADERS += $(HB_FT_headers)
|
HBHEADERS += $(HB_FT_headers)
|
||||||
|
HB_HAS_FREETYPE_DEF = define HB_HAS_FREETYPE 1
|
||||||
|
else
|
||||||
|
HB_HAS_FREETYPE_DEF = undef HB_HAS_FREETYPE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_GRAPHITE2
|
if HAVE_GRAPHITE2
|
||||||
|
@ -63,6 +69,9 @@ HBLIBS += $(GRAPHITE2_LIBS)
|
||||||
HBDEPS += $(GRAPHITE2_DEPS)
|
HBDEPS += $(GRAPHITE2_DEPS)
|
||||||
HBSOURCES += $(HB_GRAPHITE2_sources)
|
HBSOURCES += $(HB_GRAPHITE2_sources)
|
||||||
HBHEADERS += $(HB_GRAPHITE2_headers)
|
HBHEADERS += $(HB_GRAPHITE2_headers)
|
||||||
|
HB_HAS_GRAPHITE_DEF = define HB_HAS_GRAPHITE 1
|
||||||
|
else
|
||||||
|
HB_HAS_GRAPHITE_DEF = undef HB_HAS_GRAPHITE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_UNISCRIBE
|
if HAVE_UNISCRIBE
|
||||||
|
@ -70,6 +79,9 @@ HBCFLAGS += $(UNISCRIBE_CFLAGS)
|
||||||
HBNONPCLIBS += $(UNISCRIBE_LIBS)
|
HBNONPCLIBS += $(UNISCRIBE_LIBS)
|
||||||
HBSOURCES += $(HB_UNISCRIBE_sources)
|
HBSOURCES += $(HB_UNISCRIBE_sources)
|
||||||
HBHEADERS += $(HB_UNISCRIBE_headers)
|
HBHEADERS += $(HB_UNISCRIBE_headers)
|
||||||
|
HB_HAS_UNISCRIBE_DEF = define HB_HAS_UNISCRIBE 1
|
||||||
|
else
|
||||||
|
HB_HAS_UNISCRIBE_DEF = undef HB_HAS_UNISCRIBE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_DIRECTWRITE
|
if HAVE_DIRECTWRITE
|
||||||
|
@ -77,6 +89,9 @@ HBCFLAGS += $(DIRECTWRITE_CXXFLAGS)
|
||||||
HBNONPCLIBS += $(DIRECTWRITE_LIBS)
|
HBNONPCLIBS += $(DIRECTWRITE_LIBS)
|
||||||
HBSOURCES += $(HB_DIRECTWRITE_sources)
|
HBSOURCES += $(HB_DIRECTWRITE_sources)
|
||||||
HBHEADERS += $(HB_DIRECTWRITE_headers)
|
HBHEADERS += $(HB_DIRECTWRITE_headers)
|
||||||
|
HB_HAS_DIRECTWRITE_DEF = define HB_HAS_DIRECTWRITE 1
|
||||||
|
else
|
||||||
|
HB_HAS_DIRECTWRITE_DEF = undef HB_HAS_DIRECTWRITE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_GDI
|
if HAVE_GDI
|
||||||
|
@ -84,6 +99,9 @@ HBCFLAGS += $(GDI_CXXFLAGS)
|
||||||
HBNONPCLIBS += $(GDI_LIBS)
|
HBNONPCLIBS += $(GDI_LIBS)
|
||||||
HBSOURCES += $(HB_GDI_sources)
|
HBSOURCES += $(HB_GDI_sources)
|
||||||
HBHEADERS += $(HB_GDI_headers)
|
HBHEADERS += $(HB_GDI_headers)
|
||||||
|
HB_HAS_GDI_DEF = define HB_HAS_GDI 1
|
||||||
|
else
|
||||||
|
HB_HAS_GDI_DEF = undef HB_HAS_GDI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_CORETEXT
|
if HAVE_CORETEXT
|
||||||
|
@ -91,6 +109,9 @@ HBCFLAGS += $(CORETEXT_CFLAGS)
|
||||||
HBNONPCLIBS += $(CORETEXT_LIBS)
|
HBNONPCLIBS += $(CORETEXT_LIBS)
|
||||||
HBSOURCES += $(HB_CORETEXT_sources)
|
HBSOURCES += $(HB_CORETEXT_sources)
|
||||||
HBHEADERS += $(HB_CORETEXT_headers)
|
HBHEADERS += $(HB_CORETEXT_headers)
|
||||||
|
HB_HAS_CORETEXT_DEF = define HB_HAS_CORETEXT 1
|
||||||
|
else
|
||||||
|
HB_HAS_CORETEXT_DEF = undef HB_HAS_CORETEXT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +168,7 @@ pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = harfbuzz.pc
|
pkgconfig_DATA = harfbuzz.pc
|
||||||
cmakedir = $(libdir)/cmake/harfbuzz
|
cmakedir = $(libdir)/cmake/harfbuzz
|
||||||
cmake_DATA = harfbuzz-config.cmake
|
cmake_DATA = harfbuzz-config.cmake
|
||||||
EXTRA_DIST += hb-version.h.in harfbuzz.pc.in harfbuzz-config.cmake.in
|
EXTRA_DIST += hb-version.h.in hb-features.h.in harfbuzz.pc.in harfbuzz-config.cmake.in
|
||||||
|
|
||||||
lib_LTLIBRARIES += libharfbuzz-subset.la
|
lib_LTLIBRARIES += libharfbuzz-subset.la
|
||||||
libharfbuzz_subset_la_LINK = $(chosen_linker) $(libharfbuzz_subset_la_LDFLAGS)
|
libharfbuzz_subset_la_LINK = $(chosen_linker) $(libharfbuzz_subset_la_LDFLAGS)
|
||||||
|
@ -178,6 +199,7 @@ HBCFLAGS += $(ICU_CFLAGS)
|
||||||
HBLIBS += $(ICU_LIBS)
|
HBLIBS += $(ICU_LIBS)
|
||||||
HBSOURCES += $(HB_ICU_sources)
|
HBSOURCES += $(HB_ICU_sources)
|
||||||
HBHEADERS += $(HB_ICU_headers)
|
HBHEADERS += $(HB_ICU_headers)
|
||||||
|
HB_HAS_ICU_DEF = define HB_HAS_ICU 1
|
||||||
else
|
else
|
||||||
lib_LTLIBRARIES += libharfbuzz-icu.la
|
lib_LTLIBRARIES += libharfbuzz-icu.la
|
||||||
libharfbuzz_icu_la_SOURCES = $(HB_ICU_sources)
|
libharfbuzz_icu_la_SOURCES = $(HB_ICU_sources)
|
||||||
|
@ -187,6 +209,7 @@ libharfbuzz_icu_la_LIBADD = $(ICU_LIBS) libharfbuzz.la
|
||||||
EXTRA_libharfbuzz_icu_la_DEPENDENCIES = $(harfbuzz_icu_def_dependency)
|
EXTRA_libharfbuzz_icu_la_DEPENDENCIES = $(harfbuzz_icu_def_dependency)
|
||||||
pkginclude_HEADERS += $(HB_ICU_headers)
|
pkginclude_HEADERS += $(HB_ICU_headers)
|
||||||
pkgconfig_DATA += harfbuzz-icu.pc
|
pkgconfig_DATA += harfbuzz-icu.pc
|
||||||
|
HB_HAS_ICU_DEF = undef HB_HAS_ICU
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
EXTRA_DIST += harfbuzz-icu.pc.in
|
EXTRA_DIST += harfbuzz-icu.pc.in
|
||||||
|
@ -226,6 +249,23 @@ EXTRA_DIST += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
||||||
|
BUILT_SOURCES += \
|
||||||
|
hb-features.h
|
||||||
|
|
||||||
|
hb-features.h: hb-features.h.in $(top_srcdir)/configure.ac
|
||||||
|
$(AM_V_GEN) $(SED) \
|
||||||
|
-e 's/mesondefine HB_HAS_FREETYPE/$(HB_HAS_FREETYPE_DEF)/' \
|
||||||
|
-e 's/mesondefine HB_HAS_GDI/$(HB_HAS_GDI_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_GDI/$(HB_HAS_GDI_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_GRAPHITE/$(HB_HAS_GRAPHITE_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_GLIB/$(HB_HAS_GLIB_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_UNISCRIBE/$(HB_HAS_UNISCRIBE_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_DIRECTWRITE/$(HB_HAS_DIRECTWRITE_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_CORETEXT/$(HB_HAS_CORETEXT_DEF)/' \
|
||||||
|
-e 's/#mesondefine HB_HAS_ICU/$(HB_HAS_ICU_DEF)/' \
|
||||||
|
"$<" > "$@" || ($(RM) "$@"; false)
|
||||||
|
|
||||||
|
|
||||||
%.pc: %.pc.in $(top_builddir)/config.status
|
%.pc: %.pc.in $(top_builddir)/config.status
|
||||||
$(AM_V_GEN) \
|
$(AM_V_GEN) \
|
||||||
$(SED) -e 's@%prefix%@$(prefix)@g' \
|
$(SED) -e 's@%prefix%@$(prefix)@g' \
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2022 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, a text shaping library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
|
||||||
|
#error "Include <hb.h> instead."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HB_FEATURES_H
|
||||||
|
#define HB_FEATURES_H
|
||||||
|
|
||||||
|
#include "hb-common.h"
|
||||||
|
|
||||||
|
HB_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_FREETYPE:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with Freetype support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_FREETYPE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_GDI:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with GDI support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_GDI
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_GRAPHITE:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with Graphite support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_GRAPHITE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_GLIB:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with GLib support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_GLIB
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_UNISCRIBE:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with Uniscribe support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_UNISCRIBE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_DIRECTWRITE:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with DirectWrite support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_DIRECTWRITE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_CORETEXT:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with CoreText support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_CORETEXT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HB_HAS_ICU:
|
||||||
|
*
|
||||||
|
* Defined if Harfbuzz has been built with ICU support.
|
||||||
|
*/
|
||||||
|
#mesondefine HB_HAS_ICU
|
||||||
|
|
||||||
|
|
||||||
|
HB_END_DECLS
|
||||||
|
|
||||||
|
#endif /* HB_FEATURES_H */
|
|
@ -414,33 +414,40 @@ 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]
|
||||||
|
hb_features.set('HB_HAS_FREETYPE', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if conf.get('HAVE_GDI', 0) == 1
|
if conf.get('HAVE_GDI', 0) == 1
|
||||||
hb_sources += hb_gdi_sources
|
hb_sources += hb_gdi_sources
|
||||||
hb_headers += hb_gdi_headers
|
hb_headers += hb_gdi_headers
|
||||||
harfbuzz_deps += gdi_uniscribe_deps
|
harfbuzz_deps += gdi_uniscribe_deps
|
||||||
|
hb_features.set('HB_HAS_GDI', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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]
|
||||||
|
hb_features.set('HB_HAS_GRAPHITE', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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]
|
||||||
|
hb_features.set('HB_HAS_GLIB', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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
|
||||||
|
hb_features.set('HB_HAS_UNISCRIBE', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if conf.get('HAVE_DIRECTWRITE', 0) == 1
|
if conf.get('HAVE_DIRECTWRITE', 0) == 1
|
||||||
|
@ -448,12 +455,14 @@ if conf.get('HAVE_DIRECTWRITE', 0) == 1
|
||||||
hb_headers += hb_directwrite_headers
|
hb_headers += hb_directwrite_headers
|
||||||
# hb-directwrite needs a C++ linker
|
# hb-directwrite needs a C++ linker
|
||||||
libharfbuzz_link_language = 'cpp'
|
libharfbuzz_link_language = 'cpp'
|
||||||
|
hb_features.set('HB_HAS_DIRECTWRITE', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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
|
||||||
|
hb_features.set('HB_HAS_CORETEXT', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
have_icu = conf.get('HAVE_ICU', 0) == 1
|
have_icu = conf.get('HAVE_ICU', 0) == 1
|
||||||
|
@ -463,8 +472,17 @@ 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]
|
||||||
|
hb_features.set('HB_HAS_ICU', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
hb_features_h = configure_file(input: 'hb-features.h.in',
|
||||||
|
output: 'hb-features.h',
|
||||||
|
configuration: hb_features,
|
||||||
|
install: true,
|
||||||
|
install_dir: get_option('includedir') / meson.project_name())
|
||||||
|
|
||||||
|
# Base and default-included sources and headers
|
||||||
|
|
||||||
# harfbuzz
|
# harfbuzz
|
||||||
gen_def = find_program('gen-def.py')
|
gen_def = find_program('gen-def.py')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue