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'], |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 67 | ] |
| 68 | |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 69 | m_dep = cpp.find_library('m', required: false) |
| 70 | |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 71 | if not get_option('freetype').disabled() |
| 72 | freetype_dep = dependency('freetype2', required: false) |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 73 | |
| 74 | if not freetype_dep.found() and cpp.get_id() == 'msvc' |
Xavier Claessens | 33252ce | 2020-06-24 13:40:32 -0400 | [diff] [blame] | 75 | freetype_dep = cpp.find_library('freetype', required: false, |
| 76 | has_headers: ['ft2build.h'], ) |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 77 | endif |
| 78 | |
Xavier Claessens | c4bbe89 | 2020-06-24 13:40:55 -0400 | [diff] [blame] | 79 | if not freetype_dep.found() |
| 80 | freetype_dep = dependency('freetype2', fallback: ['freetype2', 'freetype_dep'], |
| 81 | default_options: ['harfbuzz=disabled']) |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 82 | endif |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 83 | else |
| 84 | freetype_dep = dependency('', required: false) |
| 85 | endif |
Chun-wei Fan | 733414b | 2020-03-13 16:15:21 +0800 | [diff] [blame] | 86 | |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 87 | glib_dep = dependency('glib-2.0', required: get_option('glib'), |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 88 | fallback: ['glib', 'libglib_dep']) |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 89 | gobject_dep = dependency('gobject-2.0', required: get_option('gobject'), |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 90 | fallback: ['glib', 'libgobject_dep']) |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 91 | fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'), |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 92 | fallback: ['fontconfig', 'fontconfig_dep']) |
Tim-Philipp Müller | 49ba211 | 2018-11-12 15:36:27 +0000 | [diff] [blame] | 93 | graphite2_dep = dependency('graphite2', required: get_option('graphite')) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 94 | |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 95 | if not get_option('icu').disabled() |
| 96 | icu_dep = dependency('icu-uc', required: false) |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 97 | |
| 98 | if not icu_dep.found() and get_option('icu').enabled() |
| 99 | icu_dep = dependency('icu-uc', required: cpp.get_id() != 'msvc') |
| 100 | endif |
| 101 | |
| 102 | if not icu_dep.found() and cpp.get_id() == 'msvc' |
| 103 | if cpp.has_header('unicode/uchar.h') and \ |
| 104 | cpp.has_header('unicode/unorm2.h') and \ |
| 105 | cpp.has_header('unicode/ustring.h') and \ |
| 106 | cpp.has_header('unicode/utf16.h') and \ |
| 107 | cpp.has_header('unicode/uversion.h') and \ |
| 108 | cpp.has_header('unicode/uscript.h') |
| 109 | if get_option('buildtype') == 'debug' |
| 110 | icu_dep = cpp.find_library('icuucd', required: get_option('icu')) |
| 111 | else |
| 112 | icu_dep = cpp.find_library('icuuc', required: get_option('icu')) |
| 113 | endif |
Chun-wei Fan | 5efce60 | 2020-03-13 16:40:20 +0800 | [diff] [blame] | 114 | else |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 115 | if get_option('icu').enabled() |
| 116 | error('ICU headers and libraries must be present to build ICU support') |
| 117 | endif |
Chun-wei Fan | 5efce60 | 2020-03-13 16:40:20 +0800 | [diff] [blame] | 118 | endif |
| 119 | endif |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 120 | else |
| 121 | icu_dep = dependency('', required: false) |
Chun-wei Fan | 5efce60 | 2020-03-13 16:40:20 +0800 | [diff] [blame] | 122 | endif |
| 123 | |
Ebrahim Byagowi | ebab4b8 | 2020-06-10 16:52:32 +0430 | [diff] [blame] | 124 | if not get_option('cairo').disabled() |
| 125 | cairo_dep = dependency('cairo', required: false) |
Chun-wei Fan | 9d0e6ae | 2020-03-13 16:56:55 +0800 | [diff] [blame] | 126 | |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 127 | if not cairo_dep.found() and cpp.get_id() == 'msvc' |
Xavier Claessens | 571365d | 2020-06-24 14:11:07 -0400 | [diff] [blame] | 128 | cairo_dep = cpp.find_library('cairo', required: false, |
| 129 | has_headers: ['cairo.h']) |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 130 | endif |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 131 | |
Xavier Claessens | 00c652a | 2020-06-24 14:11:32 -0400 | [diff] [blame^] | 132 | if not cairo_dep.found() |
| 133 | # Note that we don't have harfbuzz -> cairo -> freetype2 -> harfbuzz fallback |
| 134 | # dependency cycle here because we have configured freetype2 above with |
| 135 | # harfbuzz support disabled, so when cairo will lookup freetype2 dependency |
| 136 | # it will be forced to use that one. |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 137 | cairo_dep = dependency('cairo', fallback: ['cairo', 'libcairo_dep']) |
| 138 | endif |
| 139 | |
| 140 | # Ensure that cairo-ft is fetched from the same library as cairo itself |
| 141 | if cairo_dep.found() |
| 142 | if cairo_dep.type_name() == 'pkgconfig' |
| 143 | cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo')) |
| 144 | else |
Ebrahim Byagowi | f3f9205 | 2020-07-01 03:01:25 +0430 | [diff] [blame] | 145 | cairo_ft_dep = cairo_dep |
| 146 | # TODO: Apparently the following isn't reliable to detect whether a dependency provides |
| 147 | # something or not so let's assume it is always enabled as we control |
| 148 | # cairo subproject anyway for now. To fix and test run .ci/build-win32.sh and |
| 149 | # make sure hb-view.exe is not missing. |
| 150 | # |
| 151 | # if cpp.has_header('cairo-ft.h') and \ |
| 152 | # cpp.has_function('cairo_ft_font_face_create_for_ft_face', dependencies: cairo_dep) |
| 153 | # cairo_ft_dep = cairo_dep |
| 154 | # else |
| 155 | # cairo_ft_dep = dependency('', required: false) |
| 156 | # endif |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 157 | endif |
| 158 | else |
| 159 | cairo_ft_dep = dependency('', required: false) |
| 160 | endif |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 161 | else |
Ebrahim Byagowi | b8454c3 | 2020-06-11 18:32:13 +0430 | [diff] [blame] | 162 | cairo_dep = dependency('', required: false) |
Nirbheek Chauhan | f65def4 | 2018-10-12 19:41:49 +0530 | [diff] [blame] | 163 | cairo_ft_dep = dependency('', required: false) |
| 164 | endif |
| 165 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 166 | conf = configuration_data() |
Tim-Philipp Müller | 618584e | 2018-11-14 20:19:36 +0000 | [diff] [blame] | 167 | incconfig = include_directories('.') |
Tim-Philipp Müller | a3892be | 2020-03-14 01:08:15 +0000 | [diff] [blame] | 168 | |
| 169 | add_project_arguments('-DHAVE_CONFIG_H', language: ['c', 'cpp']) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 170 | |
| 171 | warn_cflags = [ |
| 172 | '-Wno-non-virtual-dtor', |
| 173 | ] |
| 174 | |
Tim-Philipp Müller | a3892be | 2020-03-14 01:08:15 +0000 | [diff] [blame] | 175 | cpp_args = cpp.get_supported_arguments(warn_cflags) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 176 | |
| 177 | if glib_dep.found() |
| 178 | conf.set('HAVE_GLIB', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 179 | endif |
| 180 | |
| 181 | if gobject_dep.found() |
| 182 | conf.set('HAVE_GOBJECT', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 183 | endif |
| 184 | |
| 185 | if cairo_dep.found() |
| 186 | conf.set('HAVE_CAIRO', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 187 | endif |
| 188 | |
| 189 | if cairo_ft_dep.found() |
| 190 | conf.set('HAVE_CAIRO_FT', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 191 | endif |
| 192 | |
| 193 | if graphite2_dep.found() |
| 194 | conf.set('HAVE_GRAPHITE2', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 195 | endif |
| 196 | |
| 197 | if icu_dep.found() |
| 198 | conf.set('HAVE_ICU', 1) |
Ebrahim Byagowi | c6b3f73 | 2020-04-19 00:54:24 +0430 | [diff] [blame] | 199 | endif |
| 200 | |
Ebrahim Byagowi | cc53fd1 | 2020-05-21 19:33:18 +0430 | [diff] [blame] | 201 | if get_option('icu_builtin') |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 202 | conf.set('HAVE_ICU_BUILTIN', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 203 | endif |
| 204 | |
Ebrahim Byagowi | cc53fd1 | 2020-05-21 19:33:18 +0430 | [diff] [blame] | 205 | if get_option('experimental_api') |
Ebrahim Byagowi | 750bb73 | 2020-04-21 01:13:13 +0430 | [diff] [blame] | 206 | conf.set('HB_EXPERIMENTAL_API', 1) |
| 207 | endif |
| 208 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 209 | if freetype_dep.found() |
| 210 | conf.set('HAVE_FREETYPE', 1) |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 211 | check_freetype_funcs = [ |
| 212 | ['FT_Get_Var_Blend_Coordinates', {'deps': freetype_dep}], |
| 213 | ['FT_Set_Var_Blend_Coordinates', {'deps': freetype_dep}], |
| 214 | ['FT_Done_MM_Var', {'deps': freetype_dep}], |
| 215 | ] |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 216 | |
| 217 | if freetype_dep.type_name() == 'internal' |
| 218 | foreach func: check_freetype_funcs |
| 219 | name = func[0] |
| 220 | conf.set('HAVE_@0@'.format(name.to_upper()), 1) |
| 221 | endforeach |
| 222 | else |
| 223 | check_funcs += check_freetype_funcs |
| 224 | endif |
| 225 | endif |
| 226 | |
| 227 | if fontconfig_dep.found() |
| 228 | conf.set('HAVE_FONTCONFIG', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 229 | endif |
| 230 | |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 231 | gdi_uniscribe_deps = [] |
Chun-wei Fan | 838346c | 2020-03-13 18:01:17 +0800 | [diff] [blame] | 232 | # GDI (uniscribe) (windows) |
| 233 | 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] | 234 | # TODO: make nicer once we have https://github.com/mesonbuild/meson/issues/3940 |
| 235 | if cpp.has_header('usp10.h') and cpp.has_header('windows.h') |
| 236 | foreach usplib : ['usp10', 'gdi32', 'rpcrt4'] |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 237 | gdi_uniscribe_deps += cpp.find_library(usplib, required: true) |
Tim-Philipp Müller | b7796a5 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 238 | endforeach |
| 239 | conf.set('HAVE_UNISCRIBE', 1) |
Chun-wei Fan | 838346c | 2020-03-13 18:01:17 +0800 | [diff] [blame] | 240 | conf.set('HAVE_GDI', 1) |
| 241 | elif get_option('gdi').enabled() |
| 242 | 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] | 243 | endif |
| 244 | endif |
| 245 | |
Chun-wei Fan | 7baa8e0 | 2020-03-13 16:21:25 +0800 | [diff] [blame] | 246 | # DirectWrite (windows) |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 247 | directwrite_dep = dependency('', required: false) |
Tim-Philipp Müller | 83ebbe4 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 248 | if host_machine.system() == 'windows' and not get_option('directwrite').disabled() |
Chun-wei Fan | 7baa8e0 | 2020-03-13 16:21:25 +0800 | [diff] [blame] | 249 | if cpp.has_header('dwrite_1.h') |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 250 | directwrite_dep = cpp.find_library('dwrite', required: true) |
Tim-Philipp Müller | 83ebbe4 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 251 | conf.set('HAVE_DIRECTWRITE', 1) |
| 252 | elif get_option('directwrite').enabled() |
| 253 | error('DirectWrite was enabled explicitly, but required header is missing.') |
| 254 | endif |
| 255 | endif |
| 256 | |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 257 | # CoreText (macOS) - FIXME: untested |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 258 | coretext_deps = [] |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 259 | if host_machine.system() == 'darwin' and not get_option('coretext').disabled() |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 260 | app_services_dep = dependency('appleframeworks', modules: ['ApplicationServices'], required: false) |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 261 | 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] | 262 | coretext_deps += [app_services_dep] |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 263 | conf.set('HAVE_CORETEXT', 1) |
| 264 | # On iOS CoreText and CoreGraphics are stand-alone frameworks |
| 265 | # Check for a different symbol to avoid getting cached result |
| 266 | else |
Ebrahim Byagowi | 62de2f7 | 2020-06-11 19:09:24 +0430 | [diff] [blame] | 267 | coretext_dep = dependency('appleframeworks', modules: ['CoreText'], required: false) |
| 268 | coregraphics_dep = dependency('appleframeworks', modules: ['CoreGraphics'], required: false) |
| 269 | corefoundation_dep = dependency('appleframeworks', modules: ['CoreFoundation'], required: false) |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 270 | 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] | 271 | coretext_deps += [coretext_dep, coregraphics_dep, corefoundation_dep] |
Tim-Philipp Müller | 4840c82 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 272 | conf.set('HAVE_CORETEXT', 1) |
| 273 | elif get_option('coretext').enabled() |
| 274 | error('CoreText was enabled explicitly, but required headers or frameworks are missing.') |
| 275 | endif |
| 276 | endif |
| 277 | endif |
| 278 | |
Tim-Philipp Müller | b7796a5 | 2018-11-12 16:56:56 +0000 | [diff] [blame] | 279 | # threads |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 280 | thread_dep = dependency('', required: false) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 281 | if host_machine.system() != 'windows' |
| 282 | thread_dep = dependency('threads', required: false) |
| 283 | |
| 284 | if thread_dep.found() |
| 285 | conf.set('HAVE_PTHREAD', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 286 | else |
| 287 | check_headers += ['sched.h'] |
| 288 | check_funcs += ['sched_yield', {'link_with': 'rt'}] |
| 289 | endif |
| 290 | endif |
| 291 | |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 292 | conf.set('HAVE_OT', 1) |
| 293 | conf.set('HAVE_FALLBACK', 1) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 294 | conf.set_quoted('PACKAGE_NAME', 'HarfBuzz') |
| 295 | conf.set_quoted('PACKAGE_VERSION', meson.project_version()) |
| 296 | |
| 297 | foreach check : check_headers |
| 298 | name = check[0] |
| 299 | |
| 300 | if cpp.has_header(name) |
| 301 | conf.set('HAVE_@0@'.format(name.to_upper().underscorify()), 1) |
| 302 | endif |
| 303 | endforeach |
| 304 | |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 305 | harfbuzz_extra_deps = [] |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 306 | foreach check : check_funcs |
| 307 | name = check[0] |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 308 | opts = check.get(1, {}) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 309 | link_withs = opts.get('link_with', []) |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 310 | check_deps = opts.get('deps', []) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 311 | extra_deps = [] |
| 312 | found = true |
| 313 | |
| 314 | # First try without linking |
| 315 | |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 316 | found = cpp.has_function(name, dependencies: check_deps) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 317 | |
| 318 | if not found and link_withs.length() > 0 |
| 319 | found = true |
| 320 | |
| 321 | foreach link_with : link_withs |
| 322 | dep = cpp.find_library(link_with, required: false) |
| 323 | if dep.found() |
Ebrahim Byagowi | e8808c1 | 2020-03-24 19:15:09 +0430 | [diff] [blame] | 324 | extra_deps += dep |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 325 | else |
Ebrahim Byagowi | e8808c1 | 2020-03-24 19:15:09 +0430 | [diff] [blame] | 326 | found = false |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 327 | endif |
| 328 | endforeach |
| 329 | |
| 330 | if found |
Mathieu Duponchelle | 04bcdb9 | 2018-06-05 20:59:29 +0200 | [diff] [blame] | 331 | found = cpp.has_function(name, dependencies: check_deps + extra_deps) |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 332 | endif |
| 333 | endif |
| 334 | |
| 335 | if found |
Christoph Reiter | 03bd6ea | 2020-06-03 23:52:10 +0200 | [diff] [blame] | 336 | harfbuzz_extra_deps += extra_deps |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 337 | conf.set('HAVE_@0@'.format(name.to_upper()), 1) |
| 338 | endif |
| 339 | endforeach |
| 340 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 341 | if cpp.links(files('meson-cc-tests/intel-atomic-primitives-test.c'), name: 'Intel atomics') |
| 342 | conf.set('HAVE_INTEL_ATOMIC_PRIMITIVES', 1) |
| 343 | endif |
| 344 | |
| 345 | if cpp.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris atomic ops') |
| 346 | conf.set('HAVE_SOLARIS_ATOMIC_OPS', 1) |
| 347 | endif |
| 348 | |
| 349 | subdir('src') |
| 350 | subdir('util') |
Tim-Philipp Müller | 6147df3 | 2018-11-14 10:12:40 +0000 | [diff] [blame] | 351 | |
| 352 | if not get_option('tests').disabled() |
| 353 | subdir('test') |
| 354 | endif |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 355 | |
Ebrahim Byagowi | 702847a | 2020-06-29 00:39:43 +0430 | [diff] [blame] | 356 | if not get_option('benchmark').disabled() and \ |
| 357 | ((host_machine.system() != 'windows' and \ |
| 358 | not meson.is_subproject() and \ |
| 359 | not meson.is_cross_build()) or get_option('benchmark').enabled()) |
Ebrahim Byagowi | 95b1081 | 2020-06-09 17:37:36 +0430 | [diff] [blame] | 360 | subdir('perf') |
| 361 | endif |
| 362 | |
Tim-Philipp Müller | 3dd7b21 | 2020-05-17 00:12:08 +0100 | [diff] [blame] | 363 | if not get_option('gtk_doc').disabled() |
| 364 | subdir('docs') |
| 365 | endif |
| 366 | |
Ebrahim Byagowi | a6bcc57 | 2020-06-20 14:19:12 +0430 | [diff] [blame] | 367 | if not meson.is_subproject() |
| 368 | meson.add_dist_script('write-tarball-revision.py') |
| 369 | endif |
Ebrahim Byagowi | 03bd3ef | 2020-06-19 10:32:46 +0430 | [diff] [blame] | 370 | |
Mathieu Duponchelle | 920efc0 | 2018-05-17 01:28:53 +0200 | [diff] [blame] | 371 | configure_file(output: 'config.h', configuration: conf) |
Ebrahim Byagowi | a9e8328 | 2020-05-21 16:28:24 +0430 | [diff] [blame] | 372 | |
| 373 | summary({'prefix': get_option('prefix'), |
| 374 | 'bindir': get_option('bindir'), |
| 375 | 'libdir': get_option('libdir'), |
| 376 | 'includedir': get_option('includedir'), |
| 377 | 'datadir': get_option('datadir'), |
| 378 | }, section: 'Directories') |
| 379 | summary({'Builtin': true, |
| 380 | 'Glib': conf.get('HAVE_GLIB', 0) == 1, |
| 381 | 'ICU': conf.get('HAVE_ICU', 0) == 1, |
| 382 | }, bool_yn: true, section: 'Unicode callbacks (you want at least one)') |
| 383 | summary({'FreeType': conf.get('HAVE_FREETYPE', 0) == 1, |
| 384 | }, bool_yn: true, section: 'Font callbacks (the more the merrier)') |
| 385 | summary({'Cairo': conf.get('HAVE_CAIRO', 0) == 1, |
| 386 | 'Fontconfig': conf.get('HAVE_FONTCONFIG', 0) == 1, |
| 387 | }, bool_yn: true, section: 'Tools used for command-line utilities') |
| 388 | summary({'Graphite2': conf.get('HAVE_GRAPHITE2', 0) == 1, |
Ebrahim Byagowi | 65462c4 | 2020-06-05 01:08:08 +0430 | [diff] [blame] | 389 | }, bool_yn: true, section: 'Additional shapers') |
Ebrahim Byagowi | a9e8328 | 2020-05-21 16:28:24 +0430 | [diff] [blame] | 390 | summary({'CoreText': conf.get('HAVE_CORETEXT', 0) == 1, |
| 391 | 'DirectWrite': conf.get('HAVE_DIRECTWRITE', 0) == 1, |
| 392 | 'GDI': conf.get('HAVE_GDI', 0) == 1, |
| 393 | 'Uniscribe': conf.get('HAVE_UNISCRIBE', 0) == 1, |
| 394 | }, bool_yn: true, section: 'Platform shapers (not normally needed)') |
| 395 | summary({'Documentation': conf.get('HAVE_GTK_DOC', 0) == 1, |
| 396 | 'GObject bindings': conf.get('HAVE_GOBJECT', 0) == 1, |
| 397 | 'Introspection': conf.get('HAVE_INTROSPECTION', 0) == 1, |
| 398 | }, bool_yn: true, section: 'Other features') |