vulkan/overlay: Add support for a control socket.
[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 '-Wno-missing-field-initializers',
955 '-Wno-format-truncation',
956 '-fno-math-errno',
957 '-fno-trapping-math',
958 '-Qunused-arguments',
959 ]
960 # MinGW chokes on format specifiers and I can't get it all working
961 if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
962 _trial += ['-Werror=format', '-Wformat-security']
963 endif
964 foreach a : _trial
965 if cc.has_argument(a)
966 c_args += a
967 endif
968 endforeach
969
970 _trial = [
971 '-Werror=return-type',
972 '-Werror=empty-body',
973 '-Wno-non-virtual-dtor',
974 '-Wno-missing-field-initializers',
975 '-Wno-format-truncation',
976 '-fno-math-errno',
977 '-fno-trapping-math',
978 '-Qunused-arguments',
979 ]
980 # MinGW chokes on format specifiers and I can't get it all working
981 if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
982 _trial += ['-Werror=format', '-Wformat-security']
983 endif
984 foreach a : _trial
985 if cpp.has_argument(a)
986 cpp_args += a
987 endif
988 endforeach
989
990 foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
991 if cc.has_argument(a)
992 no_override_init_args += a
993 endif
994 endforeach
995
996 if cc.has_argument('-fvisibility=hidden')
997 c_vis_args += '-fvisibility=hidden'
998 endif
999
1000 # Check for C and C++ arguments for MSVC compatibility. These are only used
1001 # in parts of the mesa code base that need to compile with MSVC, mainly
1002 # common code
1003 foreach a : ['-Werror=pointer-arith', '-Werror=vla', '-Werror=gnu-empty-initializer']
1004 if cc.has_argument(a)
1005 c_msvc_compat_args += a
1006 endif
1007 if cpp.has_argument(a)
1008 cpp_msvc_compat_args += a
1009 endif
1010 endforeach
1011
1012 if cpp.has_argument('-fvisibility=hidden')
1013 cpp_vis_args += '-fvisibility=hidden'
1014 endif
1015
1016 endif
1017
1018 # set linker arguments
1019 if host_machine.system() == 'windows'
1020 if cc.get_id() == 'msvc'
1021 add_project_link_arguments(
1022 '/fixed:no',
1023 '/incremental:no',
1024 '/dynamicbase',
1025 '/nxcompat',
1026 language : ['c', 'cpp'],
1027 )
1028 else
1029 add_project_link_arguments(
1030 '-Wl,--nxcompat',
1031 '-Wl,--dynamicbase',
1032 '-static-libgcc',
1033 '-static-libstdc++',
1034 language : ['c', 'cpp'],
1035 )
1036 endif
1037 endif
1038
1039 if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
1040 pre_args += '-DUSE_SSE41'
1041 with_sse41 = true
1042 sse41_args = ['-msse4.1']
1043
1044 # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
1045 # that's not guaranteed
1046 if host_machine.cpu_family() == 'x86'
1047 sse41_args += '-mstackrealign'
1048 endif
1049 else
1050 with_sse41 = false
1051 sse41_args = []
1052 endif
1053
1054 # Check for GCC style atomics
1055 dep_atomic = null_dep
1056
1057 if cc.compiles('''#include <stdint.h>
1058 int main() {
1059 struct {
1060 uint64_t *v;
1061 } x;
1062 return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
1063 (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
1064
1065 }''',
1066 name : 'GCC atomic builtins')
1067 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
1068
1069 # Not all atomic calls can be turned into lock-free instructions, in which
1070 # GCC will make calls into the libatomic library. Check whether we need to
1071 # link with -latomic.
1072 #
1073 # This can happen for 64-bit atomic operations on 32-bit architectures such
1074 # as ARM.
1075 if not cc.links('''#include <stdint.h>
1076 int main() {
1077 struct {
1078 uint64_t *v;
1079 } x;
1080 return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
1081 (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
1082 }''',
1083 name : 'GCC atomic builtins required -latomic')
1084 dep_atomic = cc.find_library('atomic')
1085 endif
1086 endif
1087 if not cc.links('''#include <stdint.h>
1088 uint64_t v;
1089 int main() {
1090 return __sync_add_and_fetch(&v, (uint64_t)1);
1091 }''',
1092 dependencies : dep_atomic,
1093 name : 'GCC 64bit atomics')
1094 pre_args += '-DMISSING_64BIT_ATOMICS'
1095 endif
1096
1097 dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows)
1098
1099 # TODO: shared/static? Is this even worth doing?
1100
1101 with_asm_arch = ''
1102 if host_machine.cpu_family() == 'x86'
1103 if system_has_kms_drm or host_machine.system() == 'gnu'
1104 with_asm_arch = 'x86'
1105 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
1106 '-DUSE_SSE_ASM']
1107
1108 if with_glx_read_only_text
1109 pre_args += ['-DGLX_X86_READONLY_TEXT']
1110 endif
1111 endif
1112 elif host_machine.cpu_family() == 'x86_64'
1113 if system_has_kms_drm
1114 with_asm_arch = 'x86_64'
1115 pre_args += ['-DUSE_X86_64_ASM']
1116 endif
1117 elif host_machine.cpu_family() == 'arm'
1118 if system_has_kms_drm
1119 with_asm_arch = 'arm'
1120 pre_args += ['-DUSE_ARM_ASM']
1121 endif
1122 elif host_machine.cpu_family() == 'aarch64'
1123 if system_has_kms_drm
1124 with_asm_arch = 'aarch64'
1125 pre_args += ['-DUSE_AARCH64_ASM']
1126 endif
1127 elif host_machine.cpu_family() == 'sparc64'
1128 if system_has_kms_drm
1129 with_asm_arch = 'sparc'
1130 pre_args += ['-DUSE_SPARC_ASM']
1131 endif
1132 elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
1133 if system_has_kms_drm
1134 with_asm_arch = 'ppc64le'
1135 pre_args += ['-DUSE_PPC64LE_ASM']
1136 endif
1137 endif
1138
1139 # Check for standard headers and functions
1140 if (cc.has_header_symbol('sys/sysmacros.h', 'major') and
1141 cc.has_header_symbol('sys/sysmacros.h', 'minor') and
1142 cc.has_header_symbol('sys/sysmacros.h', 'makedev'))
1143 pre_args += '-DMAJOR_IN_SYSMACROS'
1144 endif
1145 if (cc.has_header_symbol('sys/mkdev.h', 'major') and
1146 cc.has_header_symbol('sys/mkdev.h', 'minor') and
1147 cc.has_header_symbol('sys/mkdev.h', 'makedev'))
1148 pre_args += '-DMAJOR_IN_MKDEV'
1149 endif
1150
1151 foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
1152 if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h))
1153 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
1154 endif
1155 endforeach
1156
1157 foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r', 'flock', 'strtok_r']
1158 if cc.has_function(f)
1159 pre_args += '-DHAVE_@0@'.format(f.to_upper())
1160 endif
1161 endforeach
1162
1163 if cc.has_header_symbol('errno.h', 'program_invocation_name',
1164 args : '-D_GNU_SOURCE')
1165 pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME'
1166 elif with_tools.contains('intel')
1167 error('Intel tools require the program_invocation_name variable')
1168 endif
1169
1170 # MinGW provides a __builtin_posix_memalign function, but not a posix_memalign.
1171 # This means that this check will succeed, but then compilation will later
1172 # fail. MSVC doesn't have this function at all, so only check for it on
1173 # non-windows platforms.
1174 if host_machine.system() != 'windows'
1175 if cc.has_function('posix_memalign')
1176 pre_args += '-DHAVE_POSIX_MEMALIGN'
1177 endif
1178 endif
1179
1180 # strtod locale support
1181 if cc.links('''
1182 #define _GNU_SOURCE
1183 #include <stdlib.h>
1184 #include <locale.h>
1185 #ifdef HAVE_XLOCALE_H
1186 #include <xlocale.h>
1187 #endif
1188 int main() {
1189 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
1190 const char *s = "1.0";
1191 char *end;
1192 double d = strtod_l(s, end, loc);
1193 float f = strtof_l(s, end, loc);
1194 freelocale(loc);
1195 return 0;
1196 }''',
1197 args : pre_args,
1198 name : 'strtod has locale support')
1199 pre_args += '-DHAVE_STRTOD_L'
1200 endif
1201
1202 # Check for some linker flags
1203 ld_args_bsymbolic = []
1204 if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
1205 ld_args_bsymbolic += '-Wl,-Bsymbolic'
1206 endif
1207 ld_args_gc_sections = []
1208 if cc.links('static char unused() { return 5; } int main() { return 0; }',
1209 args : '-Wl,--gc-sections', name : 'gc-sections')
1210 ld_args_gc_sections += '-Wl,--gc-sections'
1211 endif
1212 with_ld_version_script = false
1213 if cc.links('int main() { return 0; }',
1214 args : '-Wl,--version-script=@0@'.format(
1215 join_paths(meson.source_root(), 'build-support/conftest.map')),
1216 name : 'version-script')
1217 with_ld_version_script = true
1218 endif
1219 with_ld_dynamic_list = false
1220 if cc.links('int main() { return 0; }',
1221 args : '-Wl,--dynamic-list=@0@'.format(
1222 join_paths(meson.source_root(), 'build-support/conftest.dyn')),
1223 name : 'dynamic-list')
1224 with_ld_dynamic_list = true
1225 endif
1226
1227 ld_args_build_id = cc.get_supported_link_arguments('-Wl,--build-id=sha1')
1228
1229 # check for dl support
1230 dep_dl = null_dep
1231 if not cc.has_function('dlopen')
1232 dep_dl = cc.find_library('dl', required : host_machine.system() != 'windows')
1233 endif
1234 if cc.has_function('dladdr', dependencies : dep_dl)
1235 # This is really only required for megadrivers
1236 pre_args += '-DHAVE_DLADDR'
1237 endif
1238
1239 if cc.has_function('dl_iterate_phdr')
1240 pre_args += '-DHAVE_DL_ITERATE_PHDR'
1241 elif with_intel_vk
1242 error('Intel "Anvil" Vulkan driver requires the dl_iterate_phdr function')
1243 elif with_dri_i965 and with_shader_cache
1244 error('Intel i965 GL driver requires dl_iterate_phdr when built with shader caching.')
1245 endif
1246
1247 # Determine whether or not the rt library is needed for time functions
1248 if host_machine.system() == 'windows' or cc.has_function('clock_gettime')
1249 dep_clock = null_dep
1250 else
1251 dep_clock = cc.find_library('rt')
1252 endif
1253
1254 # TODO: some of these may be conditional
1255 dep_zlib = dependency('zlib', version : '>= 1.2.3', fallback : ['zlib', 'zlib_dep'])
1256 pre_args += '-DHAVE_ZLIB'
1257
1258 _zstd = get_option('zstd')
1259 if _zstd != 'false'
1260 dep_zstd = dependency('libzstd', required : _zstd == 'true')
1261 if dep_zstd.found()
1262 pre_args += '-DHAVE_ZSTD'
1263 endif
1264 else
1265 dep_zstd = null_dep
1266 endif
1267
1268 dep_thread = dependency('threads')
1269 if dep_thread.found() and host_machine.system() != 'windows'
1270 pre_args += '-DHAVE_PTHREAD'
1271 if cc.has_function(
1272 'pthread_setaffinity_np',
1273 dependencies : dep_thread,
1274 prefix : '#include <pthread.h>',
1275 args : '-D_GNU_SOURCE')
1276 pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
1277 endif
1278 if cc.has_function(
1279 'pthread_setaffinity_np',
1280 dependencies : dep_thread,
1281 prefix : '#include <pthread_np.h>')
1282 pre_args += '-DPTHREAD_SETAFFINITY_IN_NP_HEADER'
1283 endif
1284 endif
1285 if host_machine.system() != 'windows'
1286 dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'])
1287 else
1288 dep_expat = null_dep
1289 endif
1290 # this only exists on linux so either this is linux and it will be found, or
1291 # it's not linux and wont
1292 dep_m = cc.find_library('m', required : false)
1293
1294 # Check for libdrm. Various drivers have different libdrm version requirements,
1295 # but we always want to use the same version for all libdrm modules. That means
1296 # even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
1297 # bar are both on use 2.4.3 for both of them
1298 dep_libdrm_amdgpu = null_dep
1299 dep_libdrm_radeon = null_dep
1300 dep_libdrm_nouveau = null_dep
1301 dep_libdrm_intel = null_dep
1302
1303 _drm_amdgpu_ver = '2.4.100'
1304 _drm_radeon_ver = '2.4.71'
1305 _drm_nouveau_ver = '2.4.66'
1306 _drm_intel_ver = '2.4.75'
1307 _drm_ver = '2.4.81'
1308
1309 _libdrm_checks = [
1310 ['intel', with_dri_i915 or with_gallium_i915],
1311 ['amdgpu', with_amd_vk or with_gallium_radeonsi],
1312 ['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
1313 with_gallium_r300 or with_gallium_r600)],
1314 ['nouveau', (with_gallium_nouveau or with_dri_nouveau)],
1315 ]
1316
1317 # VC4 only needs core libdrm support of this version, not a libdrm_vc4
1318 # library.
1319 if with_gallium_vc4
1320 _drm_ver = '2.4.89'
1321 endif
1322
1323 # etnaviv only needs core libdrm
1324 if with_gallium_etnaviv
1325 _drm_ver = '2.4.89'
1326 endif
1327
1328 # Loop over the enables versions and get the highest libdrm requirement for all
1329 # active drivers.
1330 _drm_blame = ''
1331 foreach d : _libdrm_checks
1332 ver = get_variable('_drm_@0@_ver'.format(d[0]))
1333 if d[1] and ver.version_compare('>' + _drm_ver)
1334 _drm_ver = ver
1335 _drm_blame = d[0]
1336 endif
1337 endforeach
1338 if _drm_blame != ''
1339 message('libdrm @0@ needed because @1@ has the highest requirement'.format(_drm_ver, _drm_blame))
1340 endif
1341
1342 # Then get each libdrm module
1343 foreach d : _libdrm_checks
1344 if d[1]
1345 set_variable(
1346 'dep_libdrm_' + d[0],
1347 dependency('libdrm_' + d[0], version : '>=' + _drm_ver)
1348 )
1349 endif
1350 endforeach
1351
1352 with_gallium_drisw_kms = false
1353 dep_libdrm = dependency(
1354 'libdrm', version : '>=' + _drm_ver,
1355 required : with_dri2 or with_dri3
1356 )
1357 if dep_libdrm.found()
1358 pre_args += '-DHAVE_LIBDRM'
1359 if with_dri_platform == 'drm' and with_dri
1360 with_gallium_drisw_kms = true
1361 endif
1362 endif
1363
1364 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine']
1365 llvm_optional_modules = ['coroutines']
1366 if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
1367 llvm_modules += ['amdgpu', 'native', 'bitreader', 'ipo']
1368 if with_gallium_r600
1369 llvm_modules += 'asmparser'
1370 endif
1371 endif
1372 if with_gallium_opencl
1373 llvm_modules += [
1374 'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
1375 'lto', 'option', 'objcarcopts', 'profiledata',
1376 ]
1377 endif
1378
1379 if with_amd_vk or with_gallium_radeonsi
1380 _llvm_version = '>= 8.0.0'
1381 elif with_gallium_swr
1382 _llvm_version = '>= 6.0.0'
1383 else
1384 _llvm_version = '>= 3.9.0'
1385 endif
1386
1387 _shared_llvm = get_option('shared-llvm')
1388 _llvm = get_option('llvm')
1389
1390 # The cmake method will never find libllvm.so|dylib; this is fine for windows
1391 # because llvm doesn't support libllvm.dll
1392 _llvm_method = 'config-tool'
1393 if (meson.version().version_compare('>= 0.51.0') and
1394 host_machine.system() == 'windows')
1395 _llvm_method = 'cmake'
1396 endif
1397
1398 dep_llvm = null_dep
1399 with_llvm = false
1400 if _llvm != 'false'
1401 dep_llvm = dependency(
1402 'llvm',
1403 version : _llvm_version,
1404 modules : llvm_modules,
1405 optional_modules : llvm_optional_modules,
1406 required : (
1407 with_amd_vk or with_gallium_radeonsi or with_gallium_swr or
1408 with_gallium_opencl or _llvm == 'true'
1409 ),
1410 static : not _shared_llvm,
1411 method : _llvm_method,
1412 fallback : ['llvm', 'dep_llvm'],
1413 )
1414 with_llvm = dep_llvm.found()
1415 endif
1416 if with_llvm
1417 pre_args += '-DLLVM_AVAILABLE'
1418 pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
1419
1420 # LLVM can be built without rtti, turning off rtti changes the ABI of C++
1421 # programs, so we need to build all C++ code in mesa without rtti as well to
1422 # ensure that linking works.
1423 #
1424 # In meson 0.51.0 we can use cmake to find LLVM in addittion to meson's
1425 # builtin llvm-config based finder. A new generic variable getter method
1426 # has also been added, so we'll use that if we can, to cover the cmake case.
1427 if dep_llvm.type_name() == 'internal'
1428 _rtti = subproject('llvm').get_variable('has_rtti', true)
1429 elif meson.version().version_compare('>=0.51')
1430 # The CMake finder will return 'ON', the llvm-config will return 'YES'
1431 _rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
1432 else
1433 _rtti = dep_llvm.get_configtool_variable('has-rtti') == 'YES'
1434 endif
1435 if not _rtti
1436 if with_gallium_nouveau
1437 error('The Nouveau driver requires rtti. You either need to turn off nouveau or use an LLVM built with LLVM_ENABLE_RTTI.')
1438 elif with_gallium_opencl
1439 error('The Clover OpenCL state tracker requires rtti, you need to turn off clover or use an LLVM built with LLVM_ENABLE_RTTI.')
1440 endif
1441 if cc.get_id() == 'msvc'
1442 cpp_args += '/GR-'
1443 else
1444 cpp_args += '-fno-rtti'
1445 endif
1446 endif
1447 elif with_amd_vk or with_gallium_radeonsi or with_gallium_swr
1448 error('The following drivers require LLVM: Radv, RadeonSI, SWR. One of these is enabled, but LLVM is disabled.')
1449 elif with_gallium_opencl
1450 error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
1451 endif
1452
1453 if (with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or
1454 (with_gallium_r600 and with_llvm))
1455 dep_elf = dependency('libelf', required : false)
1456 if not dep_elf.found()
1457 dep_elf = cc.find_library('elf')
1458 endif
1459 else
1460 dep_elf = null_dep
1461 endif
1462
1463 dep_glvnd = null_dep
1464 if with_glvnd
1465 dep_glvnd = dependency('libglvnd', version : '>= 1.2.0')
1466 pre_args += '-DUSE_LIBGLVND=1'
1467 endif
1468
1469 if with_valgrind != 'false'
1470 dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
1471 if dep_valgrind.found()
1472 pre_args += '-DHAVE_VALGRIND'
1473 endif
1474 else
1475 dep_valgrind = null_dep
1476 endif
1477
1478 # pthread stubs. Lets not and say we didn't
1479
1480 if host_machine.system() == 'windows'
1481 # Prefer the winflexbison versions, they're much easier to install and have
1482 # better windows support.
1483
1484 prog_flex = find_program('win_flex', required : false)
1485 if prog_flex.found()
1486 # windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
1487 # _fileno functions)
1488 prog_flex = [prog_flex, '--wincompat']
1489 else
1490 prog_flex = [find_program('lex', 'flex', required : with_any_opengl)]
1491 endif
1492 # Force flex to use const keyword in prototypes, as relies on __cplusplus or
1493 # __STDC__ macro to determine whether it's safe to use const keyword, but
1494 # MSVC never defines __STDC__ unless we disable all MSVC extensions.
1495 prog_flex += '-DYY_USE_CONST='
1496
1497 prog_bison = find_program('win_bison', required : false)
1498 if not prog_bison.found()
1499 prog_bison = find_program('yacc', 'bison', required : with_any_opengl)
1500 endif
1501 else
1502 prog_bison = find_program('bison', required : with_any_opengl)
1503 prog_flex = find_program('flex', required : with_any_opengl)
1504 endif
1505
1506 dep_selinux = null_dep
1507 if get_option('selinux')
1508 dep_selinux = dependency('libselinux')
1509 pre_args += '-DMESA_SELINUX'
1510 endif
1511
1512 if with_libunwind != 'false'
1513 dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
1514 if dep_unwind.found()
1515 pre_args += '-DHAVE_LIBUNWIND'
1516 endif
1517 else
1518 dep_unwind = null_dep
1519 endif
1520
1521 if with_osmesa != 'none'
1522 if with_osmesa == 'gallium' and not with_gallium_softpipe
1523 error('OSMesa gallium requires gallium softpipe or llvmpipe.')
1524 endif
1525 if host_machine.system() == 'windows'
1526 osmesa_lib_name = 'osmesa'
1527 else
1528 osmesa_lib_name = 'OSMesa'
1529 endif
1530 osmesa_bits = get_option('osmesa-bits')
1531 if osmesa_bits != '8'
1532 if with_dri or with_glx != 'disabled'
1533 error('OSMesa bits must be 8 if building glx or dir based drivers')
1534 endif
1535 osmesa_lib_name = osmesa_lib_name + osmesa_bits
1536 pre_args += [
1537 '-DCHAN_BITS=@0@'.format(osmesa_bits), '-DDEFAULT_SOFTWARE_DEPTH_BITS=31'
1538 ]
1539 endif
1540 endif
1541
1542 # TODO: symbol mangling
1543
1544 if with_platform_wayland
1545 dep_wl_scanner = dependency('wayland-scanner', native: true)
1546 prog_wl_scanner = find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
1547 if dep_wl_scanner.version().version_compare('>= 1.15')
1548 wl_scanner_arg = 'private-code'
1549 else
1550 wl_scanner_arg = 'code'
1551 endif
1552 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
1553 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
1554 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
1555 if with_egl
1556 dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3')
1557 dep_wayland_egl_headers = declare_dependency(
1558 compile_args : run_command(prog_pkgconfig, ['wayland-egl-backend', '--cflags']).stdout().split())
1559 endif
1560 wayland_dmabuf_xml = join_paths(
1561 dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
1562 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
1563 )
1564 pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
1565 endif
1566
1567 dep_x11 = null_dep
1568 dep_xext = null_dep
1569 dep_xdamage = null_dep
1570 dep_xfixes = null_dep
1571 dep_x11_xcb = null_dep
1572 dep_xcb = null_dep
1573 dep_xcb_glx = null_dep
1574 dep_xcb_dri2 = null_dep
1575 dep_xcb_dri3 = null_dep
1576 dep_dri2proto = null_dep
1577 dep_glproto = null_dep
1578 dep_xxf86vm = null_dep
1579 dep_xcb_dri3 = null_dep
1580 dep_xcb_present = null_dep
1581 dep_xcb_sync = null_dep
1582 dep_xcb_xfixes = null_dep
1583 dep_xshmfence = null_dep
1584 dep_xcb_xrandr = null_dep
1585 dep_xlib_xrandr = null_dep
1586 if with_platform_x11
1587 if with_glx == 'xlib' or with_glx == 'gallium-xlib'
1588 dep_x11 = dependency('x11')
1589 dep_xext = dependency('xext')
1590 dep_xcb = dependency('xcb')
1591 elif with_glx == 'dri'
1592 dep_x11 = dependency('x11')
1593 dep_xext = dependency('xext')
1594 dep_xdamage = dependency('xdamage', version : '>= 1.1')
1595 dep_xfixes = dependency('xfixes')
1596 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
1597 endif
1598 if (with_any_vk or with_glx == 'dri' or with_egl or
1599 (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
1600 with_gallium_omx != 'disabled'))
1601 dep_xcb = dependency('xcb')
1602 dep_x11_xcb = dependency('x11-xcb')
1603 if with_dri_platform == 'drm' and not dep_libdrm.found()
1604 error('libdrm required for gallium video statetrackers when using x11')
1605 endif
1606 endif
1607 if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
1608 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
1609
1610 if with_dri3
1611 pre_args += '-DHAVE_DRI3'
1612 dep_xcb_dri3 = dependency('xcb-dri3')
1613 dep_xcb_present = dependency('xcb-present')
1614 # until xcb-dri3 has been around long enough to make a hard-dependency:
1615 if (dep_xcb_dri3.version().version_compare('>= 1.13') and
1616 dep_xcb_present.version().version_compare('>= 1.13'))
1617 pre_args += '-DHAVE_DRI3_MODIFIERS'
1618 endif
1619 dep_xcb_sync = dependency('xcb-sync')
1620 dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
1621 endif
1622 endif
1623 if with_glx == 'dri' or with_glx == 'gallium-xlib'
1624 dep_glproto = dependency('glproto', version : '>= 1.4.14')
1625 endif
1626 if with_glx == 'dri'
1627 if with_dri_platform == 'drm'
1628 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
1629 dep_xxf86vm = dependency('xxf86vm')
1630 endif
1631 endif
1632 if (with_egl or (
1633 with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
1634 with_gallium_omx != 'disabled'))
1635 dep_xcb_xfixes = dependency('xcb-xfixes')
1636 endif
1637 if with_xlib_lease
1638 dep_xcb_xrandr = dependency('xcb-randr')
1639 dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
1640 endif
1641 endif
1642
1643 if get_option('gallium-extra-hud')
1644 pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
1645 endif
1646
1647 _sensors = get_option('lmsensors')
1648 if _sensors != 'false'
1649 dep_lmsensors = cc.find_library('sensors', required : _sensors == 'true')
1650 if dep_lmsensors.found()
1651 pre_args += '-DHAVE_LIBSENSORS=1'
1652 endif
1653 else
1654 dep_lmsensors = null_dep
1655 endif
1656
1657 foreach a : pre_args
1658 add_project_arguments(a, language : ['c', 'cpp'])
1659 endforeach
1660 foreach a : c_args
1661 add_project_arguments(a, language : ['c'])
1662 endforeach
1663 foreach a : cpp_args
1664 add_project_arguments(a, language : ['cpp'])
1665 endforeach
1666
1667 gl_priv_reqs = []
1668
1669 if with_glx == 'xlib' or with_glx == 'gallium-xlib'
1670 gl_priv_reqs += ['x11', 'xext', 'xcb']
1671 elif with_glx == 'dri'
1672 gl_priv_reqs += [
1673 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
1674 'xcb-glx >= 1.8.1']
1675 if with_dri_platform == 'drm'
1676 gl_priv_reqs += 'xcb-dri2 >= 1.8'
1677 gl_priv_reqs += 'xxf86vm'
1678 endif
1679 endif
1680 if dep_libdrm.found()
1681 gl_priv_reqs += 'libdrm >= 2.4.75'
1682 endif
1683
1684 gl_priv_libs = []
1685 if dep_thread.found()
1686 gl_priv_libs += ['-lpthread', '-pthread']
1687 endif
1688 if dep_m.found()
1689 gl_priv_libs += '-lm'
1690 endif
1691 if dep_dl.found()
1692 gl_priv_libs += '-ldl'
1693 endif
1694
1695 pkg = import('pkgconfig')
1696
1697 if host_machine.system() == 'windows'
1698 prog_dumpbin = find_program('dumpbin', required : false)
1699 with_symbols_check = prog_dumpbin.found() and with_tests
1700 symbols_check_args = ['--dumpbin', prog_dumpbin.path()]
1701 else
1702 prog_nm = find_program('nm')
1703 with_symbols_check = with_tests
1704 symbols_check_args = ['--nm', prog_nm.path()]
1705 endif
1706
1707 # This quirk needs to be applied to sources with functions defined in assembly
1708 # as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391
1709 gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
1710
1711 subdir('include')
1712 subdir('bin')
1713 subdir('src')
1714
1715 # Meson 0.49 and earlier seems to have a bug that fails to evaluate the string-
1716 # formatting below unless the first argument is passed as a variable. This has
1717 # been fixed in Meson 0.50 and beyond, but we need to keep it like this for now
1718 # for backwards compatibility.
1719 _with_opengl_string = with_opengl ? 'yes' : 'no'
1720
1721 lines = ['',
1722 'prefix: ' + get_option('prefix'),
1723 'libdir: ' + get_option('libdir'),
1724 'includedir: ' + get_option('includedir'),
1725 '',
1726 'OpenGL: @0@ (ES1: @1@ ES2: @2@)'.format(_with_opengl_string,
1727 with_gles1 ? 'yes' : 'no',
1728 with_gles2 ? 'yes' : 'no'),
1729 ]
1730
1731 if with_osmesa != 'none'
1732 lines += ''
1733 suffix = ''
1734 if with_osmesa == 'gallium'
1735 suffix = '(Gallium)'
1736 endif
1737 lines += 'OSMesa: lib' + osmesa_lib_name + suffix
1738 else
1739 lines += 'OSMesa: no'
1740 endif
1741
1742 if with_dri
1743 lines += ''
1744 lines += 'DRI platform: ' + with_dri_platform
1745 if dri_drivers.length() != 0 and dri_drivers != ['']
1746 lines += 'DRI drivers: ' + ' '.join(dri_drivers)
1747 else
1748 lines += 'DRI drivers: no'
1749 endif
1750 lines += 'DRI driver dir: ' + dri_drivers_path
1751 endif
1752
1753 if with_glx != 'disabled'
1754 lines += ''
1755 if with_glx == 'dri'
1756 lines += 'GLX: DRI-based'
1757 elif with_glx == 'xlib'
1758 lines += 'GLX: Xlib-based'
1759 elif with_glx == 'gallium-xlib'
1760 lines += 'GLX: Xlib-based (Gallium)'
1761 else
1762 lines += 'GLX: ' + with_glx
1763 endif
1764 endif
1765
1766 lines += ''
1767 lines += 'EGL: ' + (with_egl ? 'yes' : 'no')
1768 if with_egl
1769 egl_drivers = []
1770 if with_dri
1771 egl_drivers += 'builtin:egl_dri2'
1772 endif
1773 if with_dri3
1774 egl_drivers += 'builtin:egl_dri3'
1775 endif
1776 lines += 'EGL drivers: ' + ' '.join(egl_drivers)
1777 endif
1778 lines += 'GBM: ' + (with_gbm ? 'yes' : 'no')
1779 if with_platforms
1780 lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms)
1781 endif
1782
1783 lines += ''
1784 if with_any_vk
1785 lines += 'Vulkan drivers: ' + ' '.join(_vulkan_drivers)
1786 lines += 'Vulkan ICD dir: ' + with_vulkan_icd_dir
1787 else
1788 lines += 'Vulkan drivers: no'
1789 endif
1790
1791 lines += ''
1792 if with_llvm
1793 lines += 'llvm: yes'
1794 lines += 'llvm-version: ' + dep_llvm.version()
1795 else
1796 lines += 'llvm: no'
1797 endif
1798
1799 lines += ''
1800 if with_gallium
1801 lines += 'Gallium drivers: ' + ' '.join(gallium_drivers)
1802 gallium_st = ['mesa']
1803 if with_gallium_xa
1804 gallium_st += 'xa'
1805 endif
1806 if with_gallium_xvmc
1807 gallium_st += 'xvmc'
1808 endif
1809 if with_gallium_xvmc
1810 gallium_st += 'xvmc'
1811 endif
1812 if with_gallium_vdpau
1813 gallium_st += 'vdpau'
1814 endif
1815 if with_gallium_omx != 'disabled'
1816 gallium_st += 'omx' + with_gallium_omx
1817 endif
1818 if with_gallium_va
1819 gallium_st += 'va'
1820 endif
1821 if with_gallium_st_nine
1822 gallium_st += 'nine'
1823 endif
1824 if with_gallium_opencl
1825 gallium_st += 'clover'
1826 endif
1827 lines += 'Gallium st: ' + ' '.join(gallium_st)
1828 else
1829 lines += 'Gallium: no'
1830 endif
1831
1832 lines += 'HUD lmsensors: ' + (dep_lmsensors.found() ? 'yes' : 'no')
1833
1834 lines += ''
1835 lines += 'Shared-glapi: ' + (with_shared_glapi ? 'yes' : 'no')
1836
1837
1838 indent = ' '
1839 summary = indent + ('\n' + indent).join(lines)
1840 message('Configuration summary:\n@0@\n'.format(summary))