comparison mupdf-source/thirdparty/harfbuzz/src/meson.build @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 hb_version_h = configure_file(
2 command: [find_program('gen-hb-version.py'), meson.project_version(), '@OUTPUT@', '@INPUT@'],
3 input: 'hb-version.h.in',
4 output: 'hb-version.h',
5 install: true,
6 install_dir: get_option('includedir') / meson.project_name())
7
8 # Base and default-included sources and headers
9 hb_base_sources = files(
10 'hb-aat-layout-ankr-table.hh',
11 'hb-aat-layout-bsln-table.hh',
12 'hb-aat-layout-common.hh',
13 'hb-aat-layout-feat-table.hh',
14 'hb-aat-layout-just-table.hh',
15 'hb-aat-layout-kerx-table.hh',
16 'hb-aat-layout-morx-table.hh',
17 'hb-aat-layout-opbd-table.hh',
18 'hb-aat-layout-trak-table.hh',
19 'hb-aat-layout.cc',
20 'hb-aat-layout.hh',
21 'hb-aat-ltag-table.hh',
22 'hb-aat-map.cc',
23 'hb-aat-map.hh',
24 'hb-algs.hh',
25 'hb-array.hh',
26 'hb-atomic.hh',
27 'hb-bimap.hh',
28 'hb-bit-page.hh',
29 'hb-blob.cc',
30 'hb-blob.hh',
31 'hb-buffer-serialize.cc',
32 'hb-buffer-verify.cc',
33 'hb-buffer.cc',
34 'hb-buffer.hh',
35 'hb-cache.hh',
36 'hb-cff-interp-common.hh',
37 'hb-cff-interp-cs-common.hh',
38 'hb-cff-interp-dict-common.hh',
39 'hb-cff1-interp-cs.hh',
40 'hb-cff2-interp-cs.hh',
41 'hb-common.cc',
42 'hb-config.hh',
43 'hb-debug.hh',
44 'hb-dispatch.hh',
45 'hb-draw.cc',
46 'hb-draw.hh',
47 'hb-face.cc',
48 'hb-face.hh',
49 'hb-fallback-shape.cc',
50 'hb-font.cc',
51 'hb-font.hh',
52 'hb-iter.hh',
53 'hb-kern.hh',
54 'hb-machinery.hh',
55 'hb-map.cc',
56 'hb-map.hh',
57 'hb-meta.hh',
58 'hb-ms-feature-ranges.hh',
59 'hb-multimap.hh',
60 'hb-mutex.hh',
61 'hb-null.hh',
62 'hb-number.cc',
63 'hb-number.hh',
64 'hb-object.hh',
65 'hb-open-file.hh',
66 'hb-open-type.hh',
67 'hb-ot-cff-common.hh',
68 'hb-ot-cff1-std-str.hh',
69 'hb-ot-cff1-table.cc',
70 'hb-ot-cff1-table.hh',
71 'hb-ot-cff2-table.cc',
72 'hb-ot-cff2-table.hh',
73 'hb-ot-cmap-table.hh',
74 'hb-ot-color-cbdt-table.hh',
75 'hb-ot-color-colr-table.hh',
76 'hb-ot-color-cpal-table.hh',
77 'hb-ot-color-sbix-table.hh',
78 'hb-ot-color-svg-table.hh',
79 'hb-ot-color.cc',
80 'hb-ot-face-table-list.hh',
81 'hb-ot-face.cc',
82 'hb-ot-face.hh',
83 'hb-ot-font.cc',
84 'hb-ot-gasp-table.hh',
85 'hb-ot-glyf-table.hh',
86 'hb-ot-hdmx-table.hh',
87 'hb-ot-head-table.hh',
88 'hb-ot-hhea-table.hh',
89 'hb-ot-hmtx-table.hh',
90 'hb-ot-kern-table.hh',
91 'hb-ot-layout-base-table.hh',
92 'hb-ot-layout-common.hh',
93 'hb-ot-layout-gdef-table.hh',
94 'hb-ot-layout-gpos-table.hh',
95 'hb-ot-layout-gsub-table.hh',
96 'OT/glyf/glyf.hh',
97 'OT/glyf/glyf-helpers.hh',
98 'OT/glyf/loca.hh',
99 'OT/glyf/path-builder.hh',
100 'OT/glyf/Glyph.hh',
101 'OT/glyf/GlyphHeader.hh',
102 'OT/glyf/SimpleGlyph.hh',
103 'OT/glyf/CompositeGlyph.hh',
104 'OT/glyf/SubsetGlyph.hh',
105 'OT/Layout/types.hh',
106 'OT/Layout/Common/Coverage.hh',
107 'OT/Layout/Common/CoverageFormat1.hh',
108 'OT/Layout/Common/CoverageFormat2.hh',
109 'OT/Layout/Common/RangeRecord.hh',
110 'OT/Layout/GPOS/AnchorFormat1.hh',
111 'OT/Layout/GPOS/AnchorFormat2.hh',
112 'OT/Layout/GPOS/AnchorFormat3.hh',
113 'OT/Layout/GPOS/Anchor.hh',
114 'OT/Layout/GPOS/AnchorMatrix.hh',
115 'OT/Layout/GPOS/ChainContextPos.hh',
116 'OT/Layout/GPOS/Common.hh',
117 'OT/Layout/GPOS/ContextPos.hh',
118 'OT/Layout/GPOS/CursivePosFormat1.hh',
119 'OT/Layout/GPOS/CursivePos.hh',
120 'OT/Layout/GPOS/ExtensionPos.hh',
121 'OT/Layout/GPOS/GPOS.hh',
122 'OT/Layout/GPOS/LigatureArray.hh',
123 'OT/Layout/GPOS/MarkArray.hh',
124 'OT/Layout/GPOS/MarkBasePosFormat1.hh',
125 'OT/Layout/GPOS/MarkBasePos.hh',
126 'OT/Layout/GPOS/MarkLigPosFormat1.hh',
127 'OT/Layout/GPOS/MarkLigPos.hh',
128 'OT/Layout/GPOS/MarkMarkPosFormat1.hh',
129 'OT/Layout/GPOS/MarkMarkPos.hh',
130 'OT/Layout/GPOS/MarkRecord.hh',
131 'OT/Layout/GPOS/PairPosFormat1.hh',
132 'OT/Layout/GPOS/PairPosFormat2.hh',
133 'OT/Layout/GPOS/PairPos.hh',
134 'OT/Layout/GPOS/PairSet.hh',
135 'OT/Layout/GPOS/PairValueRecord.hh',
136 'OT/Layout/GPOS/PosLookup.hh',
137 'OT/Layout/GPOS/PosLookupSubTable.hh',
138 'OT/Layout/GPOS/SinglePosFormat1.hh',
139 'OT/Layout/GPOS/SinglePosFormat2.hh',
140 'OT/Layout/GPOS/SinglePos.hh',
141 'OT/Layout/GPOS/ValueFormat.hh',
142 'OT/Layout/GSUB/AlternateSet.hh',
143 'OT/Layout/GSUB/AlternateSubstFormat1.hh',
144 'OT/Layout/GSUB/AlternateSubst.hh',
145 'OT/Layout/GSUB/ChainContextSubst.hh',
146 'OT/Layout/GSUB/Common.hh',
147 'OT/Layout/GSUB/ContextSubst.hh',
148 'OT/Layout/GSUB/ExtensionSubst.hh',
149 'OT/Layout/GSUB/GSUB.hh',
150 'OT/Layout/GSUB/Ligature.hh',
151 'OT/Layout/GSUB/LigatureSet.hh',
152 'OT/Layout/GSUB/LigatureSubstFormat1.hh',
153 'OT/Layout/GSUB/LigatureSubst.hh',
154 'OT/Layout/GSUB/MultipleSubstFormat1.hh',
155 'OT/Layout/GSUB/MultipleSubst.hh',
156 'OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh',
157 'OT/Layout/GSUB/ReverseChainSingleSubst.hh',
158 'OT/Layout/GSUB/Sequence.hh',
159 'OT/Layout/GSUB/SingleSubstFormat1.hh',
160 'OT/Layout/GSUB/SingleSubstFormat2.hh',
161 'OT/Layout/GSUB/SingleSubst.hh',
162 'OT/Layout/GSUB/SubstLookup.hh',
163 'OT/Layout/GSUB/SubstLookupSubTable.hh',
164 'hb-ot-layout-gsubgpos.hh',
165 'hb-ot-layout-jstf-table.hh',
166 'hb-ot-layout.cc',
167 'hb-ot-layout.hh',
168 'hb-ot-map.cc',
169 'hb-ot-map.hh',
170 'hb-ot-math-table.hh',
171 'hb-ot-math.cc',
172 'hb-ot-maxp-table.hh',
173 'hb-ot-meta-table.hh',
174 'hb-ot-meta.cc',
175 'hb-ot-metrics.cc',
176 'hb-ot-metrics.hh',
177 'hb-ot-name-language-static.hh',
178 'hb-ot-name-language.hh',
179 'hb-ot-name-table.hh',
180 'hb-ot-name.cc',
181 'hb-ot-os2-table.hh',
182 'hb-ot-os2-unicode-ranges.hh',
183 'hb-ot-post-macroman.hh',
184 'hb-ot-post-table.hh',
185 'hb-ot-shaper-arabic-fallback.hh',
186 'hb-ot-shaper-arabic-joining-list.hh',
187 'hb-ot-shaper-arabic-pua.hh',
188 'hb-ot-shaper-arabic-table.hh',
189 'hb-ot-shaper-arabic-win1256.hh',
190 'hb-ot-shaper-arabic.cc',
191 'hb-ot-shaper-arabic.hh',
192 'hb-ot-shaper-default.cc',
193 'hb-ot-shaper-hangul.cc',
194 'hb-ot-shaper-hebrew.cc',
195 'hb-ot-shaper-indic-table.cc',
196 'hb-ot-shaper-indic.cc',
197 'hb-ot-shaper-indic.hh',
198 'hb-ot-shaper-khmer.cc',
199 'hb-ot-shaper-myanmar.cc',
200 'hb-ot-shaper-syllabic.cc',
201 'hb-ot-shaper-syllabic.hh',
202 'hb-ot-shaper-thai.cc',
203 'hb-ot-shaper-use-table.hh',
204 'hb-ot-shaper-use.cc',
205 'hb-ot-shaper-vowel-constraints.cc',
206 'hb-ot-shaper-vowel-constraints.hh',
207 'hb-ot-shaper.hh',
208 'hb-ot-shape-fallback.cc',
209 'hb-ot-shape-fallback.hh',
210 'hb-ot-shape-normalize.cc',
211 'hb-ot-shape-normalize.hh',
212 'hb-ot-shape.cc',
213 'hb-ot-shape.hh',
214 'hb-ot-stat-table.hh',
215 'hb-ot-tag-table.hh',
216 'hb-ot-tag.cc',
217 'hb-ot-var-avar-table.hh',
218 'hb-ot-var-common.hh',
219 'hb-ot-var-fvar-table.hh',
220 'hb-ot-var-gvar-table.hh',
221 'hb-ot-var-hvar-table.hh',
222 'hb-ot-var-mvar-table.hh',
223 'hb-ot-var.cc',
224 'hb-ot-vorg-table.hh',
225 'hb-pool.hh',
226 'hb-sanitize.hh',
227 'hb-serialize.hh',
228 'hb-set-digest.hh',
229 'hb-set.cc',
230 'hb-set.hh',
231 'hb-shape-plan.cc',
232 'hb-shape-plan.hh',
233 'hb-shape.cc',
234 'hb-shaper-impl.hh',
235 'hb-shaper-list.hh',
236 'hb-shaper.cc',
237 'hb-shaper.hh',
238 'hb-static.cc',
239 'hb-string-array.hh',
240 'hb-style.cc',
241 'hb-ucd-table.hh',
242 'hb-ucd.cc',
243 'hb-unicode-emoji-table.hh',
244 'hb-unicode.cc',
245 'hb-unicode.hh',
246 'hb-utf.hh',
247 'hb-vector.hh',
248 'hb.hh',
249 )
250
251 hb_base_ragel_generated_sources = files(
252 'hb-buffer-deserialize-json.hh',
253 'hb-buffer-deserialize-text.hh',
254 'hb-number-parser.hh',
255 'hb-ot-shaper-indic-machine.hh',
256 'hb-ot-shaper-khmer-machine.hh',
257 'hb-ot-shaper-myanmar-machine.hh',
258 'hb-ot-shaper-use-machine.hh',
259 )
260 hb_base_ragel_sources = [
261 'hb-buffer-deserialize-json.rl',
262 'hb-buffer-deserialize-text.rl',
263 'hb-number-parser.rl',
264 'hb-ot-shaper-indic-machine.rl',
265 'hb-ot-shaper-khmer-machine.rl',
266 'hb-ot-shaper-myanmar-machine.rl',
267 'hb-ot-shaper-use-machine.rl',
268 ]
269
270 hb_base_headers = files(
271 'hb-aat-layout.h',
272 'hb-aat.h',
273 'hb-blob.h',
274 'hb-buffer.h',
275 'hb-common.h',
276 'hb-cplusplus.hh',
277 'hb-deprecated.h',
278 'hb-draw.h',
279 'hb-face.h',
280 'hb-font.h',
281 'hb-map.h',
282 'hb-ot-color.h',
283 'hb-ot-deprecated.h',
284 'hb-ot-font.h',
285 'hb-ot-layout.h',
286 'hb-ot-math.h',
287 'hb-ot-meta.h',
288 'hb-ot-metrics.h',
289 'hb-ot-name.h',
290 'hb-ot-shape.h',
291 'hb-ot-var.h',
292 'hb-ot.h',
293 'hb-set.h',
294 'hb-shape-plan.h',
295 'hb-shape.h',
296 'hb-style.h',
297 'hb-unicode.h',
298 'hb.h',
299 )
300 hb_base_headers += hb_version_h
301
302 # Optional Sources and Headers with external deps
303
304 hb_ft_sources = files('hb-ft.cc')
305 hb_ft_headers = files('hb-ft.h')
306
307 hb_glib_sources = files('hb-glib.cc')
308 hb_glib_headers = files('hb-glib.h')
309
310 hb_graphite2_sources = files('hb-graphite2.cc')
311 hb_graphite2_headers = files('hb-graphite2.h')
312
313 # System-dependent sources and headers
314
315 hb_coretext_sources = files('hb-coretext.cc')
316 hb_coretext_headers = files('hb-coretext.h')
317
318 hb_directwrite_sources = files('hb-directwrite.cc')
319 hb_directwrite_headers = files('hb-directwrite.h')
320
321 hb_gdi_sources = files('hb-gdi.cc')
322 hb_gdi_headers = files('hb-gdi.h')
323
324 hb_uniscribe_sources = files('hb-uniscribe.cc')
325 hb_uniscribe_headers = files('hb-uniscribe.h')
326
327 # Sources for libharfbuzz-gobject and libharfbuzz-icu
328 hb_icu_sources = files('hb-icu.cc')
329 hb_icu_headers = files('hb-icu.h')
330
331 # Sources for libharfbuzz-subset
332 hb_subset_sources = files(
333 'hb-number.cc',
334 'hb-number.hh',
335 'hb-ot-cff1-table.cc',
336 'hb-ot-cff2-table.cc',
337 'hb-static.cc',
338 'hb-subset-accelerator.hh',
339 'hb-subset-cff-common.cc',
340 'hb-subset-cff-common.hh',
341 'hb-subset-cff1.cc',
342 'hb-subset-cff1.hh',
343 'hb-subset-cff2.cc',
344 'hb-subset-cff2.hh',
345 'hb-subset-input.cc',
346 'hb-subset-input.hh',
347 'hb-subset-plan.cc',
348 'hb-subset-plan.hh',
349 'hb-subset-repacker.cc',
350 'graph/gsubgpos-context.cc',
351 'graph/gsubgpos-context.hh',
352 'graph/gsubgpos-graph.hh',
353 'graph/pairpos-graph.hh',
354 'graph/markbasepos-graph.hh',
355 'graph/coverage-graph.hh',
356 'graph/classdef-graph.hh',
357 'graph/split-helpers.hh',
358 'hb-subset.cc',
359 'hb-subset.hh',
360 )
361
362 hb_subset_headers = files(
363 'hb-subset.h',
364 'hb-subset-repacker.h'
365 )
366
367 hb_gobject_sources = files(
368 'hb-gobject-structs.cc'
369 )
370
371 hb_gobject_headers = files(
372 'hb-gobject.h',
373 'hb-gobject-structs.h',
374 )
375
376 ragel = find_program('ragel', version: '6.10', required: false)
377 has_ragel = ragel.found()
378 if not has_ragel and get_option('ragel_subproject')
379 ragel = subproject('ragel').get_variable('ragel')
380 has_ragel = true
381 endif
382 if not has_ragel
383 if not meson.is_subproject()
384 warning('You have to install ragel if you are going to develop HarfBuzz itself')
385 endif
386 else
387 ragel_helper = find_program('gen-ragel-artifacts.py')
388 foreach rl : hb_base_ragel_sources
389 hh = rl.split('.')[0] + '.hh'
390 custom_target('@0@'.format(hh),
391 build_by_default: true,
392 input: rl,
393 output: hh,
394 command: [ragel_helper, ragel, '@OUTPUT@', meson.current_source_dir(), '@INPUT@'],
395 )
396 endforeach
397 endif
398
399 custom_target('harfbuzz.cc',
400 build_by_default: true,
401 output: 'harfbuzz.cc',
402 input: hb_base_sources + hb_glib_sources + hb_ft_sources +
403 hb_graphite2_sources + hb_uniscribe_sources + hb_gdi_sources +
404 hb_directwrite_sources + hb_coretext_sources,
405 command: [find_program('gen-harfbuzzcc.py'),
406 '@OUTPUT@', meson.current_source_dir(), '@INPUT@'],
407 )
408
409 incsrc = include_directories('.')
410
411 hb_sources = hb_base_sources + hb_base_ragel_generated_sources
412 hb_headers = hb_base_headers
413
414 harfbuzz_deps = [thread_dep, m_dep] + harfbuzz_extra_deps
415
416 libharfbuzz_link_language = 'c'
417
418 hb_features = configuration_data()
419
420 if conf.get('HAVE_FREETYPE', 0) == 1
421 hb_sources += hb_ft_sources
422 hb_headers += hb_ft_headers
423 harfbuzz_deps += [freetype_dep]
424 hb_features.set('HB_HAS_FREETYPE', 1)
425 endif
426
427 if conf.get('HAVE_GDI', 0) == 1
428 hb_sources += hb_gdi_sources
429 hb_headers += hb_gdi_headers
430 harfbuzz_deps += gdi_uniscribe_deps
431 hb_features.set('HB_HAS_GDI', 1)
432 endif
433
434 if conf.get('HAVE_GRAPHITE2', 0) == 1
435 hb_sources += hb_graphite2_sources
436 hb_headers += hb_graphite2_headers
437 harfbuzz_deps += [graphite2_dep, graphite_dep]
438 hb_features.set('HB_HAS_GRAPHITE', 1)
439 endif
440
441 if conf.get('HAVE_GLIB', 0) == 1
442 hb_sources += hb_glib_sources
443 hb_headers += hb_glib_headers
444 harfbuzz_deps += [glib_dep]
445 hb_features.set('HB_HAS_GLIB', 1)
446 endif
447
448 if conf.get('HAVE_UNISCRIBE', 0) == 1
449 hb_sources += hb_uniscribe_sources
450 hb_headers += hb_uniscribe_headers
451 hb_features.set('HB_HAS_UNISCRIBE', 1)
452 endif
453
454 if conf.get('HAVE_DIRECTWRITE', 0) == 1
455 hb_sources += hb_directwrite_sources
456 hb_headers += hb_directwrite_headers
457 # hb-directwrite needs a C++ linker
458 libharfbuzz_link_language = 'cpp'
459 hb_features.set('HB_HAS_DIRECTWRITE', 1)
460 endif
461
462 if conf.get('HAVE_CORETEXT', 0) == 1
463 hb_sources += hb_coretext_sources
464 hb_headers += hb_coretext_headers
465 harfbuzz_deps += coretext_deps
466 hb_features.set('HB_HAS_CORETEXT', 1)
467 endif
468
469 have_icu = conf.get('HAVE_ICU', 0) == 1
470 have_icu_builtin = conf.get('HAVE_ICU_BUILTIN', 0) == 1
471
472 if have_icu and have_icu_builtin
473 hb_sources += hb_icu_sources
474 hb_headers += hb_icu_headers
475 harfbuzz_deps += [icu_dep]
476 hb_features.set('HB_HAS_ICU', 1)
477 endif
478
479 hb_features_h = configure_file(input: 'hb-features.h.in',
480 output: 'hb-features.h',
481 configuration: hb_features,
482 install: true,
483 install_dir: get_option('includedir') / meson.project_name())
484
485 # Base and default-included sources and headers
486
487 # harfbuzz
488 gen_def = find_program('gen-def.py')
489
490 harfbuzz_def_command_args = [gen_def, '@OUTPUT@', '@INPUT@']
491 if get_option('experimental_api')
492 harfbuzz_def_command_args += '--experimental-api'
493 endif
494
495 harfbuzz_def = custom_target('harfbuzz.def',
496 command: harfbuzz_def_command_args,
497 input: hb_headers,
498 output: 'harfbuzz.def')
499 defs_list = [harfbuzz_def]
500
501 version = '0.@0@.0'.format(hb_version_int)
502
503 extra_hb_cpp_args = []
504 if cpp.get_argument_syntax() == 'msvc'
505 if get_option('default_library') != 'static'
506 extra_hb_cpp_args += '-DHB_DLL_EXPORT'
507 endif
508 hb_so_version = ''
509 else
510 hb_so_version = '0'
511 endif
512
513 if get_option('fuzzer_ldflags') != ''
514 extra_hb_cpp_args += ['-DHB_CUSTOM_MALLOC']
515 hb_sources += 'failing-alloc.c'
516 hb_subset_sources += 'failing-alloc.c'
517 hb_icu_sources += 'failing-alloc.c'
518 hb_gobject_sources += 'failing-alloc.c'
519 endif
520
521 darwin_versions = [hb_version_int, '@0@.0.0'.format(hb_version_int)]
522
523 libharfbuzz = library('harfbuzz', hb_sources,
524 include_directories: incconfig,
525 dependencies: harfbuzz_deps,
526 cpp_args: cpp_args + extra_hb_cpp_args,
527 soversion: hb_so_version,
528 version: version,
529 install: true,
530 darwin_versions: darwin_versions,
531 link_language: libharfbuzz_link_language,
532 )
533
534 libharfbuzz_dep = declare_dependency(
535 link_with: libharfbuzz,
536 include_directories: incsrc,
537 dependencies: harfbuzz_deps)
538
539 # harfbuzz-subset
540 harfbuzz_subset_def = custom_target('harfbuzz-subset.def',
541 command: [gen_def, '@OUTPUT@', '@INPUT@'],
542 input: hb_subset_headers,
543 output: 'harfbuzz-subset.def')
544 defs_list += [harfbuzz_subset_def]
545
546 libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
547 include_directories: incconfig,
548 dependencies: [m_dep],
549 link_with: [libharfbuzz],
550 cpp_args: cpp_args + extra_hb_cpp_args,
551 soversion: hb_so_version,
552 version: version,
553 install: true,
554 darwin_versions: darwin_versions,
555 link_language: 'c',
556 )
557
558 custom_target('harfbuzz-subset.cc',
559 build_by_default: true,
560 output: 'harfbuzz-subset.cc',
561 input: hb_base_sources + hb_subset_sources,
562 command: [find_program('gen-harfbuzzcc.py'),
563 '@OUTPUT@', meson.current_source_dir(), '@INPUT@'],
564 )
565
566 libharfbuzz_subset_dep = declare_dependency(
567 link_with: libharfbuzz_subset,
568 include_directories: incsrc,
569 dependencies: [m_dep])
570
571 if get_option('tests').enabled()
572 # TODO: MSVC gives the following,
573 # error LNK2019: unresolved external symbol "unsigned __int64 const * const _hb_NullPool"
574 if cpp.get_argument_syntax() != 'msvc'
575 noinst_programs = {
576 'main': 'main.cc',
577 'test-basics': 'test.cc',
578 'test-buffer-serialize': 'test-buffer-serialize.cc',
579 'test-ot-meta': 'test-ot-meta.cc',
580 'test-ot-name': 'test-ot-name.cc',
581 'test-ot-glyphname': 'test-ot-glyphname.cc',
582 'test-ot-gpos-size-params': 'test-gpos-size-params.cc',
583 'test-ot-gsub-would-substitute': 'test-gsub-would-substitute.cc',
584 'test-use-table': 'test-use-table.cc',
585 }
586 foreach name, source : noinst_programs
587 executable(name, source,
588 include_directories: incconfig,
589 cpp_args: cpp_args,
590 dependencies: libharfbuzz_dep,
591 install: false,
592 )
593 endforeach
594 endif
595
596 compiled_tests = {
597 'test-algs': ['test-algs.cc', 'hb-static.cc'],
598 'test-array': ['test-array.cc'],
599 'test-iter': ['test-iter.cc', 'hb-static.cc'],
600 'test-machinery': ['test-machinery.cc', 'hb-static.cc'],
601 'test-map': ['test-map.cc', 'hb-static.cc'],
602 'test-multimap': ['test-multimap.cc', 'hb-static.cc'],
603 'test-number': ['test-number.cc', 'hb-number.cc'],
604 'test-ot-tag': ['hb-ot-tag.cc'],
605 'test-priority-queue': ['test-priority-queue.cc', 'hb-static.cc'],
606 'test-repacker': ['test-repacker.cc', 'hb-static.cc', 'graph/gsubgpos-context.cc'],
607 'test-classdef-graph': ['graph/test-classdef-graph.cc', 'hb-static.cc', 'graph/gsubgpos-context.cc'],
608 'test-set': ['test-set.cc', 'hb-static.cc'],
609 'test-serialize': ['test-serialize.cc', 'hb-static.cc'],
610 'test-unicode-ranges': ['test-unicode-ranges.cc'],
611 'test-vector': ['test-vector.cc', 'hb-static.cc'],
612 'test-bimap': ['test-bimap.cc', 'hb-static.cc'],
613 }
614 foreach name, source : compiled_tests
615 if cpp.get_argument_syntax() == 'msvc' and source.contains('hb-static.cc')
616 # TODO: MSVC doesn't like tests having hb-static.cc, fix them
617 continue
618 endif
619 test(name, executable(name, source,
620 include_directories: incconfig,
621 cpp_args: cpp_args + ['-DMAIN', '-UNDEBUG'],
622 dependencies: libharfbuzz_dep,
623 install: false,
624 ), suite: ['src'])
625 endforeach
626 endif
627
628 pkgmod.generate(libharfbuzz,
629 description: 'HarfBuzz text shaping library',
630 subdirs: [meson.project_name()],
631 version: meson.project_version(),
632 )
633
634 pkgmod.generate(libharfbuzz_subset,
635 description: 'HarfBuzz font subsetter',
636 requires: ['harfbuzz = @0@'.format(meson.project_version())],
637 subdirs: [meson.project_name()],
638 version: meson.project_version(),
639 )
640
641 libharfbuzz_icu_dep = null_dep
642 if have_icu and not have_icu_builtin
643 harfbuzz_icu_def = custom_target('harfbuzz-icu.def',
644 command: [gen_def, '@OUTPUT@', '@INPUT@'],
645 input: [hb_icu_headers],
646 output: 'harfbuzz-icu.def')
647 defs_list += [harfbuzz_icu_def]
648
649 libharfbuzz_icu = library('harfbuzz-icu', [hb_icu_sources, hb_icu_headers],
650 include_directories: incconfig,
651 dependencies: icu_dep,
652 link_with: [libharfbuzz],
653 cpp_args: cpp_args + extra_hb_cpp_args,
654 soversion: hb_so_version,
655 version: version,
656 install: true,
657 darwin_versions: darwin_versions,
658 # ICU links to stdc++ anyway so the default linker is good
659 # link_language: 'c',
660 )
661
662 libharfbuzz_icu_dep = declare_dependency(
663 link_with: libharfbuzz_icu,
664 include_directories: incsrc,
665 dependencies: icu_dep)
666
667 pkgmod.generate(libharfbuzz_icu,
668 description: 'HarfBuzz text shaping library ICU integration',
669 requires: ['harfbuzz = @0@'.format(meson.project_version())],
670 subdirs: [meson.project_name()],
671 version: meson.project_version(),
672 )
673
674 install_headers(hb_icu_headers, subdir: meson.project_name())
675 endif
676
677 have_gobject = conf.get('HAVE_GOBJECT', 0) == 1
678
679 cmake_config = configuration_data()
680 cmake_config.set('libdir', get_option('prefix') / get_option('libdir'))
681 cmake_config.set('includedir', get_option('prefix') / get_option('includedir'))
682 cmake_config.set('HB_LIBTOOL_VERSION_INFO', hb_libtool_version_info)
683 cmake_config.set('have_gobject', '@0@'.format(have_gobject))
684 configure_file(input: 'harfbuzz-config.cmake.in',
685 output: 'harfbuzz-config.cmake',
686 configuration: cmake_config,
687 install_dir: get_option('libdir') / 'cmake' / 'harfbuzz',
688 )
689
690 libharfbuzz_gobject_dep = null_dep
691 if have_gobject
692 gnome = import('gnome')
693
694 h_templ = configure_file(
695 input: 'hb-gobject-enums.h.tmpl',
696 output: 'hb-gobject-enums-tmp.h.tmpl',
697 copy: true)
698
699 cc_templ = configure_file(
700 input: 'hb-gobject-enums.cc.tmpl',
701 output: 'hb-gobject-enums-tmp.cc.tmpl',
702 copy: true)
703
704 enums = gnome.mkenums('hb-gobject',
705 sources: hb_headers,
706 h_template: h_templ,
707 c_template: cc_templ,
708 identifier_prefix: 'hb_',
709 symbol_prefix: 'hb_gobject',
710 )
711
712 enum_c = custom_target('hb-gobject-enums.cc',
713 input: enums[0],
714 output: 'hb-gobject-enums.cc',
715 command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@']
716 )
717
718 enum_h = custom_target('hb-gobject-enums.h',
719 input: enums[1],
720 output: 'hb-gobject-enums.h',
721 command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'],
722 install: true,
723 install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(),
724 )
725
726 hb_gobject_sources += [enum_c]
727
728 harfbuzz_gobject_def = custom_target('harfbuzz-gobject.def',
729 command: [gen_def, '@OUTPUT@', '@INPUT@'],
730 input: [hb_gobject_headers, enum_h],
731 output: 'harfbuzz-gobject.def')
732 defs_list += [harfbuzz_gobject_def]
733
734 libharfbuzz_gobject = library('harfbuzz-gobject', [hb_gobject_sources, enum_c, enum_h],
735 include_directories: incconfig,
736 dependencies: [glib_dep, gobject_dep],
737 link_with: [libharfbuzz],
738 cpp_args: cpp_args + extra_hb_cpp_args,
739 soversion: hb_so_version,
740 version: version,
741 install: true,
742 darwin_versions: darwin_versions,
743 link_language: 'c',
744 )
745
746 gir = find_program('g-ir-scanner', required: get_option('introspection'))
747 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
748
749 build_gir = build_gir and get_option('default_library') != 'static'
750 if not build_gir and get_option('introspection').enabled()
751 error('Introspection support is requested but the default library option should be shared or both')
752 endif
753
754 if build_gir
755 conf.set('HAVE_INTROSPECTION', 1)
756 hb_gen_files_gir = gnome.generate_gir(libharfbuzz_gobject,
757 sources: [hb_headers, hb_sources, hb_gobject_headers, hb_gobject_sources, enum_h],
758 dependencies: libharfbuzz_dep,
759 namespace: 'HarfBuzz',
760 nsversion: '0.0',
761 identifier_prefix: 'hb_',
762 symbol_prefix: ['hb', 'hb_gobject'],
763 includes: ['GObject-2.0', 'freetype2-2.0'],
764 export_packages: ['harfbuzz-gobject'],
765 header: 'hb-gobject.h',
766 install: true,
767 extra_args: ['--cflags-begin',
768 '-DHB_NO_SINGLE_HEADER_ERROR',
769 '-DHAVE_GOBJECT',
770 '-DHB_EXTERN=',
771 '--cflags-end'])
772 endif
773
774 libharfbuzz_gobject_dep = declare_dependency(
775 link_with: libharfbuzz_gobject,
776 include_directories: incsrc,
777 sources: build_gir ? hb_gen_files_gir : hb_gobject_sources,
778 dependencies: [glib_dep, gobject_dep])
779
780 pkgmod.generate(libharfbuzz_gobject,
781 description: 'HarfBuzz text shaping library GObject integration',
782 requires: ['harfbuzz = @0@'.format(meson.project_version()), 'glib-2.0', 'gobject-2.0'],
783 subdirs: [meson.project_name()],
784 version: meson.project_version(),
785 )
786
787 install_headers(hb_gobject_headers, subdir: meson.project_name())
788 else
789 if get_option('introspection').enabled()
790 error('introspection requires gobject to be enabled')
791 endif
792 endif
793
794 if get_option('tests').enabled()
795 dist_check_script = [
796 'check-c-linkage-decls',
797 'check-externs',
798 'check-header-guards',
799 'check-includes',
800 ]
801
802 env = environment()
803 env.set('srcdir', meson.current_source_dir())
804 env.set('base_srcdir', meson.source_root())
805 env.set('builddir', meson.current_build_dir())
806 env.set('libs', meson.current_build_dir()) # TODO: Merge this with builddir after autotools removal
807 HBSOURCES = []
808 foreach f : hb_sources
809 HBSOURCES += '@0@'.format(f)
810 endforeach
811 env.set('HBSOURCES', ' '.join(HBSOURCES))
812 HBHEADERS = []
813 foreach f : hb_headers
814 HBHEADERS += '@0@'.format(f)
815 endforeach
816 env.set('HBHEADERS', ' '.join(HBHEADERS))
817
818 if cpp.get_argument_syntax() != 'msvc' and not meson.is_cross_build() # ensure the local tools are usable
819 dist_check_script += ['check-libstdc++', 'check-static-inits', 'check-symbols']
820 endif
821
822 foreach name : dist_check_script
823 test(name, find_program(name + '.py'),
824 env: env,
825 depends: name == 'check-symbols' ? defs_list : [],
826 suite: ['src'],
827 )
828 endforeach
829 endif
830
831 install_headers(hb_headers + hb_subset_headers, subdir: meson.project_name())