freedreno: android: fix build failure on android due to python version
[mesa.git] / meson.build
1 # Copyright © 2017-2019 Intel Corporation
2
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
9
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
12
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE.
20
21 project(
22 'mesa',
23 ['c', 'cpp'],
24 version : run_command(
25 [find_program('python', 'python3'), 'bin/meson_get_version.py']
26 ).stdout(),
27 license : 'MIT',
28 meson_version : '>= 0.46',
29 default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c99', 'cpp_std=c++14']
30 )
31
32 cc = meson.get_compiler('c')
33 cpp = meson.get_compiler('cpp')
34
35 null_dep = dependency('', required : false)
36
37 # Arguments for the preprocessor, put these in a separate array from the C and
38 # C++ (cpp in meson terminology) arguments since they need to be added to the
39 # default arguments for both C and C++.
40 pre_args = [
41 '-D__STDC_CONSTANT_MACROS',
42 '-D__STDC_FORMAT_MACROS',
43 '-D__STDC_LIMIT_MACROS',
44 '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
45 '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/issues"',
46 ]
47
48 with_vulkan_icd_dir = get_option('vulkan-icd-dir')
49 with_tests = get_option('build-tests')
50 with_valgrind = get_option('valgrind')
51 with_libunwind = get_option('libunwind')
52 with_glx_read_only_text = get_option('glx-read-only-text')
53 with_glx_direct = get_option('glx-direct')
54 with_osmesa = get_option('osmesa')
55 with_swr_arches = get_option('swr-arches')
56 with_vulkan_overlay_layer = get_option('vulkan-overlay-layer')
57 with_tools = get_option('tools')
58 if with_tools.contains('all')
59 with_tools = [
60 'drm-shim',
61 'etnaviv',
62 'freedreno',
63 'glsl',
64 'intel',
65 'intel-ui',
66 'lima',
67 'nir',
68 'nouveau',
69 'xvmc',
70 ]
71 endif
72
73 with_intel_tools = with_tools.contains('intel') or with_tools.contains('intel-ui')
74 with_imgui = with_intel_tools or with_vulkan_overlay_layer
75
76 dri_drivers_path = get_option('dri-drivers-path')
77 if dri_drivers_path == ''
78 dri_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
79 endif
80 dri_search_path = get_option('dri-search-path')
81 if dri_search_path == ''
82 dri_search_path = dri_drivers_path
83 endif
84
85 with_gles1 = get_option('gles1')
86 with_gles2 = get_option('gles2')
87 if host_machine.system() == 'windows'
88 if with_gles1 == 'auto'
89 with_gles1 = 'false'
90 endif
91 if with_gles2 == 'auto'
92 with_gles2 = 'false'
93 endif
94 endif
95 with_opengl = get_option('opengl')
96
97 # Default shared glapi off for windows, on elsewhere.
98 _sg = get_option('shared-glapi')
99 if _sg == 'auto'
100 with_shared_glapi = host_machine.system() != 'windows'
101 else
102 with_shared_glapi = _sg == 'true'
103 endif
104
105 # shared-glapi is required if at least two OpenGL APIs are being built
106 if not with_shared_glapi
107 if ((with_gles1 == 'true' and with_gles2 == 'true') or
108 (with_gles1 == 'true' and with_opengl) or
109 (with_gles2 == 'true' and with_opengl))
110 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
111 endif
112 with_gles1 = 'false'
113 with_gles2 = 'false'
114 endif
115
116 # We require OpenGL for OpenGL ES
117 if not with_opengl
118 if (with_gles1 == 'true' or with_gles2 == 'true') and not with_opengl
119 error('building OpenGL ES without OpenGL is not supported.')
120 endif
121 with_gles1 = 'false'
122 with_gles2 = 'false'
123 endif
124
125 with_gles1 = with_gles1 != 'false'
126 with_gles2 = with_gles2 != 'false'
127 with_any_opengl = with_opengl or with_gles1 or with_gles2
128 # Only build shared_glapi if at least one OpenGL API is enabled
129 with_shared_glapi = with_shared_glapi and with_any_opengl
130
131 system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos'].contains(host_machine.system())
132
133 dri_drivers = get_option('dri-drivers')
134 if dri_drivers.contains('auto')
135 if system_has_kms_drm
136 # TODO: PPC, Sparc
137 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
138 dri_drivers = ['i915', 'i965', 'r100', 'r200', 'nouveau']
139 elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
140 dri_drivers = []
141 else
142 error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
143 host_machine.cpu_family()))
144 endif
145 elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
146 # only swrast would make sense here, but gallium swrast is a much better default
147 dri_drivers = []
148 else
149 error('Unknown OS @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
150 host_machine.system()))
151 endif
152 endif
153
154 with_dri_i915 = dri_drivers.contains('i915')
155 with_dri_i965 = dri_drivers.contains('i965')
156 with_dri_r100 = dri_drivers.contains('r100')
157 with_dri_r200 = dri_drivers.contains('r200')
158 with_dri_nouveau = dri_drivers.contains('nouveau')
159 with_dri_swrast = dri_drivers.contains('swrast')
160
161 with_dri = dri_drivers.length() != 0 and dri_drivers != ['']
162
163 gallium_drivers = get_option('gallium-drivers')
164 if gallium_drivers.contains('auto')
165 if system_has_kms_drm
166 # TODO: PPC, Sparc
167 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
168 gallium_drivers = [
169 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'svga', 'swrast',
170 'iris'
171 ]
172 elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
173 gallium_drivers = [
174 'kmsro', 'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau',
175 'tegra', 'virgl', 'lima', 'panfrost', 'swrast'
176 ]
177 else
178 error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
179 host_machine.cpu_family()))
180 endif
181 elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
182 gallium_drivers = ['swrast']
183 else
184 error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
185 host_machine.system()))
186 endif
187 endif
188 with_gallium_kmsro = gallium_drivers.contains('kmsro')
189 with_gallium_radeonsi = gallium_drivers.contains('radeonsi')
190 with_gallium_r300 = gallium_drivers.contains('r300')
191 with_gallium_r600 = gallium_drivers.contains('r600')
192 with_gallium_nouveau = gallium_drivers.contains('nouveau')
193 with_gallium_freedreno = gallium_drivers.contains('freedreno')
194 with_gallium_softpipe = gallium_drivers.contains('swrast')
195 with_gallium_vc4 = gallium_drivers.contains('vc4')
196 with_gallium_v3d = gallium_drivers.contains('v3d')
197 with_gallium_panfrost = gallium_drivers.contains('panfrost')
198 with_gallium_etnaviv = gallium_drivers.contains('etnaviv')
199 with_gallium_tegra = gallium_drivers.contains('tegra')
200 with_gallium_iris = gallium_drivers.contains('iris')
201 with_gallium_i915 = gallium_drivers.contains('i915')
202 with_gallium_svga = gallium_drivers.contains('svga')
203 with_gallium_virgl = gallium_drivers.contains('virgl')
204 with_gallium_swr = gallium_drivers.contains('swr')
205 with_gallium_lima = gallium_drivers.contains('lima')
206 with_gallium_zink = gallium_drivers.contains('zink')
207
208 if cc.get_id().startswith('intel') and meson.version().version_compare('< 0.49.1')
209 error('Meson does not have sufficient support of ICC before 0.49.1 to compile mesa')
210 endif
211
212 with_gallium = gallium_drivers.length() != 0 and gallium_drivers != ['']
213
214 if with_gallium and system_has_kms_drm
215 _glx = get_option('glx')
216 _egl = get_option('egl')
217 if _glx == 'dri' or _egl == 'true' or (_glx == 'disabled' and _egl != 'false')
218 with_dri = true
219 endif
220 endif
221
222 _vulkan_drivers = get_option('vulkan-drivers')
223 if _vulkan_drivers.contains('auto')
224 if system_has_kms_drm
225 if host_machine.cpu_family().startswith('x86')
226 _vulkan_drivers = ['amd', 'intel']
227 elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
228 _vulkan_drivers = []
229 else
230 error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
231 host_machine.cpu_family()))
232 endif
233 elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
234 # No vulkan driver supports windows or macOS currently
235 _vulkan_drivers = []
236 else
237 error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
238 host_machine.system()))
239 endif
240 endif
241
242 with_intel_vk = _vulkan_drivers.contains('intel')
243 with_amd_vk = _vulkan_drivers.contains('amd')
244 with_freedreno_vk = _vulkan_drivers.contains('freedreno')
245 with_any_vk = _vulkan_drivers.length() != 0 and _vulkan_drivers != ['']
246
247 if with_dri_swrast and (with_gallium_softpipe or with_gallium_swr)
248 error('Only one swrast provider can be built')
249 endif
250 if with_dri_i915 and with_gallium_i915
251 error('Only one i915 provider can be built')
252 endif
253 if with_gallium_kmsro and not (with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_freedreno or with_gallium_panfrost or with_gallium_lima)
254 error('kmsro driver requires one or more renderonly drivers (vc4, etnaviv, freedreno, panfrost, lima)')
255 endif
256 if with_gallium_tegra and not with_gallium_nouveau
257 error('tegra driver requires nouveau driver')
258 endif
259
260 if host_machine.system() == 'darwin'
261 with_dri_platform = 'apple'
262 pre_args += '-DBUILDING_MESA'
263 elif ['windows', 'cygwin'].contains(host_machine.system())
264 with_dri_platform = 'windows'
265 elif system_has_kms_drm
266 with_dri_platform = 'drm'
267 else
268 # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
269 # assert here that one of those cases has been met.
270 # FIXME: illumos ends up here as well
271 with_dri_platform = 'none'
272 endif
273
274 _platforms = get_option('platforms')
275 if _platforms.contains('auto')
276 if system_has_kms_drm
277 _platforms = ['x11', 'wayland', 'drm', 'surfaceless']
278 elif ['darwin', 'cygwin'].contains(host_machine.system())
279 _platforms = ['x11', 'surfaceless']
280 elif ['haiku'].contains(host_machine.system())
281 _platforms = ['haiku']
282 elif host_machine.system() == 'windows'
283 _platforms = ['windows']
284 else
285 error('Unknown OS @0@. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.'.format(
286 host_machine.system()))
287 endif
288 endif
289
290 with_platform_android = _platforms.contains('android')
291 with_platform_x11 = _platforms.contains('x11')
292 with_platform_wayland = _platforms.contains('wayland')
293 with_platform_drm = _platforms.contains('drm')
294 with_platform_haiku = _platforms.contains('haiku')
295 with_platform_surfaceless = _platforms.contains('surfaceless')
296 with_platform_windows = _platforms.contains('windows')
297
298 with_platforms = false
299 if _platforms.length() != 0 and _platforms != ['']
300 # sanity check that list contains no empty strings
301 if _platforms.contains('')
302 error('Invalid argument list given to -Dplatforms, please fix.')
303 endif
304 with_platforms = true
305 egl_native_platform = _platforms[0]
306 endif
307
308 _xlib_lease = get_option('xlib-lease')
309 if _xlib_lease == 'auto'
310 with_xlib_lease = with_platform_x11 and with_platform_drm
311 else
312 with_xlib_lease = _xlib_lease == 'true'
313 endif
314
315 with_glx = get_option('glx')
316 if with_glx == 'auto'
317 if with_dri
318 with_glx = 'dri'
319 elif with_platform_haiku
320 with_glx = 'disabled'
321 elif host_machine.system() == 'windows'
322 with_glx = 'disabled'
323 elif with_gallium
324 # Even when building just gallium drivers the user probably wants dri
325 with_glx = 'dri'
326 elif with_platform_x11 and with_any_opengl and not with_any_vk
327 # The automatic behavior should not be to turn on xlib based glx when
328 # building only vulkan drivers
329 with_glx = 'xlib'
330 else
331 with_glx = 'disabled'
332 endif
333 endif
334 if with_glx == 'dri'
335 if with_gallium
336 with_dri = true
337 endif
338 endif
339
340 if not (with_dri or with_gallium or with_glx != 'disabled')
341 with_gles1 = false
342 with_gles2 = false
343 with_opengl = false
344 with_any_opengl = false
345 with_shared_glapi = false
346 endif
347
348 _gbm = get_option('gbm')
349 if _gbm == 'auto'
350 with_gbm = system_has_kms_drm and with_dri
351 else
352 with_gbm = _gbm == 'true'
353 endif
354 if with_gbm and not system_has_kms_drm
355 error('GBM only supports DRM/KMS platforms')
356 endif
357
358 _egl = get_option('egl')
359 if _egl == 'auto'
360 with_egl = (
361 not ['darwin', 'windows'].contains(host_machine.system()) and
362 with_dri and with_shared_glapi and with_platforms
363 )
364 elif _egl == 'true'
365 if not with_dri
366 error('EGL requires dri')
367 elif not with_shared_glapi
368 error('EGL requires shared-glapi')
369 elif not with_platforms
370 error('No platforms specified, consider -Dplatforms=drm,x11,surfaceless at least')
371 elif not ['disabled', 'dri'].contains(with_glx)
372 error('EGL requires dri, but a GLX is being built without dri')
373 elif ['darwin', 'windows'].contains(host_machine.system())
374 error('EGL is not available on Windows or MacOS')
375 endif
376 with_egl = true
377 else
378 with_egl = false
379 endif
380
381 if with_egl and not (with_platform_drm or with_platform_surfaceless or with_platform_android)
382 if with_gallium_radeonsi
383 error('RadeonSI requires the drm, surfaceless or android platform when using EGL')
384 endif
385 if with_gallium_virgl
386 error('Virgl requires the drm, surfaceless or android platform when using EGL')
387 endif
388 endif
389
390 # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
391 if host_machine.system() != 'windows' and (not with_platform_android or get_option('platform-sdk-version') >= 29)
392 pre_args += '-DUSE_ELF_TLS'
393 endif
394
395 if with_glx != 'disabled'
396 if not (with_platform_x11 and with_any_opengl)
397 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
398 elif with_glx == 'gallium-xlib'
399 if not with_gallium
400 error('Gallium-xlib based GLX requires at least one gallium driver')
401 elif not with_gallium_softpipe
402 error('Gallium-xlib based GLX requires softpipe or llvmpipe.')
403 elif with_dri
404 error('gallium-xlib conflicts with any dri driver')
405 endif
406 elif with_glx == 'xlib'
407 if with_dri
408 error('xlib conflicts with any dri driver')
409 endif
410 elif with_glx == 'dri'
411 if not with_shared_glapi
412 error('dri based GLX requires shared-glapi')
413 endif
414 endif
415 endif
416
417 with_glvnd = get_option('glvnd')
418 if with_glvnd
419 if with_platform_windows
420 error('glvnd cannot be used on Windows')
421 elif with_glx == 'xlib' or with_glx == 'gallium-xlib'
422 error('Cannot build glvnd support for GLX that is not DRI based.')
423 elif with_glx == 'disabled' and not with_egl
424 error('glvnd requires DRI based GLX and/or EGL')
425 endif
426 if get_option('egl-lib-suffix') != ''
427 error('''EGL lib suffix can't be used with libglvnd''')
428 endif
429 endif
430
431 if with_vulkan_icd_dir == ''
432 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
433 endif
434
435 # GNU/Hurd includes egl_dri2, without drm.
436 with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or
437 host_machine.system() == 'gnu')
438 _dri3 = get_option('dri3')
439 if _dri3 == 'auto'
440 with_dri3 = system_has_kms_drm and with_dri2
441 else
442 with_dri3 = _dri3 == 'true'
443 endif
444
445 if with_any_vk and (with_platform_x11 and not with_dri3)
446 error('Vulkan drivers require dri3 for X11 support')
447 endif
448 if with_dri
449 if with_glx == 'disabled' and not with_egl and not with_gbm and with_osmesa != 'classic'
450 error('building dri drivers require at least one windowing system or classic osmesa')
451 endif
452 endif
453
454 prog_pkgconfig = find_program('pkg-config')
455
456 _vdpau = get_option('gallium-vdpau')
457 if not system_has_kms_drm
458 if _vdpau == 'true'
459 error('VDPAU state tracker can only be build on unix-like OSes.')
460 else
461 _vdpau = 'false'
462 endif
463 elif not with_platform_x11
464 if _vdpau == 'true'
465 error('VDPAU state tracker requires X11 support.')
466 else
467 _vdpau = 'false'
468 endif
469 elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or
470 with_gallium_nouveau)
471 if _vdpau == 'true'
472 error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau.')
473 else
474 _vdpau = 'false'
475 endif
476 endif
477 dep_vdpau = null_dep
478 with_gallium_vdpau = false
479 if _vdpau != 'false'
480 dep_vdpau = dependency('vdpau', version : '>= 1.1', required : _vdpau == 'true')
481 if dep_vdpau.found()
482 dep_vdpau = declare_dependency(
483 compile_args : run_command(prog_pkgconfig, ['vdpau', '--cflags']).stdout().split()
484 )
485 with_gallium_vdpau = true
486 endif
487 endif
488
489 if with_gallium_vdpau
490 pre_args += '-DHAVE_ST_VDPAU'
491 endif
492 vdpau_drivers_path = get_option('vdpau-libs-path')
493 if vdpau_drivers_path == ''
494 vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
495 endif
496
497 if with_gallium_zink
498 dep_vulkan = dependency('vulkan')
499 endif
500
501 _xvmc = get_option('gallium-xvmc')
502 if not system_has_kms_drm
503 if _xvmc == 'true'
504 error('XVMC state tracker can only be build on unix-like OSes.')
505 else
506 _xvmc = 'false'
507 endif
508 elif not with_platform_x11
509 if _xvmc == 'true'
510 error('XVMC state tracker requires X11 support.')
511 else
512 _xvmc = 'false'
513 endif
514 elif not (with_gallium_r600 or with_gallium_nouveau)
515 if _xvmc == 'true'
516 error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.')
517 else
518 _xvmc = 'false'
519 endif
520 endif
521 dep_xvmc = null_dep
522 dep_xv = null_dep
523 with_gallium_xvmc = false
524 if _xvmc != 'false'
525 dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'true')
526 dep_xv = dependency('xv', required : _xvmc == 'true')
527 with_gallium_xvmc = dep_xvmc.found() and dep_xv.found()
528 endif
529
530 xvmc_drivers_path = get_option('xvmc-libs-path')
531 if xvmc_drivers_path == ''
532 xvmc_drivers_path = get_option('libdir')
533 endif
534
535 _omx = get_option('gallium-omx')
536 if not system_has_kms_drm
537 if ['auto', 'disabled'].contains(_omx)
538 _omx = 'disabled'
539 else
540 error('OMX state tracker can only be built on unix-like OSes.')
541 endif
542 elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
543 if ['auto', 'disabled'].contains(_omx)
544 _omx = 'disabled'
545 else
546 error('OMX state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
547 endif
548 endif
549 with_gallium_omx = _omx
550 dep_omx = null_dep
551 dep_omx_other = []
552 if ['auto', 'bellagio'].contains(_omx)
553 dep_omx = dependency(
554 'libomxil-bellagio', required : _omx == 'bellagio'
555 )
556 if dep_omx.found()
557 with_gallium_omx = 'bellagio'
558 endif
559 endif
560 if ['auto', 'tizonia'].contains(_omx)
561 if with_dri and with_egl
562 dep_omx = dependency(
563 'libtizonia', version : '>= 0.10.0',
564 required : _omx == 'tizonia',
565 )
566 dep_omx_other = [
567 dependency('libtizplatform', required : _omx == 'tizonia'),
568 dependency('tizilheaders', required : _omx == 'tizonia'),
569 ]
570 if dep_omx.found() and dep_omx_other[0].found() and dep_omx_other[1].found()
571 with_gallium_omx = 'tizonia'
572 endif
573 elif _omx == 'tizonia'
574 error('OMX-Tizonia state tracker requires dri and egl')
575 endif
576 endif
577 if _omx == 'auto'
578 with_gallium_omx = 'disabled'
579 else
580 with_gallium_omx = _omx
581 endif
582
583 pre_args += [
584 '-DENABLE_ST_OMX_BELLAGIO=' + (with_gallium_omx == 'bellagio' ? '1' : '0'),
585 '-DENABLE_ST_OMX_TIZONIA=' + (with_gallium_omx == 'tizonia' ? '1' : '0'),
586 ]
587
588
589 omx_drivers_path = get_option('omx-libs-path')
590
591 if with_gallium_omx != 'disabled'
592 # Figure out where to put the omx driver.
593 # FIXME: this could all be vastly simplified by adding a 'defined_variable'
594 # argument to meson's get_pkgconfig_variable method.
595 if omx_drivers_path == ''
596 _omx_libdir = dep_omx.get_pkgconfig_variable('libdir')
597 _omx_drivers_dir = dep_omx.get_pkgconfig_variable('pluginsdir')
598 if _omx_libdir == get_option('libdir')
599 omx_drivers_path = _omx_drivers_dir
600 else
601 _omx_base_dir = []
602 # This will fail on windows. Does OMX run on windows?
603 _omx_libdir = _omx_libdir.split('/')
604 _omx_drivers_dir = _omx_drivers_dir.split('/')
605 foreach o : _omx_drivers_dir
606 if not _omx_libdir.contains(o)
607 _omx_base_dir += o
608 endif
609 endforeach
610 omx_drivers_path = join_paths(get_option('libdir'), _omx_base_dir)
611 endif
612 endif
613 endif
614
615 _va = get_option('gallium-va')
616 if not system_has_kms_drm
617 if _va == 'true'
618 error('VA state tracker can only be built on unix-like OSes.')
619 else
620 _va = 'false'
621 endif
622 elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
623 if _va == 'true'
624 error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
625 else
626 _va = 'false'
627 endif
628 endif
629 with_gallium_va = false
630 dep_va = null_dep
631 if _va != 'false'
632 dep_va = dependency('libva', version : '>= 0.38.0', required : _va == 'true')
633 if dep_va.found()
634 dep_va_headers = declare_dependency(
635 compile_args : run_command(prog_pkgconfig, ['libva', '--cflags']).stdout().split()
636 )
637 with_gallium_va = true
638 endif
639 endif
640
641 va_drivers_path = get_option('va-libs-path')
642 if va_drivers_path == ''
643 va_drivers_path = join_paths(get_option('libdir'), 'dri')
644 endif
645
646 _xa = get_option('gallium-xa')
647 if not system_has_kms_drm
648 if _xa == 'true'
649 error('XA state tracker can only be built on unix-like OSes.')
650 else
651 _xa = 'false'
652 endif
653 elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915
654 or with_gallium_svga)
655 if _xa == 'true'
656 error('XA state tracker requires at least one of the following gallium drivers: nouveau, freedreno, i915, svga.')
657 else
658 _xa = 'false'
659 endif
660 endif
661 with_gallium_xa = _xa != 'false'
662
663 d3d_drivers_path = get_option('d3d-drivers-path')
664 if d3d_drivers_path == ''
665 d3d_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'd3d')
666 endif
667
668 with_gallium_st_nine = get_option('gallium-nine')
669 if with_gallium_st_nine
670 if not with_gallium_softpipe
671 error('The nine state tracker requires gallium softpipe/llvmpipe.')
672 elif not (with_gallium_radeonsi or with_gallium_nouveau or with_gallium_r600
673 or with_gallium_r300 or with_gallium_svga or with_gallium_i915
674 or with_gallium_iris)
675 error('The nine state tracker requires at least one non-swrast gallium driver.')
676 endif
677 if not with_dri3
678 error('Using nine with wine requires dri3')
679 endif
680 endif
681
682 if get_option('power8') != 'false'
683 # on old versions of meson the cpu family would return as ppc64le on little
684 # endian power8, this was changed in 0.48 such that the family would always
685 # be ppc64 regardless of endianness, and then the machine.endian() value
686 # should be checked. Since we support versions < 0.48 we need to use
687 # startswith.
688 if host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
689 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8')
690 error('Altivec is not supported with gcc version < 4.8.')
691 endif
692 if cc.compiles('''
693 #include <altivec.h>
694 int main() {
695 vector unsigned char r;
696 vector unsigned int v = vec_splat_u32 (1);
697 r = __builtin_vec_vgbbd ((vector unsigned char) v);
698 return 0;
699 }''',
700 args : '-mpower8-vector',
701 name : 'POWER8 intrinsics')
702 pre_args += ['-D_ARCH_PWR8', '-mpower8-vector']
703 elif get_option('power8') == 'true'
704 error('POWER8 intrinsic support required but not found.')
705 endif
706 endif
707 endif
708
709 _opencl = get_option('gallium-opencl')
710 clover_cpp_std = []
711 if _opencl != 'disabled'
712 if not with_gallium
713 error('OpenCL Clover implementation requires at least one gallium driver.')
714 endif
715
716 dep_clc = dependency('libclc')
717 with_gallium_opencl = true
718 with_opencl_icd = _opencl == 'icd'
719
720 with_opencl_spirv = get_option('opencl-spirv')
721 if with_opencl_spirv
722 dep_spirv_tools = dependency('SPIRV-Tools', required : true, version : '>= 2018.0')
723 # LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
724 dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : true, version : '>= 0.2.1')
725 else
726 dep_spirv_tools = null_dep
727 dep_llvmspirvlib = null_dep
728 endif
729
730 if host_machine.cpu_family().startswith('ppc') and cpp.compiles('''
731 #if !defined(__VEC__) || !defined(__ALTIVEC__)
732 #error "AltiVec not enabled"
733 #endif''',
734 name : 'Altivec')
735 clover_cpp_std += ['cpp_std=gnu++11']
736 endif
737 else
738 dep_clc = null_dep
739 dep_spirv_tools = null_dep
740 dep_llvmspirvlib = null_dep
741 with_gallium_opencl = false
742 with_opencl_icd = false
743 with_opencl_spirv = false
744 endif
745
746 gl_pkgconfig_c_flags = []
747 if with_platform_x11
748 if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
749 pre_args += '-DHAVE_X11_PLATFORM'
750 endif
751 if with_glx == 'xlib' or with_glx == 'gallium-xlib'
752 pre_args += '-DUSE_XSHM'
753 else
754 pre_args += '-DGLX_INDIRECT_RENDERING'
755 if with_glx_direct
756 pre_args += '-DGLX_DIRECT_RENDERING'
757 endif
758 if with_dri_platform == 'drm'
759 pre_args += '-DGLX_USE_DRM'
760 elif with_dri_platform == 'apple'
761 pre_args += '-DGLX_USE_APPLEGL'
762 elif with_dri_platform == 'windows'
763 pre_args += '-DGLX_USE_WINDOWSGL'
764 endif
765 endif
766 else
767 pre_args += '-DEGL_NO_X11'
768 gl_pkgconfig_c_flags += '-DEGL_NO_X11'
769 endif
770 if with_platform_drm
771 if with_egl and not with_gbm
772 error('EGL drm platform requires gbm')
773 endif
774 pre_args += '-DHAVE_DRM_PLATFORM'
775 endif
776 if with_platform_surfaceless
777 pre_args += '-DHAVE_SURFACELESS_PLATFORM'
778 endif
779 if with_platform_android
780 dep_android = [
781 dependency('cutils'),
782 dependency('hardware'),
783 dependency('sync'),
784 ]
785 if get_option('platform-sdk-version') >= 26
786 dep_android += dependency('nativewindow')
787 endif
788 pre_args += '-DHAVE_ANDROID_PLATFORM'
789 endif
790 if with_platform_haiku
791 pre_args += '-DHAVE_HAIKU_PLATFORM'
792 endif
793
794 if meson.version().version_compare('>=0.50')
795 prog_python = import('python').find_installation('python3')
796 else
797 prog_python = import('python3').find_python()
798 endif
799 has_mako = run_command(
800 prog_python, '-c',
801 '''
802 from distutils.version import StrictVersion
803 import mako
804 assert StrictVersion(mako.__version__) > StrictVersion("0.8.0")
805 ''')
806 if has_mako.returncode() != 0
807 error('Python (3.x) mako module >= 0.8.0 required to build mesa.')
808 endif
809
810 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
811 error('When using GCC, version 4.4.6 or later is required.')
812 endif
813
814 # Support systems without ETIME (e.g. FreeBSD)
815 if cc.get_define('ETIME', prefix : '#include <errno.h>') == ''
816 pre_args += '-DETIME=ETIMEDOUT'
817 endif
818
819 # Define DEBUG for debug builds only (debugoptimized is not included on this one)
820 if get_option('buildtype') == 'debug'
821 pre_args += '-DDEBUG'
822 endif
823
824 with_shader_cache = false
825 _shader_cache = get_option('shader-cache')
826 if _shader_cache != 'false'
827 if host_machine.system() == 'windows'
828 if _shader_cache == 'true'
829 error('Shader Cache does not currently work on Windows')
830 endif
831 else
832 pre_args += '-DENABLE_SHADER_CACHE'
833 with_shader_cache = true
834 endif
835 endif
836 if with_amd_vk and not with_shader_cache
837 error('Radv requires shader cache support')
838 endif
839
840 # Check for GCC style builtins
841 foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
842 'ffsll', 'popcount', 'popcountll', 'unreachable']
843 if cc.has_function(b)
844 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
845 endif
846 endforeach
847
848 # check for GCC __attribute__
849 foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
850 'warn_unused_result', 'weak',]
851 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
852 name : '__attribute__((@0@))'.format(a))
853 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
854 endif
855 endforeach
856 if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
857 name : '__attribute__((format(...)))')
858 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
859 endif
860 if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
861 name : '__attribute__((packed))')
862 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
863 endif
864 if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
865 name : '__attribute__((returns_nonnull))')
866 pre_args += '-DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL'
867 endif
868 if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
869 int foo_hid(void) __attribute__((visibility("hidden")));
870 int foo_int(void) __attribute__((visibility("internal")));
871 int foo_pro(void) __attribute__((visibility("protected")));''',
872 name : '__attribute__((visibility(...)))')
873 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY'
874 endif
875 if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
876 name : '__attribute__((alias(...)))')
877 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
878 endif
879 if cc.compiles('int foo(void) __attribute__((__noreturn__));',
880 name : '__attribute__((__noreturn__))')
881 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NORETURN'
882 endif
883 if cc.compiles('__uint128_t foo(void) { return 0; }',
884 name : '__uint128_t')
885 pre_args += '-DHAVE_UINT128'
886 endif
887
888 # TODO: this is very incomplete
889 if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd'].contains(host_machine.system())
890 pre_args += '-D_GNU_SOURCE'
891 elif host_machine.system() == 'sunos'
892 pre_args += '-D__EXTENSIONS__'
893 elif host_machine.system() == 'windows'
894 pre_args += [
895 '-D_WINDOWS', '-D_WIN32_WINNT=0x0601', '-D_WINVER=0x0601',
896 '-DPIPE_SUBSYSTEM_WINDOWS_USER',
897 '-D_USE_MATH_DEFINES', # XXX: scons doesn't use this for mingw
898 ]
899 if cc.get_id() == 'msvc'
900 pre_args += [
901 '-DVC_EXTRALEAN',
902 '-D_CRT_SECURE_NO_WARNINGS',
903 '-D_CRT_SECURE_NO_DEPRECATE',
904 '-D_SCL_SECURE_NO_WARNINGS',
905 '-D_SCL_SECURE_NO_DEPRECATE',
906 '-D_ALLOW_KEYWORD_MACROS',
907 '-D_HAS_EXCEPTIONS=0', # Tell C++ STL to not use exceptions
908 ]
909 else
910 pre_args += ['-D__MSVCRT_VERSION__=0x0700']
911 endif
912 endif
913
914 # Check for generic C arguments
915 c_args = []
916 c_vis_args = []
917 c_msvc_compat_args = []
918 no_override_init_args = []
919 cpp_args = []
920 cpp_vis_args = []
921 cpp_msvc_compat_args = []
922 if cc.get_id() == 'msvc'
923 foreach a : ['/wd4018', # signed/unsigned mismatch
924 '/wd4056', # overflow in floating-point constant arithmetic
925 '/wd4244', # conversion from 'type1' to 'type2', possible loss of data
926 '/wd4267', # 'var' : conversion from 'size_t' to 'type', possible loss of data
927 '/wd4305', # trancation from 'type1' to 'type2'
928 '/wd4351', # new behavior: elements of array 'array' will be default initialized
929 '/wd4756', # overflow in constant arithmetic
930 '/wd4800', # forcing value to bool 'true' or 'false' (performance warning)
931 '/wd4996', # disabled deprecated POSIX name warnings
932 '/wd4291'] # no matching operator delete found
933 if cc.has_argument(a)
934 c_args += a
935 endif
936 if cpp.has_argument(a)
937 cpp_args += a
938 endif
939 endforeach
940 if cc.has_argument('-Wmicrosoft-enum-value') # Clang
941 c_args += '-Wno-microsoft-enum-value'
942 cpp_args += '-Wno-microsoft-enum-value'
943 endif
944 else
945 _trial = [
946 '-Werror=implicit-function-declaration',
947 '-Werror=missing-prototypes',
948 '-Werror=return-type',
949 '-Werror=empty-body',
950 '-Werror=incompatible-pointer-types',
951 '-Werror=int-conversion',
952 '-Wno-missing-field-initializers',
953 '-Wno-format-truncation',
954 '-fno-math-errno',
955 '-fno-trapping-math',
956 '-Qunused-arguments',
957 ]
958 # MinGW chokes on format specifiers and I can't get it all working
959 if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
960 _trial += ['-Werror=format', '-Wformat-security']
961 endif
962 foreach a : _trial
963 if cc.has_argument(a)
964 c_args += a
965 endif
966 endforeach
967
968 _trial = [
969 '-Werror=return-type',
970 '-Werror=empty-body',
971 '-Wno-non-virtual-dtor',
972 '-Wno-missing-field-initializers',
973 '-Wno-format-truncation',
974 '-fno-math-errno',
975 '-fno-trapping-math',
976 '-Qunused-arguments',
977 ]
978 # MinGW chokes on format specifiers and I can't get it all working
979 if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
980 _trial += ['-Werror=format', '-Wformat-security']
981 endif
982 foreach a : _trial
983 if cpp.has_argument(a)
984 cpp_args += a
985 endif
986 endforeach
987
988 foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
989 if cc.has_argument(a)
990 no_override_init_args += a
991 endif
992 endforeach
993
994 if cc.has_argument('-fvisibility=hidden')
995 c_vis_args += '-fvisibility=hidden'
996 endif
997
998 # Check for C and C++ arguments for MSVC compatibility. These are only used
999 # in parts of the mesa code base that need to compile with MSVC, mainly
1000 # common code
1001 foreach a : ['-Werror=pointer-arith', '-Werror=vla', '-Werror=gnu-empty-initializer']
1002 if cc.has_argument(a)
1003 c_msvc_compat_args += a
1004 endif
1005 if cpp.has_argument(a)
1006 cpp_msvc_compat_args += a
1007 endif
1008 endforeach
1009
1010 if cpp.has_argument('-fvisibility=hidden')
1011 cpp_vis_args += '-fvisibility=hidden'
1012 endif
1013
1014 endif
1015
1016 # set linker arguments
1017 if host_machine.system() == 'windows'
1018 if cc.get_id() == 'msvc'
1019 add_project_link_arguments(
1020 '/fixed:no',
1021 '/incremental:no',
1022 '/dynamicbase',
1023 '/nxcompat',
1024 language : ['c', 'cpp'],
1025 )
1026 else
1027 add_project_link_arguments(
1028 '-Wl,--nxcompat',
1029 '-Wl,--dynamicbase',
1030 '-static-libgcc',
1031 '-static-libstdc++',
1032 language : ['c', 'cpp'],
1033 )
1034 endif
1035 endif
1036
1037 if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
1038 pre_args += '-DUSE_SSE41'
1039 with_sse41 = true
1040 sse41_args = ['-msse4.1']
1041
1042 # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
1043 # that's not guaranteed
1044 if host_machine.cpu_family() == 'x86'
1045 sse41_args += '-mstackrealign'
1046 endif
1047 else
1048 with_sse41 = false
1049 sse41_args = []
1050 endif
1051
1052 # Check for GCC style atomics
1053 dep_atomic = null_dep
1054
1055 if cc.compiles('''#include <stdint.h>
1056 int main() {
1057 struct {
1058 uint64_t *v;
1059 } x;
1060 return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
1061 (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
1062
1063 }''',
1064 name : 'GCC atomic builtins')
1065 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
1066
1067 # Not all atomic calls can be turned into lock-free instructions, in which
1068 # GCC will make calls into the libatomic library. Check whether we need to
1069 # link with -latomic.
1070 #
1071 # This can happen for 64-bit atomic operations on 32-bit architectures such
1072 # as ARM.
1073 if not cc.links('''#include <stdint.h>
1074 int main() {
1075 struct {
1076 uint64_t *v;
1077 } x;
1078 return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
1079 (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
1080 }''',
1081 name : 'GCC atomic builtins required -latomic')
1082 dep_atomic = cc.find_library('atomic')
1083 endif
1084 endif
1085 if not cc.links('''#include <stdint.h>
1086 uint64_t v;
1087 int main() {
1088 return __sync_add_and_fetch(&v, (uint64_t)1);
1089 }''',
1090 dependencies : dep_atomic,
1091 name : 'GCC 64bit atomics')
1092 pre_args += '-DMISSING_64BIT_ATOMICS'
1093 endif
1094
1095 dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows)
1096
1097 # TODO: shared/static? Is this even worth doing?
1098
1099 with_asm_arch = ''
1100 if host_machine.cpu_family() == 'x86'
1101 if system_has_kms_drm or host_machine.system() == 'gnu'
1102 with_asm_arch = 'x86'
1103 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
1104 '-DUSE_SSE_ASM']
1105
1106 if with_glx_read_only_text
1107 pre_args += ['-DGLX_X86_READONLY_TEXT']
1108 endif
1109 endif
1110 elif host_machine.cpu_family() == 'x86_64'
1111 if system_has_kms_drm
1112 with_asm_arch = 'x86_64'
1113 pre_args += ['-DUSE_X86_64_ASM']
1114 endif
1115 elif host_machine.cpu_family() == 'arm'
1116 if system_has_kms_drm
1117 with_asm_arch = 'arm'
1118 pre_args += ['-DUSE_ARM_ASM']
1119 endif
1120 elif host_machine.cpu_family() == 'aarch64'
1121 if system_has_kms_drm
1122 with_asm_arch = 'aarch64'
1123 pre_args += ['-DUSE_AARCH64_ASM']
1124 endif
1125 elif host_machine.cpu_family() == 'sparc64'
1126 if system_has_kms_drm
1127 with_asm_arch = 'sparc'
1128 pre_args += ['-DUSE_SPARC_ASM']
1129 endif
1130 elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
1131 if system_has_kms_drm
1132 with_asm_arch = 'ppc64le'
1133 pre_args += ['-DUSE_PPC64LE_ASM']
1134 endif
1135 endif
1136
1137 # Check for standard headers and functions
1138 if (cc.has_header_symbol('sys/sysmacros.h', 'major') and
1139 cc.has_header_symbol('sys/sysmacros.h', 'minor') and
1140 cc.has_header_symbol('sys/sysmacros.h', 'makedev'))
1141 pre_args += '-DMAJOR_IN_SYSMACROS'
1142 endif
1143 if (cc.has_header_symbol('sys/mkdev.h', 'major') and
1144 cc.has_header_symbol('sys/mkdev.h', 'minor') and
1145 cc.has_header_symbol('sys/mkdev.h', 'makedev'))
1146 pre_args += '-DMAJOR_IN_MKDEV'
1147 endif
1148
1149 foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
1150 if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h))
1151 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
1152 endif
1153 endforeach
1154
1155 foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r', 'flock', 'strtok_r']
1156 if cc.has_function(f)
1157 pre_args += '-DHAVE_@0@'.format(f.to_upper())
1158 endif
1159 endforeach
1160
1161 if cc.has_header_symbol('errno.h', 'program_invocation_name',
1162 args : '-D_GNU_SOURCE')
1163 pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME'
1164 elif with_tools.contains('intel')
1165 error('Intel tools require the program_invocation_name variable')
1166 endif
1167
1168 # MinGW provides a __builtin_posix_memalign function, but not a posix_memalign.
1169 # This means that this check will succeed, but then compilation will later
1170 # fail. MSVC doesn't have this function at all, so only check for it on
1171 # non-windows platforms.
1172 if host_machine.system() != 'windows'
1173 if cc.has_function('posix_memalign')
1174 pre_args += '-DHAVE_POSIX_MEMALIGN'
1175 endif
1176 endif
1177
1178 if cc.has_member('struct dirent', 'd_type', prefix: '''#include <sys/types.h>
1179 #include <dirent.h>''')
1180 pre_args += '-DHAVE_DIRENT_D_TYPE'
1181 endif
1182
1183 # strtod locale support
1184 if cc.links('''
1185 #define _GNU_SOURCE
1186 #include <stdlib.h>
1187 #include <locale.h>
1188 #ifdef HAVE_XLOCALE_H
1189 #include <xlocale.h>
1190 #endif
1191 int main() {
1192 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
1193 const char *s = "1.0";
1194 char *end;
1195 double d = strtod_l(s, end, loc);
1196 float f = strtof_l(s, end, loc);
1197 freelocale(loc);
1198 return 0;
1199 }''',
1200 args : pre_args,
1201 name : 'strtod has locale support')
1202 pre_args += '-DHAVE_STRTOD_L'
1203 endif
1204
1205 # Check for some linker flags
1206 ld_args_bsymbolic = []
1207 if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
1208 ld_args_bsymbolic += '-Wl,-Bsymbolic'
1209 endif
1210 ld_args_gc_sections = []
1211 if cc.links('static char unused() { return 5; } int main() { return 0; }',
1212 args : '-Wl,--gc-sections', name : 'gc-sections')
1213 ld_args_gc_sections += '-Wl,--gc-sections'
1214 endif
1215 with_ld_version_script = false
1216 if cc.links('int main() { return 0; }',
1217 args : '-Wl,--version-script=@0@'.format(
1218 join_paths(meson.source_root(), 'build-support/conftest.map')),
1219 name : 'version-script')
1220 with_ld_version_script = true
1221 endif
1222 with_ld_dynamic_list = false
1223 if cc.links('int main() { return 0; }',
1224 args : '-Wl,--dynamic-list=@0@'.format(
1225 join_paths(meson.source_root(), 'build-support/conftest.dyn')),
1226 name : 'dynamic-list')
1227 with_ld_dynamic_list = true
1228 endif
1229
1230 ld_args_build_id = cc.get_supported_link_arguments('-Wl,--build-id=sha1')
1231
1232 # check for dl support
1233 dep_dl = null_dep
1234 if not cc.has_function('dlopen')
1235 dep_dl = cc.find_library('dl', required : host_machine.system() != 'windows')
1236 endif
1237 if cc.has_function('dladdr', dependencies : dep_dl)
1238 # This is really only required for megadrivers
1239 pre_args += '-DHAVE_DLADDR'
1240 endif
1241
1242 if cc.has_function('dl_iterate_phdr')
1243 pre_args += '-DHAVE_DL_ITERATE_PHDR'
1244 elif with_intel_vk
1245 error('Intel "Anvil" Vulkan driver requires the dl_iterate_phdr function')
1246 elif with_dri_i965 and with_shader_cache
1247 error('Intel i965 GL driver requires dl_iterate_phdr when built with shader caching.')
1248 endif
1249
1250 # Determine whether or not the rt library is needed for time functions
1251 if host_machine.system() == 'windows' or cc.has_function('clock_gettime')
1252 dep_clock = null_dep
1253 else
1254 dep_clock = cc.find_library('rt')
1255 endif
1256
1257 # TODO: some of these may be conditional
1258 dep_zlib = dependency('zlib', version : '>= 1.2.3', fallback : ['zlib', 'zlib_dep'])
1259 pre_args += '-DHAVE_ZLIB'
1260
1261 _zstd = get_option('zstd')
1262 if _zstd != 'false'
1263 dep_zstd = dependency('libzstd', required : _zstd == 'true')
1264 if dep_zstd.found()
1265 pre_args += '-DHAVE_ZSTD'
1266 endif
1267 else
1268 dep_zstd = null_dep
1269 endif
1270
1271 dep_thread = dependency('threads')
1272 if dep_thread.found() and host_machine.system() != 'windows'
1273 pre_args += '-DHAVE_PTHREAD'
1274 if cc.has_function(
1275 'pthread_setaffinity_np',
1276 dependencies : dep_thread,
1277 prefix : '#include <pthread.h>',
1278 args : '-D_GNU_SOURCE')
1279 pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
1280 endif
1281 if cc.has_function(
1282 'pthread_setaffinity_np',
1283 dependencies : dep_thread,
1284 prefix : '#include <pthread_np.h>')
1285 pre_args += '-DPTHREAD_SETAFFINITY_IN_NP_HEADER'
1286 endif
1287 endif
1288 if host_machine.system() != 'windows'
1289 dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'])
1290 else
1291 dep_expat = null_dep
1292 endif
1293 # this only exists on linux so either this is linux and it will be found, or
1294 # it's not linux and wont
1295 dep_m = cc.find_library('m', required : false)
1296
1297 # Check for libdrm. Various drivers have different libdrm version requirements,
1298 # but we always want to use the same version for all libdrm modules. That means
1299 # even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
1300 # bar are both on use 2.4.3 for both of them
1301 dep_libdrm_amdgpu = null_dep
1302 dep_libdrm_radeon = null_dep
1303 dep_libdrm_nouveau = null_dep
1304 dep_libdrm_intel = null_dep
1305
1306 _drm_amdgpu_ver = '2.4.100'
1307 _drm_radeon_ver = '2.4.71'
1308 _drm_nouveau_ver = '2.4.66'
1309 _drm_intel_ver = '2.4.75'
1310 _drm_ver = '2.4.81'
1311
1312 _libdrm_checks = [
1313 ['intel', with_dri_i915 or with_gallium_i915],
1314 ['amdgpu', with_amd_vk or with_gallium_radeonsi],
1315 ['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
1316 with_gallium_r300 or with_gallium_r600)],
1317 ['nouveau', (with_gallium_nouveau or with_dri_nouveau)],
1318 ]
1319
1320 # VC4 only needs core libdrm support of this version, not a libdrm_vc4
1321 # library.
1322 if with_gallium_vc4
1323 _drm_ver = '2.4.89'
1324 endif
1325
1326 # etnaviv only needs core libdrm
1327 if with_gallium_etnaviv
1328 _drm_ver = '2.4.89'
1329 endif
1330
1331 # Loop over the enables versions and get the highest libdrm requirement for all
1332 # active drivers.
1333 _drm_blame = ''
1334 foreach d : _libdrm_checks
1335 ver = get_variable('_drm_@0@_ver'.format(d[0]))
1336 if d[1] and ver.version_compare('>' + _drm_ver)
1337 _drm_ver = ver
1338 _drm_blame = d[0]
1339 endif
1340 endforeach
1341 if _drm_blame != ''
1342 message('libdrm @0@ needed because @1@ has the highest requirement'.format(_drm_ver, _drm_blame))
1343 endif
1344
1345 # Then get each libdrm module
1346 foreach d : _libdrm_checks
1347 if d[1]
1348 set_variable(
1349 'dep_libdrm_' + d[0],
1350 dependency('libdrm_' + d[0], version : '>=' + _drm_ver)
1351 )
1352 endif
1353 endforeach
1354
1355 with_gallium_drisw_kms = false
1356 dep_libdrm = dependency(
1357 'libdrm', version : '>=' + _drm_ver,
1358 # GNU/Hurd includes egl_dri2, without drm.
1359 required : (with_dri2 and host_machine.system() != 'gnu') or with_dri3
1360 )
1361 if dep_libdrm.found()
1362 pre_args += '-DHAVE_LIBDRM'
1363 if with_dri_platform == 'drm' and with_dri
1364 with_gallium_drisw_kms = true
1365 endif
1366 endif
1367
1368 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine']
1369 llvm_optional_modules = ['coroutines']
1370 if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
1371 llvm_modules += ['amdgpu', 'native', 'bitreader', 'ipo']
1372 if with_gallium_r600
1373 llvm_modules += 'asmparser'
1374 endif
1375 endif
1376 if with_gallium_opencl
1377 llvm_modules += [
1378 'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
1379 'lto', 'option', 'objcarcopts', 'profiledata',
1380 ]
1381 endif
1382
1383 if with_amd_vk or with_gallium_radeonsi
1384 _llvm_version = '>= 8.0.0'
1385 elif with_gallium_swr
1386 _llvm_version = '>= 6.0.0'
1387 else
1388 _llvm_version = '>= 3.9.0'
1389 endif
1390
1391 _shared_llvm = get_option('shared-llvm')
1392 _llvm = get_option('llvm')
1393
1394 # The cmake method will never find libllvm.so|dylib; this is fine for windows
1395 # because llvm doesn't support libllvm.dll
1396 _llvm_method = 'config-tool'
1397 if (meson.version().version_compare('>= 0.51.0') and
1398 host_machine.system() == 'windows')
1399 _llvm_method = 'cmake'
1400 endif
1401
1402 dep_llvm = null_dep
1403 with_llvm = false
1404 if _llvm != 'false'
1405 dep_llvm = dependency(
1406 'llvm',
1407 version : _llvm_version,
1408 modules : llvm_modules,
1409 optional_modules : llvm_optional_modules,
1410 required : (
1411 with_amd_vk or with_gallium_radeonsi or with_gallium_swr or
1412 with_gallium_opencl or _llvm == 'true'
1413 ),
1414 static : not _shared_llvm,
1415 method : _llvm_method,
1416 fallback : ['llvm', 'dep_llvm'],
1417 )
1418 with_llvm = dep_llvm.found()
1419 endif
1420 if with_llvm
1421 pre_args += '-DLLVM_AVAILABLE'
1422 pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
1423
1424 # LLVM can be built without rtti, turning off rtti changes the ABI of C++
1425 # programs, so we need to build all C++ code in mesa without rtti as well to
1426 # ensure that linking works.
1427 #
1428 # In meson 0.51.0 we can use cmake to find LLVM in addittion to meson's
1429 # builtin llvm-config based finder. A new generic variable getter method
1430 # has also been added, so we'll use that if we can, to cover the cmake case.
1431 if dep_llvm.type_name() == 'internal'
1432 _rtti = subproject('llvm').get_variable('has_rtti', true)
1433 elif meson.version().version_compare('>=0.51')
1434 # The CMake finder will return 'ON', the llvm-config will return 'YES'
1435 _rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
1436 else
1437 _rtti = dep_llvm.get_configtool_variable('has-rtti') == 'YES'
1438 endif
1439 if not _rtti
1440 if with_gallium_nouveau
1441 error('The Nouveau driver requires rtti. You either need to turn off nouveau or use an LLVM built with LLVM_ENABLE_RTTI.')
1442 elif with_gallium_opencl
1443 error('The Clover OpenCL state tracker requires rtti, you need to turn off clover or use an LLVM built with LLVM_ENABLE_RTTI.')
1444 endif
1445 if cc.get_id() == 'msvc'
1446 cpp_args += '/GR-'
1447 else
1448 cpp_args += '-fno-rtti'
1449 endif
1450 endif
1451 elif with_amd_vk or with_gallium_radeonsi or with_gallium_swr
1452 error('The following drivers require LLVM: Radv, RadeonSI, SWR. One of these is enabled, but LLVM is disabled.')
1453 elif with_gallium_opencl
1454 error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
1455 endif
1456
1457 if (with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or
1458 (with_gallium_r600 and with_llvm))
1459 dep_elf = dependency('libelf', required : false)
1460 if not dep_elf.found()
1461 dep_elf = cc.find_library('elf')
1462 endif
1463 else
1464 dep_elf = null_dep
1465 endif
1466
1467 dep_glvnd = null_dep
1468 if with_glvnd
1469 dep_glvnd = dependency('libglvnd', version : '>= 1.2.0')
1470 pre_args += '-DUSE_LIBGLVND=1'
1471 endif
1472
1473 if with_valgrind != 'false'
1474 dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
1475 if dep_valgrind.found()
1476 pre_args += '-DHAVE_VALGRIND'
1477 endif
1478 else
1479 dep_valgrind = null_dep
1480 endif
1481
1482 # pthread stubs. Lets not and say we didn't
1483
1484 if host_machine.system() == 'windows'
1485 # Prefer the winflexbison versions, they're much easier to install and have
1486 # better windows support.
1487
1488 prog_flex = find_program('win_flex', required : false)
1489 if prog_flex.found()
1490 # windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
1491 # _fileno functions)
1492 prog_flex = [prog_flex, '--wincompat']
1493 else
1494 prog_flex = [find_program('lex', 'flex', required : with_any_opengl)]
1495 endif
1496 # Force flex to use const keyword in prototypes, as relies on __cplusplus or
1497 # __STDC__ macro to determine whether it's safe to use const keyword, but
1498 # MSVC never defines __STDC__ unless we disable all MSVC extensions.
1499 prog_flex += '-DYY_USE_CONST='
1500
1501 prog_bison = find_program('win_bison', required : false)
1502 if not prog_bison.found()
1503 prog_bison = find_program('yacc', 'bison', required : with_any_opengl)
1504 endif
1505 else
1506 prog_bison = find_program('bison', required : with_any_opengl)
1507 prog_flex = find_program('flex', required : with_any_opengl)
1508 endif
1509
1510 dep_selinux = null_dep
1511 if get_option('selinux')
1512 dep_selinux = dependency('libselinux')
1513 pre_args += '-DMESA_SELINUX'
1514 endif
1515
1516 if with_libunwind != 'false'
1517 dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
1518 if dep_unwind.found()
1519 pre_args += '-DHAVE_LIBUNWIND'
1520 endif
1521 else
1522 dep_unwind = null_dep
1523 endif
1524
1525 if with_osmesa != 'none'
1526 if with_osmesa == 'gallium' and not with_gallium_softpipe
1527 error('OSMesa gallium requires gallium softpipe or llvmpipe.')
1528 endif
1529 if host_machine.system() == 'windows'
1530 osmesa_lib_name = 'osmesa'
1531 else
1532 osmesa_lib_name = 'OSMesa'
1533 endif
1534 osmesa_bits = get_option('osmesa-bits')
1535 if osmesa_bits != '8'
1536 if with_dri or with_glx != 'disabled'
1537 error('OSMesa bits must be 8 if building glx or dir based drivers')
1538 endif
1539 osmesa_lib_name = osmesa_lib_name + osmesa_bits
1540 pre_args += [
1541 '-DCHAN_BITS=@0@'.format(osmesa_bits), '-DDEFAULT_SOFTWARE_DEPTH_BITS=31'
1542 ]
1543 endif
1544 endif
1545
1546 # TODO: symbol mangling
1547
1548 if with_platform_wayland
1549 dep_wl_scanner = dependency('wayland-scanner', native: true)
1550 prog_wl_scanner = find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
1551 if dep_wl_scanner.version().version_compare('>= 1.15')
1552 wl_scanner_arg = 'private-code'
1553 else
1554 wl_scanner_arg = 'code'
1555 endif
1556 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
1557 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
1558 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
1559 if with_egl
1560 dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3')
1561 dep_wayland_egl_headers = declare_dependency(
1562 compile_args : run_command(prog_pkgconfig, ['wayland-egl-backend', '--cflags']).stdout().split())
1563 endif
1564 wayland_dmabuf_xml = join_paths(
1565 dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
1566 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
1567 )
1568 pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
1569 endif
1570
1571 dep_x11 = null_dep
1572 dep_xext = null_dep
1573 dep_xdamage = null_dep
1574 dep_xfixes = null_dep
1575 dep_x11_xcb = null_dep
1576 dep_xcb = null_dep
1577 dep_xcb_glx = null_dep
1578 dep_xcb_dri2 = null_dep
1579 dep_xcb_dri3 = null_dep
1580 dep_dri2proto = null_dep
1581 dep_glproto = null_dep
1582 dep_xxf86vm = null_dep
1583 dep_xcb_dri3 = null_dep
1584 dep_xcb_present = null_dep
1585 dep_xcb_sync = null_dep
1586 dep_xcb_xfixes = null_dep
1587 dep_xshmfence = null_dep
1588 dep_xcb_xrandr = null_dep
1589 dep_xlib_xrandr = null_dep
1590 if with_platform_x11
1591 if with_glx == 'xlib' or with_glx == 'gallium-xlib'
1592 dep_x11 = dependency('x11')
1593 dep_xext = dependency('xext')
1594 dep_xcb = dependency('xcb')
1595 elif with_glx == 'dri'
1596 dep_x11 = dependency('x11')
1597 dep_xext = dependency('xext')
1598 dep_xdamage = dependency('xdamage', version : '>= 1.1')
1599 dep_xfixes = dependency('xfixes')
1600 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
1601 endif
1602 if (with_any_vk or with_glx == 'dri' or with_egl or
1603 (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
1604 with_gallium_omx != 'disabled'))
1605 dep_xcb = dependency('xcb')
1606 dep_x11_xcb = dependency('x11-xcb')
1607 if with_dri_platform == 'drm' and not dep_libdrm.found()
1608 error('libdrm required for gallium video statetrackers when using x11')
1609 endif
1610 endif
1611 if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
1612 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
1613
1614 if with_dri3
1615 pre_args += '-DHAVE_DRI3'
1616 dep_xcb_dri3 = dependency('xcb-dri3')
1617 dep_xcb_present = dependency('xcb-present')
1618 # until xcb-dri3 has been around long enough to make a hard-dependency:
1619 if (dep_xcb_dri3.version().version_compare('>= 1.13') and
1620 dep_xcb_present.version().version_compare('>= 1.13'))
1621 pre_args += '-DHAVE_DRI3_MODIFIERS'
1622 endif
1623 dep_xcb_sync = dependency('xcb-sync')
1624 dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
1625 endif
1626 endif
1627 if with_glx == 'dri' or with_glx == 'gallium-xlib'
1628 dep_glproto = dependency('glproto', version : '>= 1.4.14')
1629 endif
1630 if with_glx == 'dri'
1631 if with_dri_platform == 'drm'
1632 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
1633 dep_xxf86vm = dependency('xxf86vm')
1634 endif
1635 endif
1636 if (with_egl or (
1637 with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
1638 with_gallium_omx != 'disabled'))
1639 dep_xcb_xfixes = dependency('xcb-xfixes')
1640 endif
1641 if with_xlib_lease
1642 dep_xcb_xrandr = dependency('xcb-randr')
1643 dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
1644 endif
1645 endif
1646
1647 if get_option('gallium-extra-hud')
1648 pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
1649 endif
1650
1651 _sensors = get_option('lmsensors')
1652 if _sensors != 'false'
1653 dep_lmsensors = cc.find_library('sensors', required : _sensors == 'true')
1654 if dep_lmsensors.found()
1655 pre_args += '-DHAVE_LIBSENSORS=1'
1656 endif
1657 else
1658 dep_lmsensors = null_dep
1659 endif
1660
1661 foreach a : pre_args
1662 add_project_arguments(a, language : ['c', 'cpp'])
1663 endforeach
1664 foreach a : c_args
1665 add_project_arguments(a, language : ['c'])
1666 endforeach
1667 foreach a : cpp_args
1668 add_project_arguments(a, language : ['cpp'])
1669 endforeach
1670
1671 gl_priv_reqs = []
1672
1673 if with_glx == 'xlib' or with_glx == 'gallium-xlib'
1674 gl_priv_reqs += ['x11', 'xext', 'xcb']
1675 elif with_glx == 'dri'
1676 gl_priv_reqs += [
1677 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
1678 'xcb-glx >= 1.8.1']
1679 if with_dri_platform == 'drm'
1680 gl_priv_reqs += 'xcb-dri2 >= 1.8'
1681 gl_priv_reqs += 'xxf86vm'
1682 endif
1683 endif
1684 if dep_libdrm.found()
1685 gl_priv_reqs += 'libdrm >= 2.4.75'
1686 endif
1687
1688 gl_priv_libs = []
1689 if dep_thread.found()
1690 gl_priv_libs += ['-lpthread', '-pthread']
1691 endif
1692 if dep_m.found()
1693 gl_priv_libs += '-lm'
1694 endif
1695 if dep_dl.found()
1696 gl_priv_libs += '-ldl'
1697 endif
1698
1699 pkg = import('pkgconfig')
1700
1701 if host_machine.system() == 'windows'
1702 prog_dumpbin = find_program('dumpbin', required : false)
1703 with_symbols_check = prog_dumpbin.found() and with_tests
1704 symbols_check_args = ['--dumpbin', prog_dumpbin.path()]
1705 else
1706 prog_nm = find_program('nm')
1707 with_symbols_check = with_tests
1708 symbols_check_args = ['--nm', prog_nm.path()]
1709 endif
1710
1711 # This quirk needs to be applied to sources with functions defined in assembly
1712 # as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391
1713 gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
1714
1715 subdir('include')
1716 subdir('bin')
1717 subdir('src')
1718
1719 # Meson 0.49 and earlier seems to have a bug that fails to evaluate the string-
1720 # formatting below unless the first argument is passed as a variable. This has
1721 # been fixed in Meson 0.50 and beyond, but we need to keep it like this for now
1722 # for backwards compatibility.
1723 _with_opengl_string = with_opengl ? 'yes' : 'no'
1724
1725 lines = ['',
1726 'prefix: ' + get_option('prefix'),
1727 'libdir: ' + get_option('libdir'),
1728 'includedir: ' + get_option('includedir'),
1729 '',
1730 'OpenGL: @0@ (ES1: @1@ ES2: @2@)'.format(_with_opengl_string,
1731 with_gles1 ? 'yes' : 'no',
1732 with_gles2 ? 'yes' : 'no'),
1733 ]
1734
1735 if with_osmesa != 'none'
1736 lines += ''
1737 suffix = ''
1738 if with_osmesa == 'gallium'
1739 suffix = '(Gallium)'
1740 endif
1741 lines += 'OSMesa: lib' + osmesa_lib_name + suffix
1742 else
1743 lines += 'OSMesa: no'
1744 endif
1745
1746 if with_dri
1747 lines += ''
1748 lines += 'DRI platform: ' + with_dri_platform
1749 if dri_drivers.length() != 0 and dri_drivers != ['']
1750 lines += 'DRI drivers: ' + ' '.join(dri_drivers)
1751 else
1752 lines += 'DRI drivers: no'
1753 endif
1754 lines += 'DRI driver dir: ' + dri_drivers_path
1755 endif
1756
1757 if with_glx != 'disabled'
1758 lines += ''
1759 if with_glx == 'dri'
1760 lines += 'GLX: DRI-based'
1761 elif with_glx == 'xlib'
1762 lines += 'GLX: Xlib-based'
1763 elif with_glx == 'gallium-xlib'
1764 lines += 'GLX: Xlib-based (Gallium)'
1765 else
1766 lines += 'GLX: ' + with_glx
1767 endif
1768 endif
1769
1770 lines += ''
1771 lines += 'EGL: ' + (with_egl ? 'yes' : 'no')
1772 if with_egl
1773 egl_drivers = []
1774 if with_dri
1775 egl_drivers += 'builtin:egl_dri2'
1776 endif
1777 if with_dri3
1778 egl_drivers += 'builtin:egl_dri3'
1779 endif
1780 lines += 'EGL drivers: ' + ' '.join(egl_drivers)
1781 endif
1782 lines += 'GBM: ' + (with_gbm ? 'yes' : 'no')
1783 if with_platforms
1784 lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms)
1785 endif
1786
1787 lines += ''
1788 if with_any_vk
1789 lines += 'Vulkan drivers: ' + ' '.join(_vulkan_drivers)
1790 lines += 'Vulkan ICD dir: ' + with_vulkan_icd_dir
1791 else
1792 lines += 'Vulkan drivers: no'
1793 endif
1794
1795 lines += ''
1796 if with_llvm
1797 lines += 'llvm: yes'
1798 lines += 'llvm-version: ' + dep_llvm.version()
1799 else
1800 lines += 'llvm: no'
1801 endif
1802
1803 lines += ''
1804 if with_gallium
1805 lines += 'Gallium drivers: ' + ' '.join(gallium_drivers)
1806 gallium_st = ['mesa']
1807 if with_gallium_xa
1808 gallium_st += 'xa'
1809 endif
1810 if with_gallium_xvmc
1811 gallium_st += 'xvmc'
1812 endif
1813 if with_gallium_xvmc
1814 gallium_st += 'xvmc'
1815 endif
1816 if with_gallium_vdpau
1817 gallium_st += 'vdpau'
1818 endif
1819 if with_gallium_omx != 'disabled'
1820 gallium_st += 'omx' + with_gallium_omx
1821 endif
1822 if with_gallium_va
1823 gallium_st += 'va'
1824 endif
1825 if with_gallium_st_nine
1826 gallium_st += 'nine'
1827 endif
1828 if with_gallium_opencl
1829 gallium_st += 'clover'
1830 endif
1831 lines += 'Gallium st: ' + ' '.join(gallium_st)
1832 else
1833 lines += 'Gallium: no'
1834 endif
1835
1836 lines += 'HUD lmsensors: ' + (dep_lmsensors.found() ? 'yes' : 'no')
1837
1838 lines += ''
1839 lines += 'Shared-glapi: ' + (with_shared_glapi ? 'yes' : 'no')
1840
1841
1842 indent = ' '
1843 summary = indent + ('\n' + indent).join(lines)
1844 message('Configuration summary:\n@0@\n'.format(summary))