2018-05-17 01:28:53 +02:00
|
|
|
project('harfbuzz', 'c', 'cpp',
|
|
|
|
version: '1.7.6')
|
|
|
|
|
2018-06-05 02:15:43 +02:00
|
|
|
pkgmod = import('pkgconfig')
|
2018-05-17 01:28:53 +02:00
|
|
|
cpp = meson.get_compiler('cpp')
|
|
|
|
|
|
|
|
python3 = import('python').find_installation('python3')
|
|
|
|
|
|
|
|
check_headers = [
|
|
|
|
['unistd.h'],
|
|
|
|
['sys/mman.h'],
|
|
|
|
['xlocale.h'],
|
|
|
|
['stdbool.h'],
|
|
|
|
]
|
|
|
|
|
|
|
|
check_funcs = [
|
|
|
|
['atexit'],
|
|
|
|
['mprotect'],
|
|
|
|
['sysconf'],
|
|
|
|
['getpagesize'],
|
|
|
|
['mmap'],
|
|
|
|
['isatty'],
|
|
|
|
['newlocale'],
|
|
|
|
['strtod_l'],
|
|
|
|
['round'],
|
|
|
|
]
|
|
|
|
|
2018-05-17 16:20:10 +02:00
|
|
|
freetype_dep = dependency('freetype2', required: false, fallback: ['freetype2', 'freetype_dep'])
|
|
|
|
glib_dep = dependency('glib-2.0', required: false, fallback: ['glib', 'libglib_dep'])
|
|
|
|
gobject_dep = dependency('gobject-2.0', required: false, fallback: ['glib', 'libgobject_dep'])
|
2018-05-17 01:28:53 +02:00
|
|
|
cairo_dep = dependency('cairo', required: false)
|
|
|
|
cairo_ft_dep = dependency('cairo-ft', required: false)
|
2018-05-17 16:20:10 +02:00
|
|
|
fontconfig_dep = dependency('fontconfig', required: false, fallback: ['fontconfig', 'fontconfig_dep'])
|
2018-05-17 01:28:53 +02:00
|
|
|
graphite2_dep = dependency('graphite2', required: false)
|
|
|
|
icu_dep = dependency('icu-uc', required: false)
|
2018-05-17 16:20:10 +02:00
|
|
|
m_dep = cpp.find_library('m', required: false)
|
2018-05-17 01:28:53 +02:00
|
|
|
|
2018-05-17 16:20:10 +02:00
|
|
|
deps = []
|
2018-05-17 01:28:53 +02:00
|
|
|
|
|
|
|
conf = configuration_data()
|
|
|
|
incbase = include_directories('.')
|
|
|
|
cpp_args = ['-DHAVE_CONFIG_H']
|
|
|
|
|
|
|
|
warn_cflags = [
|
|
|
|
'-Wno-non-virtual-dtor',
|
|
|
|
]
|
|
|
|
|
|
|
|
cpp_args += cpp.get_supported_arguments(warn_cflags)
|
|
|
|
|
2018-05-17 16:20:10 +02:00
|
|
|
if m_dep.found()
|
|
|
|
deps += [m_dep]
|
|
|
|
endif
|
|
|
|
|
2018-05-17 01:28:53 +02:00
|
|
|
if glib_dep.found()
|
|
|
|
conf.set('HAVE_GLIB', 1)
|
|
|
|
deps += [glib_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if gobject_dep.found()
|
|
|
|
conf.set('HAVE_GOBJECT', 1)
|
|
|
|
deps += [gobject_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cairo_dep.found()
|
|
|
|
conf.set('HAVE_CAIRO', 1)
|
|
|
|
deps += [cairo_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cairo_ft_dep.found()
|
|
|
|
conf.set('HAVE_CAIRO_FT', 1)
|
|
|
|
deps += [cairo_ft_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if graphite2_dep.found()
|
|
|
|
conf.set('HAVE_GRAPHITE2', 1)
|
|
|
|
deps += [graphite2_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if icu_dep.found()
|
|
|
|
conf.set('HAVE_ICU', 1)
|
|
|
|
conf.set('HAVE_ICU_BUILTIN', 1)
|
|
|
|
deps += [icu_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if freetype_dep.found()
|
|
|
|
conf.set('HAVE_FREETYPE', 1)
|
|
|
|
deps += [freetype_dep]
|
2018-06-05 20:59:29 +02:00
|
|
|
check_freetype_funcs = [
|
|
|
|
['FT_Get_Var_Blend_Coordinates', {'deps': freetype_dep}],
|
|
|
|
['FT_Set_Var_Blend_Coordinates', {'deps': freetype_dep}],
|
|
|
|
['FT_Done_MM_Var', {'deps': freetype_dep}],
|
|
|
|
]
|
2018-05-17 01:28:53 +02:00
|
|
|
|
|
|
|
if freetype_dep.type_name() == 'internal'
|
|
|
|
foreach func: check_freetype_funcs
|
|
|
|
name = func[0]
|
|
|
|
conf.set('HAVE_@0@'.format(name.to_upper()), 1)
|
|
|
|
endforeach
|
|
|
|
else
|
|
|
|
check_funcs += check_freetype_funcs
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if fontconfig_dep.found()
|
|
|
|
conf.set('HAVE_FONTCONFIG', 1)
|
|
|
|
deps += [fontconfig_dep]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if host_machine.system() != 'windows'
|
|
|
|
thread_dep = dependency('threads', required: false)
|
|
|
|
|
|
|
|
if thread_dep.found()
|
|
|
|
conf.set('HAVE_PTHREAD', 1)
|
|
|
|
deps += [thread_dep]
|
|
|
|
else
|
|
|
|
check_headers += ['sched.h']
|
|
|
|
check_funcs += ['sched_yield', {'link_with': 'rt'}]
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-06-05 20:59:29 +02:00
|
|
|
conf.set('HAVE_OT', 1)
|
|
|
|
conf.set('HAVE_FALLBACK', 1)
|
2018-05-17 01:28:53 +02:00
|
|
|
conf.set_quoted('PACKAGE_NAME', 'HarfBuzz')
|
|
|
|
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
|
|
|
|
|
|
|
|
foreach check : check_headers
|
|
|
|
name = check[0]
|
|
|
|
|
|
|
|
if cpp.has_header(name)
|
|
|
|
conf.set('HAVE_@0@'.format(name.to_upper().underscorify()), 1)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach check : check_funcs
|
|
|
|
name = check[0]
|
2018-06-05 20:59:29 +02:00
|
|
|
opts = check.get(1, {})
|
2018-05-17 01:28:53 +02:00
|
|
|
link_withs = opts.get('link_with', [])
|
2018-06-05 20:59:29 +02:00
|
|
|
check_deps = opts.get('deps', [])
|
2018-05-17 01:28:53 +02:00
|
|
|
extra_deps = []
|
|
|
|
found = true
|
|
|
|
|
|
|
|
# First try without linking
|
|
|
|
|
2018-06-05 20:59:29 +02:00
|
|
|
found = cpp.has_function(name, dependencies: check_deps)
|
2018-05-17 01:28:53 +02:00
|
|
|
|
|
|
|
if not found and link_withs.length() > 0
|
|
|
|
found = true
|
|
|
|
|
|
|
|
foreach link_with : link_withs
|
|
|
|
dep = cpp.find_library(link_with, required: false)
|
|
|
|
if dep.found()
|
|
|
|
extra_deps += dep
|
|
|
|
else
|
|
|
|
found = false
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
if found
|
2018-06-05 20:59:29 +02:00
|
|
|
found = cpp.has_function(name, dependencies: check_deps + extra_deps)
|
2018-05-17 01:28:53 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-06-05 20:59:29 +02:00
|
|
|
message('func: @0@, found: @1@'.format(name, found))
|
|
|
|
|
2018-05-17 01:28:53 +02:00
|
|
|
if found
|
|
|
|
deps += extra_deps
|
|
|
|
conf.set('HAVE_@0@'.format(name.to_upper()), 1)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
if cpp.links(files('meson-cc-tests/intel-atomic-primitives-test.c'), name: 'Intel atomics')
|
|
|
|
conf.set('HAVE_INTEL_ATOMIC_PRIMITIVES', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cpp.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris atomic ops')
|
|
|
|
conf.set('HAVE_SOLARIS_ATOMIC_OPS', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
subdir('src')
|
|
|
|
subdir('util')
|
|
|
|
subdir('test')
|
|
|
|
|
|
|
|
configure_file(output: 'config.h', configuration: conf)
|