1 # Base and default-included sources and headers
3 'hb-aat-fdsc-table.hh',
4 'hb-aat-layout-ankr-table.hh',
5 'hb-aat-layout-bsln-table.hh',
6 'hb-aat-layout-common.hh',
7 'hb-aat-layout-feat-table.hh',
8 'hb-aat-layout-just-table.hh',
9 'hb-aat-layout-kerx-table.hh',
10 'hb-aat-layout-lcar-table.hh',
11 'hb-aat-layout-morx-table.hh',
12 'hb-aat-layout-opbd-table.hh',
13 'hb-aat-layout-trak-table.hh',
16 'hb-aat-ltag-table.hh',
24 'hb-buffer-serialize.cc',
28 'hb-cff-interp-common.hh',
29 'hb-cff-interp-cs-common.hh',
30 'hb-cff-interp-dict-common.hh',
31 'hb-cff1-interp-cs.hh',
32 'hb-cff2-interp-cs.hh',
41 'hb-fallback-shape.cc',
58 'hb-ot-cff-common.hh',
59 'hb-ot-cff1-table.cc',
60 'hb-ot-cff1-table.hh',
61 'hb-ot-cff1-std-str.hh',
62 'hb-ot-cff2-table.cc',
63 'hb-ot-cff2-table.hh',
64 'hb-ot-cmap-table.hh',
65 'hb-ot-color-cbdt-table.hh',
66 'hb-ot-color-colr-table.hh',
67 'hb-ot-color-cpal-table.hh',
68 'hb-ot-color-sbix-table.hh',
69 'hb-ot-color-svg-table.hh',
73 'hb-ot-face-table-list.hh',
75 'hb-ot-gasp-table.hh',
76 'hb-ot-glyf-table.hh',
77 'hb-ot-hdmx-table.hh',
78 'hb-ot-head-table.hh',
79 'hb-ot-hhea-table.hh',
80 'hb-ot-hmtx-table.hh',
81 'hb-ot-kern-table.hh',
82 'hb-ot-layout-base-table.hh',
83 'hb-ot-layout-common.hh',
84 'hb-ot-layout-gdef-table.hh',
85 'hb-ot-layout-gpos-table.hh',
86 'hb-ot-layout-gsub-table.hh',
87 'hb-ot-layout-gsubgpos.hh',
88 'hb-ot-layout-jstf-table.hh',
93 'hb-ot-math-table.hh',
95 'hb-ot-maxp-table.hh',
96 'hb-ot-meta-table.hh',
100 'hb-ot-name-language-static.hh',
101 'hb-ot-name-language.hh',
102 'hb-ot-name-table.hh',
104 'hb-ot-os2-table.hh',
105 'hb-ot-os2-unicode-ranges.hh',
106 'hb-ot-post-macroman.hh',
107 'hb-ot-post-table.hh',
108 'hb-ot-shape-complex-arabic-fallback.hh',
109 'hb-ot-shape-complex-arabic-table.hh',
110 'hb-ot-shape-complex-arabic-win1256.hh',
111 'hb-ot-shape-complex-arabic.cc',
112 'hb-ot-shape-complex-arabic.hh',
113 'hb-ot-shape-complex-default.cc',
114 'hb-ot-shape-complex-hangul.cc',
115 'hb-ot-shape-complex-hebrew.cc',
116 'hb-ot-shape-complex-indic-table.cc',
117 'hb-ot-shape-complex-indic.cc',
118 'hb-ot-shape-complex-indic.hh',
119 'hb-ot-shape-complex-khmer.cc',
120 'hb-ot-shape-complex-khmer.hh',
121 'hb-ot-shape-complex-myanmar.cc',
122 'hb-ot-shape-complex-myanmar.hh',
123 'hb-ot-shape-complex-thai.cc',
124 'hb-ot-shape-complex-use-table.cc',
125 'hb-ot-shape-complex-use.cc',
126 'hb-ot-shape-complex-use.hh',
127 'hb-ot-shape-complex-vowel-constraints.cc',
128 'hb-ot-shape-complex-vowel-constraints.hh',
129 'hb-ot-shape-complex.hh',
130 'hb-ot-shape-fallback.cc',
131 'hb-ot-shape-fallback.hh',
132 'hb-ot-shape-normalize.cc',
133 'hb-ot-shape-normalize.hh',
136 'hb-ot-stat-table.hh',
137 'hb-ot-tag-table.hh',
139 'hb-ot-var-avar-table.hh',
140 'hb-ot-var-fvar-table.hh',
141 'hb-ot-var-gvar-table.hh',
142 'hb-ot-var-hvar-table.hh',
143 'hb-ot-var-mvar-table.hh',
145 'hb-ot-vorg-table.hh',
160 'hb-string-array.hh',
163 'hb-unicode-emoji-table.hh',
171 hb_base_ragel_generated_sources = [
172 'hb-buffer-deserialize-json.hh',
173 'hb-buffer-deserialize-text.hh',
174 'hb-number-parser.hh',
175 'hb-ot-shape-complex-indic-machine.hh',
176 'hb-ot-shape-complex-khmer-machine.hh',
177 'hb-ot-shape-complex-myanmar-machine.hh',
178 'hb-ot-shape-complex-use-machine.hh',
180 hb_base_ragel_sources = [
181 'hb-buffer-deserialize-json.rl',
182 'hb-buffer-deserialize-text.rl',
183 'hb-number-parser.rl',
184 'hb-ot-shape-complex-indic-machine.rl',
185 'hb-ot-shape-complex-khmer-machine.rl',
186 'hb-ot-shape-complex-myanmar-machine.rl',
187 'hb-ot-shape-complex-use-machine.rl',
202 'hb-ot-deprecated.h',
220 # Optional Sources and Headers with external deps
222 hb_ft_sources = ['hb-ft.cc']
223 hb_ft_headers = ['hb-ft.h']
225 hb_glib_sources = ['hb-glib.cc']
226 hb_glib_headers = ['hb-glib.h']
228 hb_graphite2_sources = ['hb-graphite2.cc']
229 hb_graphite2_headers = ['hb-graphite2.h']
231 # System-dependent sources and headers
233 hb_coretext_sources = ['hb-coretext.cc']
234 hb_coretext_headers = ['hb-coretext.h']
236 hb_directwrite_sources = ['hb-directwrite.cc']
237 hb_directwrite_headers = ['hb-directwrite.h']
239 hb_gdi_sources = ['hb-gdi.cc']
240 hb_gdi_headers = ['hb-gdi.h']
242 hb_uniscribe_sources = ['hb-uniscribe.cc']
243 hb_uniscribe_headers = ['hb-uniscribe.h']
245 # Sources for libharfbuzz-gobject and libharfbuzz-icu
246 hb_icu_sources = ['hb-icu.cc']
247 hb_icu_headers = ['hb-icu.h']
249 # Sources for libharfbuzz-subset
250 hb_subset_sources = [
253 'hb-ot-cff1-table.cc',
254 'hb-ot-cff2-table.cc',
256 'hb-subset-cff-common.cc',
257 'hb-subset-cff-common.hh',
262 'hb-subset-input.cc',
263 'hb-subset-input.hh',
272 hb_subset_headers = ['hb-subset.h']
274 hb_gobject_sources = [
275 'hb-gobject-structs.cc'
278 hb_gobject_headers = [
280 'hb-gobject-structs.h',
283 custom_target('hb-version.h',
284 build_by_default: true,
285 input: 'hb-version.h.in',
286 output: 'hb-version.h',
287 command: [find_program('gen-hb-version.py'), meson.project_version(),
288 '@INPUT@', meson.current_source_dir() / 'hb-version.h'])
290 ragel = find_program('ragel', required: false)
292 warning('You have to install ragel if you are going to develop HarfBuzz itself')
294 custom_target('ragel header files',
295 build_by_default: true,
296 input: hb_base_ragel_sources,
297 output: '.ragel-artifacts',
298 command: [find_program('gen-ragel-artifacts.py')] + hb_base_ragel_sources)
301 custom_target('harfbuzz.cc',
302 build_by_default: true,
303 output: 'harfbuzz.cc',
304 command: [find_program('gen-harfbuzzcc.py'),
305 meson.source_root() / '@OUTPUT@'] +
306 hb_base_sources + hb_glib_sources + hb_ft_sources +
307 hb_graphite2_sources + hb_uniscribe_sources + hb_gdi_sources +
308 hb_directwrite_sources + hb_coretext_sources)
310 incsrc = include_directories('.')
312 hb_sources = hb_base_sources + hb_base_ragel_generated_sources
313 hb_headers = hb_base_headers
315 if conf.get('HAVE_FREETYPE', 0) == 1
316 hb_sources += hb_ft_sources
317 hb_headers += hb_ft_headers
320 if conf.get('HAVE_GDI', 0) == 1
321 hb_sources += hb_gdi_sources
322 hb_headers += hb_gdi_headers
325 if conf.get('HAVE_GRAPHITE2', 0) == 1
326 hb_sources += hb_graphite2_sources
327 hb_headers += hb_graphite2_headers
330 if conf.get('HAVE_GLIB', 0) == 1
331 hb_sources += hb_glib_sources
332 hb_headers += hb_glib_headers
335 if conf.get('HAVE_UNISCRIBE', 0) == 1
336 hb_sources += hb_uniscribe_sources
337 hb_headers += hb_uniscribe_headers
340 if conf.get('HAVE_DIRECTWRITE', 0) == 1
341 hb_sources += hb_directwrite_sources
342 hb_headers += hb_directwrite_headers
345 if conf.get('HAVE_CORETEXT', 0) == 1
346 hb_sources += hb_coretext_sources
347 hb_headers += hb_coretext_headers
350 if get_option('amalgam')
351 # replace the array if is amalgam build
352 hb_sources = ['harfbuzz.cc']
355 have_icu = conf.get('HAVE_ICU', 0) == 1
356 have_icu_builtin = conf.get('HAVE_ICU_BUILTIN', 0) == 1
358 if have_icu and have_icu_builtin
359 hb_sources += hb_icu_sources
360 hb_headers += hb_icu_headers
364 if not get_option('with_libstdcxx')
365 chosen_linker = 'cpp'
367 # Use a C linker, not C++; Don't link to libstdc++
372 gen_def = find_program('gen-def.py')
374 harfbuzz_def_command_args = [gen_def, '@OUTPUT@', '@INPUT@']
375 if get_option('experimental_api')
376 harfbuzz_def_command_args += '--experimental-api'
379 harfbuzz_def = custom_target('harfbuzz.def',
380 command: harfbuzz_def_command_args,
382 output: 'harfbuzz.def')
383 defs_list = [harfbuzz_def]
385 version = '0.' + '0'.join(meson.project_version().split('.')) + '.0'
387 extra_hb_cpp_args = []
388 if cpp.get_id() == 'msvc'
389 if get_option('default_library') == 'shared'
390 extra_hb_cpp_args += '-DHB_DLL_EXPORT'
397 libharfbuzz = library('harfbuzz', hb_sources,
398 include_directories: incconfig,
400 cpp_args: cpp_args + extra_hb_cpp_args,
401 soversion: hb_so_version,
404 link_language: chosen_linker,
407 libharfbuzz_dep = declare_dependency(
408 link_with: libharfbuzz,
409 include_directories: incsrc,
413 harfbuzz_subset_def = custom_target('harfbuzz-subset.def',
414 command: [gen_def, '@OUTPUT@', '@INPUT@'],
415 input: hb_subset_headers,
416 output: 'harfbuzz-subset.def')
417 defs_list += [harfbuzz_subset_def]
419 libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
420 include_directories: incconfig,
422 link_with: [libharfbuzz],
423 cpp_args: cpp_args + extra_hb_cpp_args,
424 soversion: hb_so_version,
427 link_language: chosen_linker,
430 libharfbuzz_subset_dep = declare_dependency(
431 link_with: libharfbuzz_subset,
432 include_directories: incsrc,
435 if get_option('tests').enabled()
436 # TODO: MSVC gives the following,
437 # error LNK2019: unresolved external symbol "unsigned __int64 const * const _hb_NullPool"
438 if cpp.get_id() != 'msvc'
441 'test-basics': 'test.cc',
442 'test-buffer-serialize': 'test-buffer-serialize.cc',
443 'test-ot-meta': 'test-ot-meta.cc',
444 'test-ot-name': 'test-ot-name.cc',
445 'test-ot-glyphname': 'test-ot-glyphname.cc',
446 'test-ot-gpos-size-params': 'test-gpos-size-params.cc',
447 'test-ot-gsub-would-substitute': 'test-gsub-would-substitute.cc',
449 foreach name, source : noinst_programs
450 executable(name, source,
451 include_directories: incconfig,
453 dependencies: libharfbuzz_dep,
460 'dump-indic-data': ['dump-indic-data.cc', 'hb-ot-shape-complex-indic-table.cc'],
461 'dump-khmer-data': ['dump-khmer-data.cc', 'hb-ot-shape-complex-indic-table.cc'],
462 'dump-myanmar-data': ['dump-myanmar-data.cc', 'hb-ot-shape-complex-indic-table.cc'],
463 'dump-use-data': ['dump-use-data.cc', 'hb-ot-shape-complex-use-table.cc'],
465 foreach name, source : check_programs
466 executable(name, source,
467 include_directories: incconfig,
469 dependencies: libharfbuzz_dep,
475 'test-array': 'test-array.cc',
476 'test-number': ['test-number.cc', 'hb-number.cc'],
477 'test-ot-tag': 'hb-ot-tag.cc',
478 'test-unicode-ranges': 'test-unicode-ranges.cc',
480 if cpp.get_id() != 'msvc'
481 # TODO: MSVC doesn't like these, fix them
483 'test-algs': ['test-algs.cc', 'hb-static.cc'],
484 'test-bimap': ['test-bimap.cc', 'hb-static.cc'],
485 'test-iter': ['test-iter.cc', 'hb-static.cc'],
486 'test-meta': ['test-meta.cc', 'hb-static.cc'],
489 foreach name, source : compiled_tests
490 test(name, executable(name, source,
491 include_directories: incconfig,
492 cpp_args: cpp_args + ['-DMAIN', '-UNDEBUG'],
493 dependencies: libharfbuzz_dep,
499 pkgmod.generate(libharfbuzz,
500 description: 'HarfBuzz text shaping library',
501 subdirs: [meson.project_name()],
502 version: meson.project_version(),
505 pkgmod.generate(libharfbuzz_subset,
506 description: 'HarfBuzz font subsetter',
507 subdirs: [meson.project_name()],
508 version: meson.project_version(),
511 if have_icu and not have_icu_builtin
512 harfbuzz_icu_def = custom_target('harfbuzz-icu.def',
513 command: [gen_def, '@OUTPUT@', '@INPUT@'],
514 input: [hb_icu_headers],
515 output: 'harfbuzz-icu.def')
516 defs_list += [harfbuzz_icu_def]
518 libharfbuzz_icu = library('harfbuzz-icu', [hb_icu_sources, hb_icu_headers],
519 include_directories: incconfig,
520 dependencies: icu_dep,
521 link_with: [libharfbuzz],
522 cpp_args: cpp_args + extra_hb_cpp_args,
523 soversion: hb_so_version,
526 # ICU links to stdc++ anyway so the default linker is good
527 # link_language: chosen_linker,
530 libharfbuzz_icu_dep = declare_dependency(
531 link_with: libharfbuzz_icu,
532 include_directories: incsrc,
535 pkgmod.generate(libharfbuzz_icu,
536 description: 'HarfBuzz text shaping library ICU integration',
537 subdirs: [meson.project_name()],
538 version: meson.project_version(),
541 install_headers(hb_icu_headers, subdir: meson.project_name())
543 libharfbuzz_icu_dep = dependency('', required: false)
546 have_gobject = conf.get('HAVE_GOBJECT', 0) == 1
548 cmake_config = configuration_data()
549 cmake_config.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
550 cmake_config.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
551 cmake_config.set('HB_LIBTOOL_VERSION_INFO', hb_libtool_version_info)
552 cmake_config.set('have_gobject', have_gobject ? 'true' : 'false')
553 configure_file(input: 'harfbuzz-config.cmake.in',
554 output: 'harfbuzz-config.cmake',
555 configuration: cmake_config,
556 install_dir: get_option('libdir') / 'cmake' / 'harfbuzz')
559 gnome = import('gnome')
561 h_templ = configure_file(
562 input: 'hb-gobject-enums.h.tmpl',
563 output: 'hb-gobject-enums-tmp.h.tmpl',
564 configuration: configuration_data(),
567 cc_templ = configure_file(
568 input: 'hb-gobject-enums.cc.tmpl',
569 output: 'hb-gobject-enums-tmp.cc.tmpl',
570 configuration: configuration_data(),
573 enums = gnome.mkenums('hb-gobject',
576 c_template: cc_templ,
577 identifier_prefix: 'hb_',
578 symbol_prefix: 'hb_gobject',
581 enum_c = custom_target('hb-gobject-enums.cc',
583 output: 'hb-gobject-enums.cc',
584 command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@']
587 enum_h = custom_target('hb-gobject-enums.h',
589 output: 'hb-gobject-enums.h',
590 command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'],
592 install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(),
595 hb_gobject_sources += [enum_c]
597 harfbuzz_gobject_def = custom_target('harfbuzz-gobject.def',
598 command: [gen_def, '@OUTPUT@', '@INPUT@'],
599 input: [hb_gobject_headers, enum_h],
600 output: 'harfbuzz-gobject.def')
601 defs_list += [harfbuzz_gobject_def]
603 libharfbuzz_gobject = library('harfbuzz-gobject', [hb_gobject_sources, enum_c, enum_h],
604 include_directories: incconfig,
606 link_with: [libharfbuzz],
607 cpp_args: cpp_args + extra_hb_cpp_args,
608 soversion: hb_so_version,
611 link_language: chosen_linker,
614 gir = find_program('g-ir-scanner', required: get_option('introspection'))
615 build_gir = gir.found() and not meson.is_cross_build()
618 conf.set('HAVE_INTROSPECTION', 1)
619 hb_gen_files_gir = gnome.generate_gir(libharfbuzz, libharfbuzz_gobject,
620 sources: [hb_headers, hb_sources, hb_gobject_headers, hb_gobject_sources, enum_h],
621 namespace: 'HarfBuzz',
623 identifier_prefix: 'hb_',
624 symbol_prefix: ['hb', 'hb_gobject'],
625 includes: ['GObject-2.0'],
626 export_packages: ['harfbuzz-gobject'],
627 header: 'hb-gobject.h',
629 extra_args: ['--cflags-begin',
642 libharfbuzz_gobject_dep = declare_dependency(
643 link_with: libharfbuzz_gobject,
644 include_directories: incsrc,
645 sources: build_gir ? hb_gen_files_gir : hb_gobject_sources,
648 pkgmod.generate(libharfbuzz_gobject,
649 description: 'HarfBuzz text shaping library GObject integration',
650 subdirs: [meson.project_name()],
651 version: meson.project_version(),
654 install_headers(hb_gobject_headers, subdir: meson.project_name())
656 if get_option('introspection').enabled()
657 error('introspection requires gobject to be enabled')
660 libharfbuzz_gobject_dep = dependency('', required: false)
663 if get_option('tests').enabled()
664 dist_check_script = [
665 'check-c-linkage-decls',
667 'check-header-guards',
672 env.set('srcdir', meson.current_source_dir())
673 env.set('builddir', meson.current_build_dir())
674 env.set('libs', meson.current_build_dir()) # TODO: Merge this with builddir after autotools removal
675 if not get_option('amalgam')
676 env.set('HBSOURCES', ' '.join(hb_sources))
678 env.set('HBHEADERS', ' '.join(hb_headers))
680 if cpp.get_id() != 'msvc' and not meson.is_cross_build() # ensure the local tools are usable
681 # See https://github.com/mesonbuild/meson/pull/6838
682 if meson.version().version_compare('>=0.54.999') and not get_option('with_libstdcxx')
683 dist_check_script += 'check-libstdc++'
685 dist_check_script += ['check-static-inits', 'check-symbols']
688 foreach name : dist_check_script
689 test(name, find_program(name + '.py'),
691 depends: name == 'check-symbols' ? defs_list : [],
697 install_headers(hb_headers + hb_subset_headers, subdir: meson.project_name())