Imported Upstream version 2.6.7
[platform/upstream/harfbuzz.git] / src / meson.build
1 # Base and default-included sources and headers
2 hb_base_sources = [
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',
14   'hb-aat-layout.cc',
15   'hb-aat-layout.hh',
16   'hb-aat-ltag-table.hh',
17   'hb-aat-map.cc',
18   'hb-aat-map.hh',
19   'hb-algs.hh',
20   'hb-array.hh',
21   'hb-atomic.hh',
22   'hb-blob.cc',
23   'hb-blob.hh',
24   'hb-buffer-serialize.cc',
25   'hb-buffer.cc',
26   'hb-buffer.hh',
27   'hb-cache.hh',
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',
33   'hb-common.cc',
34   'hb-config.hh',
35   'hb-debug.hh',
36   'hb-dispatch.hh',
37   'hb-draw.cc',
38   'hb-draw.hh',
39   'hb-face.cc',
40   'hb-face.hh',
41   'hb-fallback-shape.cc',
42   'hb-font.cc',
43   'hb-font.hh',
44   'hb-iter.hh',
45   'hb-kern.hh',
46   'hb-machinery.hh',
47   'hb-map.cc',
48   'hb-map.hh',
49   'hb-bimap.hh',
50   'hb-meta.hh',
51   'hb-mutex.hh',
52   'hb-null.hh',
53   'hb-number.cc',
54   'hb-number.hh',
55   'hb-object.hh',
56   'hb-open-file.hh',
57   'hb-open-type.hh',
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',
70   'hb-ot-color.cc',
71   'hb-ot-face.cc',
72   'hb-ot-face.hh',
73   'hb-ot-face-table-list.hh',
74   'hb-ot-font.cc',
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',
89   'hb-ot-layout.cc',
90   'hb-ot-layout.hh',
91   'hb-ot-map.cc',
92   'hb-ot-map.hh',
93   'hb-ot-math-table.hh',
94   'hb-ot-math.cc',
95   'hb-ot-maxp-table.hh',
96   'hb-ot-meta-table.hh',
97   'hb-ot-meta.cc',
98   'hb-ot-metrics.cc',
99   'hb-ot-metrics.hh',
100   'hb-ot-name-language-static.hh',
101   'hb-ot-name-language.hh',
102   'hb-ot-name-table.hh',
103   'hb-ot-name.cc',
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',
134   'hb-ot-shape.cc',
135   'hb-ot-shape.hh',
136   'hb-ot-stat-table.hh',
137   'hb-ot-tag-table.hh',
138   'hb-ot-tag.cc',
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',
144   'hb-ot-var.cc',
145   'hb-ot-vorg-table.hh',
146   'hb-pool.hh',
147   'hb-sanitize.hh',
148   'hb-serialize.hh',
149   'hb-set-digest.hh',
150   'hb-set.cc',
151   'hb-set.hh',
152   'hb-shape-plan.cc',
153   'hb-shape-plan.hh',
154   'hb-shape.cc',
155   'hb-shaper-impl.hh',
156   'hb-shaper-list.hh',
157   'hb-shaper.cc',
158   'hb-shaper.hh',
159   'hb-static.cc',
160   'hb-string-array.hh',
161   'hb-ucd-table.hh',
162   'hb-ucd.cc',
163   'hb-unicode-emoji-table.hh',
164   'hb-unicode.cc',
165   'hb-unicode.hh',
166   'hb-utf.hh',
167   'hb-vector.hh',
168   'hb.hh',
169 ]
170
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',
179 ]
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',
188 ]
189
190 hb_base_headers = [
191   'hb-aat-layout.h',
192   'hb-aat.h',
193   'hb-blob.h',
194   'hb-buffer.h',
195   'hb-common.h',
196   'hb-deprecated.h',
197   'hb-draw.h',
198   'hb-face.h',
199   'hb-font.h',
200   'hb-map.h',
201   'hb-ot-color.h',
202   'hb-ot-deprecated.h',
203   'hb-ot-font.h',
204   'hb-ot-layout.h',
205   'hb-ot-math.h',
206   'hb-ot-meta.h',
207   'hb-ot-metrics.h',
208   'hb-ot-name.h',
209   'hb-ot-shape.h',
210   'hb-ot-var.h',
211   'hb-ot.h',
212   'hb-set.h',
213   'hb-shape-plan.h',
214   'hb-shape.h',
215   'hb-unicode.h',
216   'hb-version.h',
217   'hb.h',
218 ]
219
220 # Optional Sources and Headers with external deps
221
222 hb_ft_sources = ['hb-ft.cc']
223 hb_ft_headers = ['hb-ft.h']
224
225 hb_glib_sources = ['hb-glib.cc']
226 hb_glib_headers = ['hb-glib.h']
227
228 hb_graphite2_sources = ['hb-graphite2.cc']
229 hb_graphite2_headers = ['hb-graphite2.h']
230
231 # System-dependent sources and headers
232
233 hb_coretext_sources = ['hb-coretext.cc']
234 hb_coretext_headers = ['hb-coretext.h']
235
236 hb_directwrite_sources = ['hb-directwrite.cc']
237 hb_directwrite_headers = ['hb-directwrite.h']
238
239 hb_gdi_sources = ['hb-gdi.cc']
240 hb_gdi_headers = ['hb-gdi.h']
241
242 hb_uniscribe_sources = ['hb-uniscribe.cc']
243 hb_uniscribe_headers = ['hb-uniscribe.h']
244
245 # Sources for libharfbuzz-gobject and libharfbuzz-icu
246 hb_icu_sources = ['hb-icu.cc']
247 hb_icu_headers = ['hb-icu.h']
248
249 # Sources for libharfbuzz-subset
250 hb_subset_sources = [
251   'hb-number.cc',
252   'hb-number.hh',
253   'hb-ot-cff1-table.cc',
254   'hb-ot-cff2-table.cc',
255   'hb-static.cc',
256   'hb-subset-cff-common.cc',
257   'hb-subset-cff-common.hh',
258   'hb-subset-cff1.cc',
259   'hb-subset-cff1.hh',
260   'hb-subset-cff2.cc',
261   'hb-subset-cff2.hh',
262   'hb-subset-input.cc',
263   'hb-subset-input.hh',
264   'hb-subset-plan.cc',
265   'hb-subset-plan.hh',
266   'hb-subset-plan.hh',
267   'hb-subset.cc',
268   'hb-subset.hh',
269   'hb-subset.hh',
270 ]
271
272 hb_subset_headers = ['hb-subset.h']
273
274 hb_gobject_sources = [
275   'hb-gobject-structs.cc'
276 ]
277
278 hb_gobject_headers = [
279   'hb-gobject.h',
280   'hb-gobject-structs.h',
281 ]
282
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'])
289
290 ragel = find_program('ragel', required: false)
291 if not ragel.found()
292   warning('You have to install ragel if you are going to develop HarfBuzz itself')
293 else
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)
299 endif
300
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)
309
310 incsrc = include_directories('.')
311
312 hb_sources = hb_base_sources + hb_base_ragel_generated_sources
313 hb_headers = hb_base_headers
314
315 if conf.get('HAVE_FREETYPE', 0) == 1
316   hb_sources += hb_ft_sources
317   hb_headers += hb_ft_headers
318 endif
319
320 if conf.get('HAVE_GDI', 0) == 1
321   hb_sources += hb_gdi_sources
322   hb_headers += hb_gdi_headers
323 endif
324
325 if conf.get('HAVE_GRAPHITE2', 0) == 1
326   hb_sources += hb_graphite2_sources
327   hb_headers += hb_graphite2_headers
328 endif
329
330 if conf.get('HAVE_GLIB', 0) == 1
331   hb_sources += hb_glib_sources
332   hb_headers += hb_glib_headers
333 endif
334
335 if conf.get('HAVE_UNISCRIBE', 0) == 1
336   hb_sources += hb_uniscribe_sources
337   hb_headers += hb_uniscribe_headers
338 endif
339
340 if conf.get('HAVE_DIRECTWRITE', 0) == 1
341   hb_sources += hb_directwrite_sources
342   hb_headers += hb_directwrite_headers
343 endif
344
345 if conf.get('HAVE_CORETEXT', 0) == 1
346   hb_sources += hb_coretext_sources
347   hb_headers += hb_coretext_headers
348 endif
349
350 if get_option('amalgam')
351   # replace the array if is amalgam build
352   hb_sources = ['harfbuzz.cc']
353 endif
354
355 have_icu = conf.get('HAVE_ICU', 0) == 1
356 have_icu_builtin = conf.get('HAVE_ICU_BUILTIN', 0) == 1
357
358 if have_icu and have_icu_builtin
359   hb_sources += hb_icu_sources
360   hb_headers += hb_icu_headers
361   deps += [icu_dep]
362 endif
363
364 if not get_option('with_libstdcxx')
365   chosen_linker = 'cpp'
366 else
367   # Use a C linker, not C++; Don't link to libstdc++
368   chosen_linker = 'c'
369 endif
370
371 # harfbuzz
372 gen_def = find_program('gen-def.py')
373
374 harfbuzz_def_command_args = [gen_def, '@OUTPUT@', '@INPUT@']
375 if get_option('experimental_api')
376   harfbuzz_def_command_args += '--experimental-api'
377 endif
378
379 harfbuzz_def = custom_target('harfbuzz.def',
380     command: harfbuzz_def_command_args,
381     input: hb_headers,
382     output: 'harfbuzz.def')
383 defs_list = [harfbuzz_def]
384
385 version = '0.' + '0'.join(meson.project_version().split('.')) + '.0'
386
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'
391   endif
392   hb_so_version = ''
393 else
394   hb_so_version = '0'
395 endif
396
397 libharfbuzz = library('harfbuzz', hb_sources,
398   include_directories: incconfig,
399   dependencies: deps,
400   cpp_args: cpp_args + extra_hb_cpp_args,
401   soversion: hb_so_version,
402   version: version,
403   install: true,
404   link_language: chosen_linker,
405 )
406
407 libharfbuzz_dep = declare_dependency(
408   link_with: libharfbuzz,
409   include_directories: incsrc,
410   dependencies: deps)
411
412 # harfbuzz-subset
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]
418
419 libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
420   include_directories: incconfig,
421   dependencies: deps,
422   link_with: [libharfbuzz],
423   cpp_args: cpp_args + extra_hb_cpp_args,
424   soversion: hb_so_version,
425   version: version,
426   install: true,
427   link_language: chosen_linker,
428 )
429
430 libharfbuzz_subset_dep = declare_dependency(
431   link_with: libharfbuzz_subset,
432   include_directories: incsrc,
433   dependencies: deps)
434
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'
439     noinst_programs = {
440       'main': 'main.cc',
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',
448     }
449     foreach name, source : noinst_programs
450       executable(name, source,
451         include_directories: incconfig,
452         cpp_args: cpp_args,
453         dependencies: libharfbuzz_dep,
454         install: false,
455       )
456     endforeach
457   endif
458
459   check_programs = {
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'],
464   }
465   foreach name, source : check_programs
466     executable(name, source,
467       include_directories: incconfig,
468       cpp_args: cpp_args,
469       dependencies: libharfbuzz_dep,
470       install: false,
471     )
472   endforeach
473
474   compiled_tests = {
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',
479   }
480   if cpp.get_id() != 'msvc'
481     # TODO: MSVC doesn't like these, fix them
482     compiled_tests += {
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'],
487     }
488   endif
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,
494       install: false,
495     ), suite: ['src'])
496   endforeach
497 endif
498
499 pkgmod.generate(libharfbuzz,
500   description: 'HarfBuzz text shaping library',
501   subdirs: [meson.project_name()],
502   version: meson.project_version(),
503 )
504
505 pkgmod.generate(libharfbuzz_subset,
506   description: 'HarfBuzz font subsetter',
507   subdirs: [meson.project_name()],
508   version: meson.project_version(),
509 )
510
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]
517
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,
524     version: version,
525     install: true,
526     # ICU links to stdc++ anyway so the default linker is good
527     # link_language: chosen_linker,
528   )
529
530   libharfbuzz_icu_dep = declare_dependency(
531     link_with: libharfbuzz_icu,
532     include_directories: incsrc,
533     dependencies: deps)
534
535   pkgmod.generate(libharfbuzz_icu,
536     description: 'HarfBuzz text shaping library ICU integration',
537     subdirs: [meson.project_name()],
538     version: meson.project_version(),
539   )
540
541   install_headers(hb_icu_headers, subdir: meson.project_name())
542 else
543   libharfbuzz_icu_dep = dependency('', required: false)
544 endif
545
546 have_gobject = conf.get('HAVE_GOBJECT', 0) == 1
547
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')
557
558 if have_gobject
559   gnome = import('gnome')
560
561   h_templ = configure_file(
562     input: 'hb-gobject-enums.h.tmpl',
563     output: 'hb-gobject-enums-tmp.h.tmpl',
564     configuration: configuration_data(),
565     format: 'cmake')
566
567   cc_templ = configure_file(
568     input: 'hb-gobject-enums.cc.tmpl',
569     output: 'hb-gobject-enums-tmp.cc.tmpl',
570     configuration: configuration_data(),
571     format: 'cmake')
572
573   enums = gnome.mkenums('hb-gobject',
574     sources: hb_headers,
575     h_template: h_templ,
576     c_template: cc_templ,
577     identifier_prefix: 'hb_',
578     symbol_prefix: 'hb_gobject',
579   )
580
581   enum_c = custom_target('hb-gobject-enums.cc',
582     input: enums[0],
583     output: 'hb-gobject-enums.cc',
584     command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@']
585   )
586
587   enum_h = custom_target('hb-gobject-enums.h',
588     input: enums[1],
589     output: 'hb-gobject-enums.h',
590     command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'],
591     install: true,
592     install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(),
593   )
594
595   hb_gobject_sources += [enum_c]
596
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]
602
603   libharfbuzz_gobject = library('harfbuzz-gobject', [hb_gobject_sources, enum_c, enum_h],
604     include_directories: incconfig,
605     dependencies: deps,
606     link_with: [libharfbuzz],
607     cpp_args: cpp_args + extra_hb_cpp_args,
608     soversion: hb_so_version,
609     version: version,
610     install: true,
611     link_language: chosen_linker,
612   )
613
614   gir = find_program('g-ir-scanner', required: get_option('introspection'))
615   build_gir = gir.found() and not meson.is_cross_build()
616
617   if build_gir
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',
622       nsversion: '0.0',
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',
628       install: true,
629       extra_args:  ['--cflags-begin',
630                     '-DHB_H',
631                     '-DHB_H_IN',
632                     '-DHB_OT_H',
633                     '-DHB_OT_H_IN',
634                     '-DHB_AAT_H',
635                     '-DHB_AAT_H_IN',
636                     '-DHB_GOBJECT_H',
637                     '-DHB_GOBJECT_H_IN',
638                     '-DHB_EXTERN=',
639                     '--cflags-end'])
640   endif
641
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,
646     dependencies: deps)
647
648   pkgmod.generate(libharfbuzz_gobject,
649     description: 'HarfBuzz text shaping library GObject integration',
650     subdirs: [meson.project_name()],
651     version: meson.project_version(),
652   )
653
654   install_headers(hb_gobject_headers, subdir: meson.project_name())
655 else
656   if get_option('introspection').enabled()
657     error('introspection requires gobject to be enabled')
658   endif
659
660   libharfbuzz_gobject_dep = dependency('', required: false)
661 endif
662
663 if get_option('tests').enabled()
664   dist_check_script = [
665     'check-c-linkage-decls',
666     'check-externs',
667     'check-header-guards',
668     'check-includes',
669   ]
670
671   env = environment()
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))
677   endif
678   env.set('HBHEADERS', ' '.join(hb_headers))
679
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++'
684     endif
685     dist_check_script += ['check-static-inits', 'check-symbols']
686   endif
687
688   foreach name : dist_check_script
689     test(name, find_program(name + '.py'),
690       env: env,
691       depends: name == 'check-symbols' ? defs_list : [],
692       suite: ['src'],
693     )
694   endforeach
695 endif
696
697 install_headers(hb_headers + hb_subset_headers, subdir: meson.project_name())