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