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