Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 1 | project('harfbuzz', 'c', 'cpp', |
Ebrahim Byagowi | f756267 | 2020-05-21 17:01:04 +0430 | [diff] [blame] | 2 | meson_version: '>= 0.53.0', |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 3 | default_options: ['cpp_std=c++11'], |
Ebrahim Byagowi | e4203c1 | 2020-06-22 05:03:27 +0430 | [diff] [blame] | 4 | version: '2.6.8') |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 5 | |
Ebrahim Byagowi | 8c84fee | 2020-06-22 04:04:40 +0430 | [diff] [blame] | 6 | warning('Meson is not our main build system for building *nix packages yet we encourage packagers to test it and give us feedback about it.') |
Ebrahim Byagowi | 466dbaa | 2020-03-24 19:52:43 +0430 | [diff] [blame] | 7 | |
Tim-Philipp Müller | 535186f | 2018-12-03 20:51:06 +0100 | [diff] [blame] | 8 | hb_version_arr = meson.project_version().split('.') |
| 9 | hb_version_major = hb_version_arr[0].to_int() |
| 10 | hb_version_minor = hb_version_arr[1].to_int() |
| 11 | hb_version_micro = hb_version_arr[2].to_int() |
| 12 | |
| 13 | # libtool versioning |
| 14 | hb_version_int = hb_version_major*10000 + hb_version_minor*100 + hb_version_micro |
Ebrahim Byagowi | 53b0a18 | 2020-06-22 18:04:01 +0430 | [diff] [blame^] | 15 | hb_libtool_version_info = '@0@:0:@0@'.format(hb_version_int) |
Tim-Philipp Müller | 535186f | 2018-12-03 20:51:06 +0100 | [diff] [blame] | 16 | |
Mathieu Duponchelle | 484313f | 2018-06-05 02:15:43 +0200 | [diff] [blame] | 17 | pkgmod = import('pkgconfig') |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 18 | cpp = meson.get_compiler('cpp') |
| 19 | |
Tim-Philipp Müller | 4a47f1a | 2018-12-01 11:05:27 +0000 | [diff] [blame] | 20 | if cpp.get_id() == 'msvc' |
| 21 | # Ignore several spurious warnings for things HarfBuzz does very commonly. |
| 22 | # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it |
| 23 | # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once |
| 24 | # NOTE: Only add warnings here if you are sure they're spurious |
| 25 | msvc_args = [ |
| 26 | '/wd4018', # implicit signed/unsigned conversion |
| 27 | '/wd4146', # unary minus on unsigned (beware INT_MIN) |
| 28 | '/wd4244', # lossy type conversion (e.g. double -> int) |
| 29 | '/wd4305', # truncating type conversion (e.g. double -> float) |
| 30 | cpp.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8 |
| 31 | ] |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 32 | add_project_arguments(msvc_args, language: ['c', 'cpp']) |
Tim-Philipp Müller | 4a47f1a | 2018-12-01 11:05:27 +0000 | [diff] [blame] | 33 | # Disable SAFESEH with MSVC for libs that use external deps that are built with MinGW |
| 34 | # noseh_link_args = ['/SAFESEH:NO'] |
| 35 | endif |
| 36 | |
Ebrahim Byagowi | 22048d5 | 2020-06-05 04:09:07 +0430 | [diff] [blame] | 37 | add_project_link_arguments(cpp.get_supported_link_arguments([ |
| 38 | '-Bsymbolic-functions' |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 39 | ]), language: 'c') |
Ebrahim Byagowi | 22048d5 | 2020-06-05 04:09:07 +0430 | [diff] [blame] | 40 | |
Tim-Philipp Müller | bb8aaa3 | 2020-03-14 01:05:38 +0000 | [diff] [blame] | 41 | add_project_arguments(cpp.get_supported_arguments([ |
Ebrahim Byagowi | 365d2d3 | 2020-03-11 20:16:36 +0330 | [diff] [blame] | 42 | '-fno-rtti', |
| 43 | '-fno-exceptions', |
| 44 | '-fno-threadsafe-statics', |
| 45 | '-fvisibility-inlines-hidden', # maybe shouldn't be applied for mingw |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 46 | ]), language: 'cpp') |
Ebrahim Byagowi | 365d2d3 | 2020-03-11 20:16:36 +0330 | [diff] [blame] | 47 | |
| 48 | if host_machine.cpu_family() == 'arm' and cpp.alignment('struct { char c; }') != 1 |
| 49 | if cpp.has_argument('-mstructure-size-boundary=8') |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 50 | add_project_arguments('-mstructure-size-boundary=8', language: 'cpp') |
Ebrahim Byagowi | 365d2d3 | 2020-03-11 20:16:36 +0330 | [diff] [blame] | 51 | endif |
| 52 | endif |
| 53 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 54 | check_headers = [ |
| 55 | ['unistd.h'], |
| 56 | ['sys/mman.h'], |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 57 | ['stdbool.h'], |
| 58 | ] |
| 59 | |
| 60 | check_funcs = [ |
| 61 | ['atexit'], |
| 62 | ['mprotect'], |
| 63 | ['sysconf'], |
| 64 | ['getpagesize'], |
| 65 | ['mmap'], |
| 66 | ['isatty'], |
Ebrahim Byagowi | 1c3f80b | 2020-03-11 19:29:47 +0330 | [diff] [blame] | 67 | ['roundf'], |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 68 | ] |
| 69 | |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 70 | m_dep = cpp.find_library('m', required: false) |
| 71 | |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 72 | if not get_option('freetype').disabled() |
| 73 | freetype_dep = dependency('freetype2', required: false) |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 74 | |
| 75 | if not freetype_dep.found() and cpp.get_id() == 'msvc' |
| 76 | if cpp.has_header('ft2build.h') |
| 77 | freetype_dep = cpp.find_library('freetype', required: false) |
| 78 | endif |
| 79 | endif |
| 80 | |
| 81 | if not freetype_dep.found() and get_option('freetype').enabled() |
| 82 | freetype_dep = dependency('freetype2', fallback: ['freetype2', 'freetype_dep']) |
| 83 | endif |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 84 | else |
| 85 | freetype_dep = dependency('', required: false) |
| 86 | endif |
Chun-wei Fan | 733414b | 2020-03-13 16:15:21 +0800 | [diff] [blame] | 87 | |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 88 | glib_dep = dependency('glib-2.0', required: get_option('glib'), |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 89 | fallback: ['glib', 'libglib_dep']) |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 90 | gobject_dep = dependency('gobject-2.0', required: get_option('gobject'), |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 91 | fallback: ['glib', 'libgobject_dep']) |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 92 | fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'), |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 93 | fallback: ['fontconfig', 'fontconfig_dep']) |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 94 | graphite2_dep = dependency('graphite2', required: get_option('graphite')) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 95 | |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 96 | if not get_option('icu').disabled() |
| 97 | icu_dep = dependency('icu-uc', required: false) |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 98 | |
| 99 | if not icu_dep.found() and get_option('icu').enabled() |
| 100 | icu_dep = dependency('icu-uc', required: cpp.get_id() != 'msvc') |
| 101 | endif |
| 102 | |
| 103 | if not icu_dep.found() and cpp.get_id() == 'msvc' |
| 104 | if cpp.has_header('unicode/uchar.h') and \ |
| 105 | cpp.has_header('unicode/unorm2.h') and \ |
| 106 | cpp.has_header('unicode/ustring.h') and \ |
| 107 | cpp.has_header('unicode/utf16.h') and \ |
| 108 | cpp.has_header('unicode/uversion.h') and \ |
| 109 | cpp.has_header('unicode/uscript.h') |
| 110 | if get_option('buildtype') == 'debug' |
| 111 | icu_dep = cpp.find_library('icuucd', required: get_option('icu')) |
| 112 | else |
| 113 | icu_dep = cpp.find_library('icuuc', required: get_option('icu')) |
| 114 | endif |
Chun-wei Fan | 5efce60 | 2020-03-13 16:40:20 +0800 | [diff] [blame] | 115 | else |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 116 | if get_option('icu').enabled() |
| 117 | error('ICU headers and libraries must be present to build ICU support') |
| 118 | endif |
Chun-wei Fan | 5efce60 | 2020-03-13 16:40:20 +0800 | [diff] [blame] | 119 | endif |
| 120 | endif |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 121 | else |
| 122 | icu_dep = dependency('', required: false) |
Chun-wei Fan | 5efce60 | 2020-03-13 16:40:20 +0800 | [diff] [blame] | 123 | endif |
| 124 | |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 125 | if not get_option('cairo').disabled() |
| 126 | cairo_dep = dependency('cairo', required: false) |
Chun-wei Fan | 9d0e6ae | 2020-03-13 16:56:55 +0800 | [diff] [blame] | 127 | |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 128 | if not cairo_dep.found() and cpp.get_id() == 'msvc' |
| 129 | if cpp.has_header('cairo.h') |
| 130 | cairo_dep = cpp.find_library('cairo') |
Chun-wei Fan | 9d0e6ae | 2020-03-13 16:56:55 +0800 | [diff] [blame] | 131 | endif |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 132 | endif |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 133 | |
| 134 | if not cairo_dep.found() and get_option('cairo').enabled() |
| 135 | cairo_dep = dependency('cairo', fallback: ['cairo', 'libcairo_dep']) |
| 136 | endif |
| 137 | |
| 138 | # Ensure that cairo-ft is fetched from the same library as cairo itself |
| 139 | if cairo_dep.found() |
| 140 | if cairo_dep.type_name() == 'pkgconfig' |
| 141 | cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo')) |
| 142 | else |
| 143 | if cpp.has_header('cairo-ft.h') and \ |
| 144 | cpp.has_function('cairo_ft_font_face_create_for_ft_face', dependencies: cairo_dep) |
| 145 | cairo_ft_dep = cairo_dep |
| 146 | else |
| 147 | cairo_ft_dep = dependency('', required: false) |
| 148 | endif |
| 149 | endif |
| 150 | else |
| 151 | cairo_ft_dep = dependency('', required: false) |
| 152 | endif |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 153 | else |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 154 | cairo_dep = dependency('', required: false) |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 155 | cairo_ft_dep = dependency('', required: false) |
| 156 | endif |
| 157 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 158 | conf = configuration_data() |
Tim-Philipp Müller | 618584e | 2018-11-14 20:19:36 +0000 | [diff] [blame] | 159 | incconfig = include_directories('.') |
Tim-Philipp Müller | a3892be | 2020-03-14 01:08:15 +0000 | [diff] [blame] | 160 | |
| 161 | add_project_arguments('-DHAVE_CONFIG_H', language: ['c', 'cpp']) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 162 | |
| 163 | warn_cflags = [ |
| 164 | '-Wno-non-virtual-dtor', |
| 165 | ] |
| 166 | |
Tim-Philipp Müller | a3892be | 2020-03-14 01:08:15 +0000 | [diff] [blame] | 167 | cpp_args = cpp.get_supported_arguments(warn_cflags) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 168 | |
| 169 | if glib_dep.found() |
| 170 | conf.set('HAVE_GLIB', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 171 | endif |
| 172 | |
| 173 | if gobject_dep.found() |
| 174 | conf.set('HAVE_GOBJECT', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 175 | endif |
| 176 | |
| 177 | if cairo_dep.found() |
| 178 | conf.set('HAVE_CAIRO', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 179 | endif |
| 180 | |
| 181 | if cairo_ft_dep.found() |
| 182 | conf.set('HAVE_CAIRO_FT', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 183 | endif |
| 184 | |
| 185 | if graphite2_dep.found() |
| 186 | conf.set('HAVE_GRAPHITE2', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 187 | endif |
| 188 | |
| 189 | if icu_dep.found() |
| 190 | conf.set('HAVE_ICU', 1) |
Ebrahim Byagowi | c6b3f73 | 2020-04-19 00:54:24 +0430 | [diff] [blame] | 191 | endif |
| 192 | |
Ebrahim Byagowi | cc53fd1 | 2020-05-21 19:33:18 +0430 | [diff] [blame] | 193 | if get_option('icu_builtin') |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 194 | conf.set('HAVE_ICU_BUILTIN', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 195 | endif |
| 196 | |
Ebrahim Byagowi | cc53fd1 | 2020-05-21 19:33:18 +0430 | [diff] [blame] | 197 | if get_option('experimental_api') |
Ebrahim Byagowi | 750bb73 | 2020-04-21 01:13:13 +0430 | [diff] [blame] | 198 | conf.set('HB_EXPERIMENTAL_API', 1) |
| 199 | endif |
| 200 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 201 | if freetype_dep.found() |
| 202 | conf.set('HAVE_FREETYPE', 1) |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 203 | check_freetype_funcs = [ |
| 204 | ['FT_Get_Var_Blend_Coordinates', {'deps': freetype_dep}], |
| 205 | ['FT_Set_Var_Blend_Coordinates', {'deps': freetype_dep}], |
| 206 | ['FT_Done_MM_Var', {'deps': freetype_dep}], |
| 207 | ] |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 208 | |
| 209 | if freetype_dep.type_name() == 'internal' |
| 210 | foreach func: check_freetype_funcs |
| 211 | name = func[0] |
| 212 | conf.set('HAVE_@0@'.format(name.to_upper()), 1) |
| 213 | endforeach |
| 214 | else |
| 215 | check_funcs += check_freetype_funcs |
| 216 | endif |
| 217 | endif |
| 218 | |
| 219 | if fontconfig_dep.found() |
| 220 | conf.set('HAVE_FONTCONFIG', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 221 | endif |
| 222 | |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 223 | gdi_uniscribe_deps = [] |
Chun-wei Fan | 838346c | 2020-03-13 18:01:17 +0800 | [diff] [blame] | 224 | # GDI (uniscribe) (windows) |
| 225 | if host_machine.system() == 'windows' and not get_option('gdi').disabled() |
Tim-Philipp Müller | b7796a5 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 226 | # TODO: make nicer once we have https://github.com/mesonbuild/meson/issues/3940 |
| 227 | if cpp.has_header('usp10.h') and cpp.has_header('windows.h') |
| 228 | foreach usplib : ['usp10', 'gdi32', 'rpcrt4'] |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 229 | gdi_uniscribe_deps += cpp.find_library(usplib, required: true) |
Tim-Philipp Müller | b7796a5 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 230 | endforeach |
| 231 | conf.set('HAVE_UNISCRIBE', 1) |
Chun-wei Fan | 838346c | 2020-03-13 18:01:17 +0800 | [diff] [blame] | 232 | conf.set('HAVE_GDI', 1) |
| 233 | elif get_option('gdi').enabled() |
| 234 | error('gdi was enabled explicitly, but some required headers are missing.') |
Tim-Philipp Müller | b7796a5 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 235 | endif |
| 236 | endif |
| 237 | |
Chun-wei Fan | 7baa8e0 | 2020-03-13 16:21:25 +0800 | [diff] [blame] | 238 | # DirectWrite (windows) |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 239 | directwrite_dep = dependency('', required: false) |
Tim-Philipp Müller | 83ebbe4 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 240 | if host_machine.system() == 'windows' and not get_option('directwrite').disabled() |
Chun-wei Fan | 7baa8e0 | 2020-03-13 16:21:25 +0800 | [diff] [blame] | 241 | if cpp.has_header('dwrite_1.h') |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 242 | directwrite_dep = cpp.find_library('dwrite', required: true) |
Tim-Philipp Müller | 83ebbe4 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 243 | conf.set('HAVE_DIRECTWRITE', 1) |
| 244 | elif get_option('directwrite').enabled() |
| 245 | error('DirectWrite was enabled explicitly, but required header is missing.') |
| 246 | endif |
| 247 | endif |
| 248 | |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 249 | # CoreText (macOS) - FIXME: untested |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 250 | coretext_deps = [] |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 251 | if host_machine.system() == 'darwin' and not get_option('coretext').disabled() |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 252 | app_services_dep = dependency('appleframeworks', modules: ['ApplicationServices'], required: false) |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 253 | if cpp.has_type('CTFontRef', prefix: '#include <ApplicationServices/ApplicationServices.h>', dependencies: app_services_dep) |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 254 | coretext_deps += [app_services_dep] |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 255 | conf.set('HAVE_CORETEXT', 1) |
| 256 | # On iOS CoreText and CoreGraphics are stand-alone frameworks |
| 257 | # Check for a different symbol to avoid getting cached result |
| 258 | else |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 259 | coretext_dep = dependency('appleframeworks', modules: ['CoreText'], required: false) |
| 260 | coregraphics_dep = dependency('appleframeworks', modules: ['CoreGraphics'], required: false) |
| 261 | corefoundation_dep = dependency('appleframeworks', modules: ['CoreFoundation'], required: false) |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 262 | if cpp.has_type('CTRunRef', prefix: '#include <CoreText/CoreText.h>', dependencies: [coretext_dep, coregraphics_dep, corefoundation_dep]) |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 263 | coretext_deps += [coretext_dep, coregraphics_dep, corefoundation_dep] |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 264 | conf.set('HAVE_CORETEXT', 1) |
| 265 | elif get_option('coretext').enabled() |
| 266 | error('CoreText was enabled explicitly, but required headers or frameworks are missing.') |
| 267 | endif |
| 268 | endif |
| 269 | endif |
| 270 | |
Tim-Philipp Müller | b7796a5 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 271 | # threads |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 272 | thread_dep = dependency('', required: false) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 273 | if host_machine.system() != 'windows' |
| 274 | thread_dep = dependency('threads', required: false) |
| 275 | |
| 276 | if thread_dep.found() |
| 277 | conf.set('HAVE_PTHREAD', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 278 | else |
| 279 | check_headers += ['sched.h'] |
| 280 | check_funcs += ['sched_yield', {'link_with': 'rt'}] |
| 281 | endif |
| 282 | endif |
| 283 | |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 284 | conf.set('HAVE_OT', 1) |
| 285 | conf.set('HAVE_FALLBACK', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 286 | conf.set_quoted('PACKAGE_NAME', 'HarfBuzz') |
| 287 | conf.set_quoted('PACKAGE_VERSION', meson.project_version()) |
| 288 | |
| 289 | foreach check : check_headers |
| 290 | name = check[0] |
| 291 | |
| 292 | if cpp.has_header(name) |
| 293 | conf.set('HAVE_@0@'.format(name.to_upper().underscorify()), 1) |
| 294 | endif |
| 295 | endforeach |
| 296 | |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 297 | harfbuzz_extra_deps = [] |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 298 | foreach check : check_funcs |
| 299 | name = check[0] |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 300 | opts = check.get(1, {}) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 301 | link_withs = opts.get('link_with', []) |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 302 | check_deps = opts.get('deps', []) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 303 | extra_deps = [] |
| 304 | found = true |
| 305 | |
| 306 | # First try without linking |
| 307 | |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 308 | found = cpp.has_function(name, dependencies: check_deps) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 309 | |
| 310 | if not found and link_withs.length() > 0 |
| 311 | found = true |
| 312 | |
| 313 | foreach link_with : link_withs |
| 314 | dep = cpp.find_library(link_with, required: false) |
| 315 | if dep.found() |
Ebrahim Byagowi | e8808c1 | 2020-03-24 19:15:09 +0430 | [diff] [blame] | 316 | extra_deps += dep |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 317 | else |
Ebrahim Byagowi | e8808c1 | 2020-03-24 19:15:09 +0430 | [diff] [blame] | 318 | found = false |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 319 | endif |
| 320 | endforeach |
| 321 | |
| 322 | if found |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 323 | found = cpp.has_function(name, dependencies: check_deps + extra_deps) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 324 | endif |
| 325 | endif |
| 326 | |
| 327 | if found |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 328 | harfbuzz_extra_deps += extra_deps |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 329 | conf.set('HAVE_@0@'.format(name.to_upper()), 1) |
| 330 | endif |
| 331 | endforeach |
| 332 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 333 | if cpp.links(files('meson-cc-tests/intel-atomic-primitives-test.c'), name: 'Intel atomics') |
| 334 | conf.set('HAVE_INTEL_ATOMIC_PRIMITIVES', 1) |
| 335 | endif |
| 336 | |
| 337 | if cpp.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris atomic ops') |
| 338 | conf.set('HAVE_SOLARIS_ATOMIC_OPS', 1) |
| 339 | endif |
| 340 | |
| 341 | subdir('src') |
| 342 | subdir('util') |
Tim-Philipp Müller | 6147df3 | 2018-11-14 10:12:40 +0000 | [diff] [blame] | 343 | |
| 344 | if not get_option('tests').disabled() |
| 345 | subdir('test') |
| 346 | endif |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 347 | |
Tim-Philipp Müller | 3dd7b21 | 2020-05-17 00:12:08 +0100 | [diff] [blame] | 348 | if not get_option('gtk_doc').disabled() |
| 349 | subdir('docs') |
| 350 | endif |
| 351 | |
Ebrahim Byagowi | a6bcc57 | 2020-06-20 14:19:12 +0430 | [diff] [blame] | 352 | if not meson.is_subproject() |
| 353 | meson.add_dist_script('write-tarball-revision.py') |
| 354 | endif |
Ebrahim Byagowi | 03bd3ef | 2020-06-19 10:32:46 +0430 | [diff] [blame] | 355 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 356 | configure_file(output: 'config.h', configuration: conf) |
Ebrahim Byagowi | a9e8328 | 2020-05-21 16:28:24 +0430 | [diff] [blame] | 357 | |
| 358 | summary({'prefix': get_option('prefix'), |
| 359 | 'bindir': get_option('bindir'), |
| 360 | 'libdir': get_option('libdir'), |
| 361 | 'includedir': get_option('includedir'), |
| 362 | 'datadir': get_option('datadir'), |
| 363 | }, section: 'Directories') |
| 364 | summary({'Builtin': true, |
| 365 | 'Glib': conf.get('HAVE_GLIB', 0) == 1, |
| 366 | 'ICU': conf.get('HAVE_ICU', 0) == 1, |
| 367 | }, bool_yn: true, section: 'Unicode callbacks (you want at least one)') |
| 368 | summary({'FreeType': conf.get('HAVE_FREETYPE', 0) == 1, |
| 369 | }, bool_yn: true, section: 'Font callbacks (the more the merrier)') |
| 370 | summary({'Cairo': conf.get('HAVE_CAIRO', 0) == 1, |
| 371 | 'Fontconfig': conf.get('HAVE_FONTCONFIG', 0) == 1, |
| 372 | }, bool_yn: true, section: 'Tools used for command-line utilities') |
| 373 | summary({'Graphite2': conf.get('HAVE_GRAPHITE2', 0) == 1, |
Ebrahim Byagowi | 65462c4 | 2020-06-05 01:08:08 +0430 | [diff] [blame] | 374 | }, bool_yn: true, section: 'Additional shapers') |
Ebrahim Byagowi | a9e8328 | 2020-05-21 16:28:24 +0430 | [diff] [blame] | 375 | summary({'CoreText': conf.get('HAVE_CORETEXT', 0) == 1, |
| 376 | 'DirectWrite': conf.get('HAVE_DIRECTWRITE', 0) == 1, |
| 377 | 'GDI': conf.get('HAVE_GDI', 0) == 1, |
| 378 | 'Uniscribe': conf.get('HAVE_UNISCRIBE', 0) == 1, |
| 379 | }, bool_yn: true, section: 'Platform shapers (not normally needed)') |
| 380 | summary({'Documentation': conf.get('HAVE_GTK_DOC', 0) == 1, |
| 381 | 'GObject bindings': conf.get('HAVE_GOBJECT', 0) == 1, |
| 382 | 'Introspection': conf.get('HAVE_INTROSPECTION', 0) == 1, |
| 383 | }, bool_yn: true, section: 'Other features') |