1# Copyright © 2017-2020 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 21project( 22 'mesa', 23 ['c', 'cpp'], 24 version : run_command( 25 [find_program('python3', 'python'), 'bin/meson_get_version.py'], 26 check : true 27 ).stdout(), 28 license : 'MIT', 29 meson_version : '>= 0.53', 30 default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++14'] 31) 32 33# In recent versions, meson can inject some extra arguments to get richer 34# results from gtest based tests. Feature was added in 0.55, but requiring 35# 0.59.2 to include an important fix. See https://github.com/mesonbuild/meson/pull/9283. 36gtest_test_protocol = 'exitcode' 37if meson.version().version_compare('>= 0.59.2') 38 gtest_test_protocol = 'gtest' 39endif 40 41cc = meson.get_compiler('c') 42cpp = meson.get_compiler('cpp') 43 44null_dep = dependency('', required : false) 45 46if get_option('layout') != 'mirror' 47 error('`mirror` is the only build directory layout supported') 48endif 49 50# Arguments for the preprocessor, put these in a separate array from the C and 51# C++ (cpp in meson terminology) arguments since they need to be added to the 52# default arguments for both C and C++. 53pre_args = [ 54 '-D__STDC_CONSTANT_MACROS', 55 '-D__STDC_FORMAT_MACROS', 56 '-D__STDC_LIMIT_MACROS', 57 '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()), 58 '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"', 59] 60c_args = [] 61cpp_args = [] 62 63with_moltenvk_dir = get_option('moltenvk-dir') 64with_vulkan_icd_dir = get_option('vulkan-icd-dir') 65with_tests = get_option('build-tests') 66with_aco_tests = get_option('build-aco-tests') 67with_glx_read_only_text = get_option('glx-read-only-text') 68with_glx_direct = get_option('glx-direct') 69with_osmesa = get_option('osmesa') 70with_vulkan_overlay_layer = get_option('vulkan-layers').contains('overlay') 71with_vulkan_device_select_layer = get_option('vulkan-layers').contains('device-select') 72with_tools = get_option('tools') 73if with_tools.contains('all') 74 with_tools = [ 75 'drm-shim', 76 'dlclose-skip', 77 'etnaviv', 78 'freedreno', 79 'glsl', 80 'intel', 81 'intel-ui', 82 'lima', 83 'nir', 84 'nouveau', 85 'xvmc', 86 'asahi', 87 'imagination', 88 ] 89endif 90 91with_any_vulkan_layers = get_option('vulkan-layers').length() != 0 92with_intel_tools = with_tools.contains('intel') or with_tools.contains('intel-ui') 93with_imgui = with_intel_tools or with_vulkan_overlay_layer 94 95dri_drivers_path = get_option('dri-drivers-path') 96if dri_drivers_path == '' 97 dri_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'dri') 98endif 99dri_search_path = get_option('dri-search-path') 100if dri_search_path == '' 101 dri_search_path = dri_drivers_path 102endif 103 104gbm_backends_path = get_option('gbm-backends-path') 105if gbm_backends_path == '' 106 gbm_backends_path = join_paths(get_option('prefix'), get_option('libdir'), 'gbm') 107endif 108 109with_gles1 = get_option('gles1') 110if with_gles1 == 'true' 111 with_gles1 = 'enabled' 112 warning('gles1 option "true" deprecated, please use "enabled" instead.') 113elif with_gles1 == 'false' 114 with_gles1 = 'disabled' 115 warning('gles1 option "false" deprecated, please use "disabled" instead.') 116endif 117with_gles2 = get_option('gles2') 118if with_gles2 == 'true' 119 with_gles2 = 'enabled' 120 warning('gles2 option "true" deprecated, please use "enabled" instead.') 121elif with_gles2 == 'false' 122 with_gles2 = 'disabled' 123 warning('gles2 option "false" deprecated, please use "disabled" instead.') 124endif 125if host_machine.system() == 'windows' 126 if with_gles1 == 'auto' 127 with_gles1 = 'disabled' 128 endif 129 if with_gles2 == 'auto' 130 with_gles2 = 'disabled' 131 endif 132endif 133with_opengl = get_option('opengl') 134 135# Default shared glapi off for windows, on elsewhere. 136_sg = get_option('shared-glapi') 137if _sg == 'true' 138 _sg = 'enabled' 139 warning('shared-glapi option "true" deprecated, please use "enabled" instead.') 140elif _sg == 'false' 141 _sg = 'disabled' 142 warning('shared-glapi option "false" deprecated, please use "disabled" instead.') 143endif 144if _sg == 'auto' 145 with_shared_glapi = host_machine.system() != 'windows' 146else 147 with_shared_glapi = _sg == 'enabled' 148endif 149 150# shared-glapi is required if at least two OpenGL APIs are being built 151if not with_shared_glapi 152 if ((with_gles1 == 'enabled' and with_gles2 == 'enabled') or 153 (with_gles1 == 'enabled' and with_opengl) or 154 (with_gles2 == 'enabled' and with_opengl)) 155 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x') 156 endif 157 with_gles1 = 'disabled' 158 with_gles2 = 'disabled' 159endif 160 161# We require OpenGL for OpenGL ES 162if not with_opengl 163 if (with_gles1 == 'enabled' or with_gles2 == 'enabled') and not with_opengl 164 error('building OpenGL ES without OpenGL is not supported.') 165 endif 166 with_gles1 = 'disabled' 167 with_gles2 = 'disabled' 168endif 169 170with_gles1 = with_gles1 != 'disabled' 171with_gles2 = with_gles2 != 'disabled' 172with_any_opengl = with_opengl or with_gles1 or with_gles2 173# Only build shared_glapi if at least one OpenGL API is enabled 174with_shared_glapi = with_shared_glapi and with_any_opengl 175 176system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos'].contains(host_machine.system()) 177 178dri_drivers = get_option('dri-drivers') 179if dri_drivers.length() != 0 180 error('Mesa\'s main branch no longer has any "classic" drivers, use the "amber" branch instead.') 181endif 182 183with_dri = dri_drivers.length() != 0 184 185gallium_drivers = get_option('gallium-drivers') 186if gallium_drivers.contains('auto') 187 if system_has_kms_drm 188 # TODO: PPC, Sparc 189 if ['x86', 'x86_64'].contains(host_machine.cpu_family()) 190 gallium_drivers = [ 191 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'svga', 'swrast', 192 'iris', 'crocus', 'i915' 193 ] 194 elif ['arm', 'aarch64'].contains(host_machine.cpu_family()) 195 gallium_drivers = [ 196 'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau', 'svga', 197 'tegra', 'virgl', 'lima', 'panfrost', 'swrast' 198 ] 199 elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family()) 200 gallium_drivers = [ 201 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'swrast' 202 ] 203 else 204 error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format( 205 host_machine.cpu_family())) 206 endif 207 elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system()) 208 gallium_drivers = ['swrast'] 209 else 210 error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format( 211 host_machine.system())) 212 endif 213endif 214with_gallium_radeonsi = gallium_drivers.contains('radeonsi') 215with_gallium_r300 = gallium_drivers.contains('r300') 216with_gallium_r600 = gallium_drivers.contains('r600') 217with_gallium_nouveau = gallium_drivers.contains('nouveau') 218with_gallium_freedreno = gallium_drivers.contains('freedreno') 219with_gallium_softpipe = gallium_drivers.contains('swrast') 220with_gallium_vc4 = gallium_drivers.contains('vc4') 221with_gallium_v3d = gallium_drivers.contains('v3d') 222with_gallium_panfrost = gallium_drivers.contains('panfrost') 223with_gallium_etnaviv = gallium_drivers.contains('etnaviv') 224with_gallium_tegra = gallium_drivers.contains('tegra') 225with_gallium_crocus = gallium_drivers.contains('crocus') 226with_gallium_iris = gallium_drivers.contains('iris') 227with_gallium_i915 = gallium_drivers.contains('i915') 228with_gallium_svga = gallium_drivers.contains('svga') 229with_gallium_virgl = gallium_drivers.contains('virgl') 230with_gallium_lima = gallium_drivers.contains('lima') 231with_gallium_zink = gallium_drivers.contains('zink') 232with_gallium_d3d12 = gallium_drivers.contains('d3d12') 233with_gallium_asahi = gallium_drivers.contains('asahi') 234foreach gallium_driver : gallium_drivers 235 pre_args += '-DHAVE_@0@'.format(gallium_driver.to_upper()) 236endforeach 237 238with_gallium = gallium_drivers.length() != 0 239with_gallium_kmsro = with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_panfrost or with_gallium_lima or with_gallium_freedreno 240 241if with_gallium and system_has_kms_drm 242 _glx = get_option('glx') 243 _egl = get_option('egl') 244 if _glx == 'dri' or _egl == 'enabled' or (_glx == 'disabled' and _egl != 'disabled') 245 with_dri = true 246 endif 247endif 248 249_vulkan_drivers = get_option('vulkan-drivers') 250if _vulkan_drivers.contains('auto') 251 if system_has_kms_drm 252 if host_machine.cpu_family().startswith('x86') 253 _vulkan_drivers = ['amd', 'intel', 'swrast'] 254 elif ['arm', 'aarch64'].contains(host_machine.cpu_family()) 255 _vulkan_drivers = ['swrast'] 256 elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family()) 257 _vulkan_drivers = ['amd', 'swrast'] 258 else 259 error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format( 260 host_machine.cpu_family())) 261 endif 262 elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system()) 263 # No vulkan driver supports windows or macOS currently 264 _vulkan_drivers = [] 265 else 266 error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format( 267 host_machine.system())) 268 endif 269endif 270 271with_intel_vk = _vulkan_drivers.contains('intel') 272with_amd_vk = _vulkan_drivers.contains('amd') 273with_freedreno_vk = _vulkan_drivers.contains('freedreno') 274with_panfrost_vk = _vulkan_drivers.contains('panfrost') 275with_swrast_vk = _vulkan_drivers.contains('swrast') 276with_virtio_vk = _vulkan_drivers.contains('virtio-experimental') 277with_freedreno_kgsl = get_option('freedreno-kgsl') 278with_freedreno_virtio = get_option('freedreno-virtio') 279with_broadcom_vk = _vulkan_drivers.contains('broadcom') 280with_imagination_vk = _vulkan_drivers.contains('imagination-experimental') 281with_imagination_srv = get_option('imagination-srv') 282with_microsoft_vk = _vulkan_drivers.contains('microsoft-experimental') 283with_any_vk = _vulkan_drivers.length() != 0 284 285with_any_broadcom = with_gallium_vc4 or with_gallium_v3d or with_broadcom_vk 286with_any_intel = with_intel_vk or with_gallium_iris or with_gallium_crocus or with_intel_tools 287 288if with_swrast_vk and not with_gallium_softpipe 289 error('swrast vulkan requires gallium swrast') 290endif 291if with_gallium_tegra and not with_gallium_nouveau 292 error('tegra driver requires nouveau driver') 293endif 294if with_aco_tests and not with_amd_vk 295 error('ACO tests require Radv') 296endif 297 298with_microsoft_clc = get_option('microsoft-clc').enabled() 299with_intel_clc = get_option('intel-clc').enabled() 300with_clc = with_microsoft_clc or with_intel_clc 301with_libclc = with_clc 302with_spirv_to_dxil = get_option('spirv-to-dxil') 303 304if host_machine.system() == 'darwin' 305 with_dri_platform = 'apple' 306 pre_args += '-DBUILDING_MESA' 307elif ['windows', 'cygwin'].contains(host_machine.system()) 308 with_dri_platform = 'windows' 309elif system_has_kms_drm 310 with_dri_platform = 'drm' 311else 312 # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should 313 # assert here that one of those cases has been met. 314 # FIXME: illumos ends up here as well 315 with_dri_platform = 'none' 316endif 317 318with_vulkan_beta = get_option('vulkan-beta') 319if with_vulkan_beta 320 pre_args += '-DVK_ENABLE_BETA_EXTENSIONS' 321endif 322 323_codecs = get_option('video-codecs') 324foreach c : ['vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc'] 325 pre_args += '-DVIDEO_CODEC_@0@=@1@'.format(c.to_upper(), _codecs.contains(c).to_int()) 326endforeach 327 328_platforms = get_option('platforms') 329if _platforms.contains('auto') 330 if system_has_kms_drm 331 _platforms = ['x11', 'wayland'] 332 elif ['darwin', 'cygwin'].contains(host_machine.system()) 333 _platforms = ['x11'] 334 elif ['haiku'].contains(host_machine.system()) 335 _platforms = ['haiku'] 336 elif host_machine.system() == 'windows' 337 _platforms = ['windows'] 338 else 339 error('Unknown OS @0@. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.'.format( 340 host_machine.system())) 341 endif 342endif 343 344with_platform_android = _platforms.contains('android') 345with_platform_x11 = _platforms.contains('x11') 346with_platform_wayland = _platforms.contains('wayland') 347with_platform_haiku = _platforms.contains('haiku') 348with_platform_windows = _platforms.contains('windows') 349with_platform_ohos = _platforms.contains('ohos') 350 351with_glx = get_option('glx') 352if with_glx == 'auto' 353 if with_platform_android or with_platform_ohos 354 with_glx = 'disabled' 355 elif with_dri 356 with_glx = 'dri' 357 elif with_platform_haiku 358 with_glx = 'disabled' 359 elif host_machine.system() == 'windows' 360 with_glx = 'disabled' 361 elif with_gallium 362 # Even when building just gallium drivers the user probably wants dri 363 with_glx = 'dri' 364 elif with_platform_x11 and with_any_opengl and not with_any_vk 365 # The automatic behavior should not be to turn on xlib based glx when 366 # building only vulkan drivers 367 with_glx = 'xlib' 368 else 369 with_glx = 'disabled' 370 endif 371endif 372if with_glx == 'dri' 373 if with_gallium 374 with_dri = true 375 endif 376endif 377 378if not (with_dri or with_gallium or with_glx != 'disabled') 379 with_gles1 = false 380 with_gles2 = false 381 with_opengl = false 382 with_any_opengl = false 383 with_shared_glapi = false 384endif 385 386_gbm = get_option('gbm') 387if _gbm == 'true' 388 _gbm = 'enabled' 389 warning('gbm option "true" deprecated, please use "enabled" instead.') 390elif _gbm == 'false' 391 _gbm = 'disabled' 392 warning('gbm option "false" deprecated, please use "disabled" instead.') 393endif 394if _gbm == 'auto' 395 with_gbm = system_has_kms_drm and with_dri 396else 397 with_gbm = _gbm == 'enabled' 398endif 399if with_gbm and not system_has_kms_drm 400 error('GBM only supports DRM/KMS platforms') 401endif 402 403_xlib_lease = get_option('xlib-lease') 404if _xlib_lease == 'true' 405 _xlib_lease = 'enabled' 406 warning('xlib_lease option "true" deprecated, please use "enabled" instead.') 407elif _xlib_lease == 'false' 408 _xlib_lease = 'disabled' 409 warning('xlib_lease option "false" deprecated, please use "disabled" instead.') 410endif 411if _xlib_lease == 'auto' 412 with_xlib_lease = with_platform_x11 and system_has_kms_drm 413else 414 with_xlib_lease = _xlib_lease == 'enabled' 415endif 416 417if with_platform_wayland 418 c_args += '-DVK_USE_PLATFORM_WAYLAND_KHR' 419 #add this once aco and other places can build with it 420 #cpp_args += '-DVK_USE_PLATFORM_WAYLAND_KHR' 421endif 422if with_platform_x11 423 c_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR'] 424 #add this once aco and other places can build with it 425 #cpp_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR'] 426endif 427if with_platform_windows 428 c_args += '-DVK_USE_PLATFORM_WIN32_KHR' 429 #add this once aco and other places can build with it 430 #cpp_args += '-DVK_USE_PLATFORM_WIN32_KHR' 431endif 432if with_platform_android 433 c_args += '-DVK_USE_PLATFORM_ANDROID_KHR' 434 cpp_args += '-DVK_USE_PLATFORM_ANDROID_KHR' 435endif 436if with_xlib_lease 437 c_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT' 438 #add this once aco and other places can build with it 439 #cpp_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT' 440endif 441if system_has_kms_drm and not with_platform_android 442 c_args += '-DVK_USE_PLATFORM_DISPLAY_KHR' 443 cpp_args += '-DVK_USE_PLATFORM_DISPLAY_KHR' 444endif 445if host_machine.system() == 'darwin' 446 c_args += '-DVK_USE_PLATFORM_MACOS_MVK' 447 cpp_args += '-DVK_USE_PLATFORM_MACOS_MVK' 448 c_args += '-DVK_USE_PLATFORM_METAL_EXT' 449 cpp_args += '-DVK_USE_PLATFORM_METAL_EXT' 450 #macOS seems to need beta extensions to build for now: 451 c_args += '-DVK_ENABLE_BETA_EXTENSIONS' 452 cpp_args += '-DVK_ENABLE_BETA_EXTENSIONS' 453endif 454 455_egl = get_option('egl') 456if _egl == 'true' 457 _egl = 'enabled' 458 warning('egl option "true" deprecated, please use "enabled" instead.') 459elif _egl == 'false' 460 _egl = 'disabled' 461 warning('egl option "false" deprecated, please use "disabled" instead.') 462endif 463if _egl == 'auto' 464 with_egl = ( 465 host_machine.system() != 'darwin' and 466 (with_platform_windows or with_dri) and 467 with_shared_glapi 468 ) 469elif _egl == 'enabled' 470 if not with_dri and not with_platform_haiku and not with_platform_windows 471 error('EGL requires dri, haiku, or windows') 472 elif not with_shared_glapi 473 error('EGL requires shared-glapi') 474 elif not ['disabled', 'dri'].contains(with_glx) 475 error('EGL requires dri, but a GLX is being built without dri') 476 elif host_machine.system() == 'darwin' 477 error('EGL is not available on MacOS') 478 endif 479 with_egl = true 480else 481 with_egl = false 482endif 483 484if with_egl 485 _platforms += 'surfaceless' 486 if with_gbm and not with_platform_android and not with_platform_ohos 487 _platforms += 'drm' 488 endif 489 490 egl_native_platform = get_option('egl-native-platform') 491 if egl_native_platform.contains('auto') 492 egl_native_platform = _platforms[0] 493 endif 494endif 495 496if with_egl and not _platforms.contains(egl_native_platform) 497 error('-Degl-native-platform does not specify an enabled platform') 498endif 499 500if 'x11' in _platforms 501 _platforms += 'xcb' 502endif 503 504foreach platform : _platforms 505 pre_args += '-DHAVE_@0@_PLATFORM'.format(platform.to_upper()) 506endforeach 507 508if with_platform_android and get_option('platform-sdk-version') >= 29 509 # By default the NDK compiler, at least, emits emutls references instead of 510 # ELF TLS, even when building targeting newer API levels. Make it actually do 511 # ELF TLS instead. 512 c_args += '-fno-emulated-tls' 513 cpp_args += '-fno-emulated-tls' 514endif 515 516# -mtls-dialect=gnu2 speeds up non-initial-exec TLS significantly but requires 517# full toolchain (including libc) support. 518have_mtls_dialect = false 519foreach c_arg : get_option('c_args') 520 if c_arg.startswith('-mtls-dialect=') 521 have_mtls_dialect = true 522 break 523 endif 524endforeach 525if not have_mtls_dialect 526 # need .run to check libc support. meson aborts when calling .run when 527 # cross-compiling, but because this is just an optimization we can skip it 528 if meson.is_cross_build() and not meson.has_exe_wrapper() 529 warning('cannot auto-detect -mtls-dialect when cross-compiling, using compiler default') 530 else 531 # -fpic to force dynamic tls, otherwise TLS relaxation defeats check 532 gnu2_test = cc.run('int __thread x; int main() { return x; }', 533 args: ['-mtls-dialect=gnu2', '-fpic'], 534 name: '-mtls-dialect=gnu2') 535 if gnu2_test.returncode() == 0 and ( 536 # check for lld 13 bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5665 537 host_machine.cpu_family() != 'x86_64' or 538 # get_linker_id misses LDFLAGS=-fuse-ld=lld: https://github.com/mesonbuild/meson/issues/6377 539 #cc.get_linker_id() != 'ld.lld' or 540 cc.links('''int __thread x; int y; int main() { __asm__( 541 "leaq x@TLSDESC(%rip), %rax\n" 542 "movq y@GOTPCREL(%rip), %rdx\n" 543 "call *x@TLSCALL(%rax)\n"); }''', name: 'split TLSDESC') 544 ) 545 c_args += '-mtls-dialect=gnu2' 546 cpp_args += '-mtls-dialect=gnu2' 547 endif 548 endif 549endif 550 551if with_glx != 'disabled' 552 if not (with_platform_x11 and with_any_opengl) 553 error('Cannot build GLX support without X11 platform support and at least one OpenGL API') 554 elif with_glx == 'xlib' 555 if not with_gallium 556 error('xlib based GLX requires at least one gallium driver') 557 elif not with_gallium_softpipe 558 error('xlib based GLX requires softpipe or llvmpipe.') 559 elif with_dri 560 error('xlib conflicts with any dri driver') 561 endif 562 elif with_glx == 'dri' 563 if not with_shared_glapi 564 error('dri based GLX requires shared-glapi') 565 endif 566 endif 567endif 568 569with_glvnd = get_option('glvnd') 570glvnd_vendor_name = get_option('glvnd-vendor-name') 571if with_glvnd 572 if with_platform_windows 573 error('glvnd cannot be used on Windows') 574 elif with_glx == 'xlib' 575 error('Cannot build glvnd support for GLX that is not DRI based.') 576 elif with_glx == 'disabled' and not with_egl 577 error('glvnd requires DRI based GLX and/or EGL') 578 endif 579 if get_option('egl-lib-suffix') != '' 580 error('''EGL lib suffix can't be used with libglvnd''') 581 endif 582endif 583 584if with_vulkan_icd_dir == '' 585 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d') 586endif 587 588# GNU/Hurd includes egl_dri2, without drm. 589with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or 590 host_machine.system() == 'gnu') 591_dri3 = get_option('dri3') 592if _dri3 == 'true' 593 _dri3 = 'enabled' 594 warning('dri3 option "true" deprecated, please use "enabled" instead.') 595elif _dri3 == 'false' 596 _dri3 = 'disabled' 597 warning('dri3 option "false" deprecated, please use "disabled" instead.') 598endif 599if _dri3 == 'auto' 600 with_dri3 = system_has_kms_drm and with_dri2 601else 602 with_dri3 = _dri3 == 'enabled' 603endif 604 605if with_any_vk and (with_platform_x11 and not with_dri3) 606 error('Vulkan drivers require dri3 for X11 support') 607endif 608if with_dri 609 if with_glx == 'disabled' and not with_egl and not with_gbm 610 error('building dri drivers require at least one windowing system') 611 endif 612endif 613 614if with_gallium_kmsro and (with_platform_x11 and not with_dri3) 615 error('kmsro requires dri3 for X11 support') 616endif 617 618dep_dxheaders = null_dep 619if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk 620 dep_dxheaders = dependency('directx-headers', required : false) 621 if not dep_dxheaders.found() 622 dep_dxheaders = dependency('DirectX-Headers', 623 version : '>= 1.602.0', 624 fallback : ['DirectX-Headers', 'dep_dxheaders'], 625 required : with_gallium_d3d12 or with_microsoft_vk 626 ) 627 endif 628endif 629 630_with_gallium_d3d12_video = get_option('gallium-d3d12-video') 631with_gallium_d3d12_video = false 632if with_gallium_d3d12 and not _with_gallium_d3d12_video.disabled() 633 with_gallium_d3d12_video = true 634 pre_args += '-DHAVE_GALLIUM_D3D12_VIDEO' 635endif 636 637_vdpau = get_option('gallium-vdpau') 638if _vdpau == 'true' 639 _vdpau = 'enabled' 640 warning('gallium-vdpau option "true" deprecated, please use "enabled" instead.') 641elif _vdpau == 'false' 642 _vdpau = 'disabled' 643 warning('gallium-vdpau option "false" deprecated, please use "disabled" instead.') 644endif 645if not system_has_kms_drm 646 if _vdpau == 'enabled' 647 error('VDPAU state tracker can only be build on unix-like OSes.') 648 else 649 _vdpau = 'disabled' 650 endif 651elif not with_platform_x11 652 if _vdpau == 'enabled' 653 error('VDPAU state tracker requires X11 support.') 654 else 655 _vdpau = 'disabled' 656 endif 657elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or 658 with_gallium_nouveau or with_gallium_d3d12_video) 659 if _vdpau == 'enabled' 660 error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video).') 661 else 662 _vdpau = 'disabled' 663 endif 664endif 665dep_vdpau = null_dep 666with_gallium_vdpau = false 667if _vdpau != 'disabled' 668 dep_vdpau = dependency('vdpau', version : '>= 1.1', required : _vdpau == 'enabled') 669 if dep_vdpau.found() 670 dep_vdpau = dep_vdpau.partial_dependency(compile_args : true) 671 with_gallium_vdpau = true 672 endif 673endif 674 675if with_gallium_vdpau 676 pre_args += '-DHAVE_ST_VDPAU' 677endif 678vdpau_drivers_path = get_option('vdpau-libs-path') 679if vdpau_drivers_path == '' 680 vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau') 681endif 682 683if with_vulkan_overlay_layer or with_aco_tests or with_amd_vk 684 prog_glslang = find_program('glslangValidator') 685 if run_command(prog_glslang, [ '--quiet', '--version' ], check : false).returncode() == 0 686 glslang_quiet = ['--quiet'] 687 else 688 glslang_quiet = [] 689 endif 690endif 691 692_xvmc = get_option('gallium-xvmc') 693if _xvmc == 'true' 694 _xvmc = 'enabled' 695 warning('gallium-xvmc option "true" deprecated, please use "enabled" instead.') 696elif _xvmc == 'false' 697 _xvmc = 'disabled' 698 warning('gallium-xvmc option "false" deprecated, please use "disabled" instead.') 699endif 700if not system_has_kms_drm 701 if _xvmc == 'enabled' 702 error('XVMC state tracker can only be build on unix-like OSes.') 703 else 704 _xvmc = 'disabled' 705 endif 706elif not with_platform_x11 707 if _xvmc == 'enabled' 708 error('XVMC state tracker requires X11 support.') 709 else 710 _xvmc = 'disabled' 711 endif 712elif not (with_gallium_r600 or with_gallium_nouveau) 713 if _xvmc == 'enabled' 714 error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.') 715 else 716 _xvmc = 'disabled' 717 endif 718endif 719dep_xvmc = null_dep 720dep_xv = null_dep 721with_gallium_xvmc = false 722if _xvmc != 'disabled' 723 dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'enabled') 724 dep_xv = dependency('xv', required : _xvmc == 'enabled') 725 with_gallium_xvmc = dep_xvmc.found() and dep_xv.found() 726endif 727 728xvmc_drivers_path = get_option('xvmc-libs-path') 729if xvmc_drivers_path == '' 730 xvmc_drivers_path = get_option('libdir') 731endif 732 733_omx = get_option('gallium-omx') 734if not system_has_kms_drm 735 if ['auto', 'disabled'].contains(_omx) 736 _omx = 'disabled' 737 else 738 error('OMX state tracker can only be built on unix-like OSes.') 739 endif 740elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau) 741 if ['auto', 'disabled'].contains(_omx) 742 _omx = 'disabled' 743 else 744 error('OMX state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.') 745 endif 746endif 747with_gallium_omx = _omx 748dep_omx = null_dep 749dep_omx_other = [] 750if ['auto', 'bellagio'].contains(_omx) 751 dep_omx = dependency( 752 'libomxil-bellagio', required : _omx == 'bellagio' 753 ) 754 if dep_omx.found() 755 with_gallium_omx = 'bellagio' 756 endif 757endif 758if ['auto', 'tizonia'].contains(_omx) 759 if with_dri and with_egl 760 dep_omx = dependency( 761 'libtizonia', version : '>= 0.10.0', 762 required : _omx == 'tizonia', 763 ) 764 dep_omx_other = [ 765 dependency('libtizplatform', required : _omx == 'tizonia'), 766 dependency('tizilheaders', required : _omx == 'tizonia'), 767 ] 768 if dep_omx.found() and dep_omx_other[0].found() and dep_omx_other[1].found() 769 with_gallium_omx = 'tizonia' 770 endif 771 elif _omx == 'tizonia' 772 error('OMX-Tizonia state tracker requires dri and egl') 773 endif 774endif 775if _omx == 'auto' 776 with_gallium_omx = 'disabled' 777else 778 with_gallium_omx = _omx 779endif 780 781pre_args += [ 782 '-DENABLE_ST_OMX_BELLAGIO=' + (with_gallium_omx == 'bellagio' ? '1' : '0'), 783 '-DENABLE_ST_OMX_TIZONIA=' + (with_gallium_omx == 'tizonia' ? '1' : '0'), 784] 785 786 787omx_drivers_path = get_option('omx-libs-path') 788 789if with_gallium_omx != 'disabled' 790 # Figure out where to put the omx driver. 791 # FIXME: this could all be vastly simplified by adding a 'defined_variable' 792 # argument to meson's get_variable method. 793 if omx_drivers_path == '' 794 _omx_libdir = dep_omx.get_variable(pkgconfig : 'libdir') 795 _omx_drivers_dir = dep_omx.get_variable(pkgconfig : 'pluginsdir') 796 if _omx_libdir == get_option('libdir') 797 omx_drivers_path = _omx_drivers_dir 798 else 799 _omx_base_dir = [] 800 # This will fail on windows. Does OMX run on windows? 801 _omx_libdir = _omx_libdir.split('/') 802 _omx_drivers_dir = _omx_drivers_dir.split('/') 803 foreach o : _omx_drivers_dir 804 if not _omx_libdir.contains(o) 805 _omx_base_dir += o 806 endif 807 endforeach 808 omx_drivers_path = join_paths(get_option('libdir'), _omx_base_dir) 809 endif 810 endif 811endif 812 813_va = get_option('gallium-va') 814if _va == 'true' 815 _va = 'enabled' 816 warning('gallium-va option "true" deprecated, please use "enabled" instead.') 817elif _va == 'false' 818 _va = 'disabled' 819 warning('gallium-va option "false" deprecated, please use "disabled" instead.') 820endif 821if not system_has_kms_drm 822 if _va == 'enabled' 823 error('VA state tracker can only be built on unix-like OSes.') 824 else 825 _va = 'disabled' 826 endif 827elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau or with_gallium_d3d12_video) 828 if _va == 'enabled' 829 error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video).') 830 else 831 _va = 'disabled' 832 endif 833endif 834with_gallium_va = false 835dep_va = null_dep 836if _va != 'disabled' 837 dep_va = dependency('libva', version : '>= 1.8.0', required : _va == 'enabled') 838 if dep_va.found() 839 dep_va_headers = dep_va.partial_dependency(compile_args : true) 840 with_gallium_va = true 841 if cc.has_header_symbol('va/va.h', 'VASurfaceAttribDRMFormatModifiers', 842 dependencies: dep_va_headers) 843 pre_args += '-DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS' 844 endif 845 endif 846endif 847 848va_drivers_path = get_option('va-libs-path') 849if va_drivers_path == '' 850 va_drivers_path = join_paths(get_option('libdir'), 'dri') 851endif 852 853_xa = get_option('gallium-xa') 854if _xa == 'true' 855 _xa = 'enabled' 856 warning('gallium-xa option "true" deprecated, please use "enabled" instead.') 857elif _xa == 'false' 858 _xa = 'disabled' 859 warning('gallium-xa option "false" deprecated, please use "disabled" instead.') 860endif 861if not system_has_kms_drm 862 if _xa == 'enabled' 863 error('XA state tracker can only be built on unix-like OSes.') 864 else 865 _xa = 'disabled' 866 endif 867elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915 868 or with_gallium_svga) 869 if _xa == 'enabled' 870 error('XA state tracker requires at least one of the following gallium drivers: nouveau, freedreno, i915, svga.') 871 else 872 _xa = 'disabled' 873 endif 874endif 875with_gallium_xa = _xa != 'disabled' 876 877d3d_drivers_path = get_option('d3d-drivers-path') 878if d3d_drivers_path == '' 879 d3d_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'd3d') 880endif 881 882with_gallium_st_nine = get_option('gallium-nine') 883if with_gallium_st_nine 884 if not with_gallium_softpipe 885 error('The nine state tracker requires gallium softpipe/llvmpipe.') 886 elif not (with_gallium_radeonsi or with_gallium_nouveau or with_gallium_r600 887 or with_gallium_r300 or with_gallium_svga or with_gallium_i915 888 or with_gallium_iris or with_gallium_crocus or with_gallium_zink) 889 error('The nine state tracker requires at least one non-swrast gallium driver.') 890 endif 891 if not with_dri3 892 error('Using nine with wine requires dri3') 893 endif 894endif 895with_gallium_st_d3d10umd = get_option('gallium-d3d10umd') 896if with_gallium_st_d3d10umd 897 if not with_gallium_softpipe 898 error('The d3d10umd state tracker requires gallium softpipe/llvmpipe.') 899 endif 900endif 901_power8 = get_option('power8') 902if _power8 == 'true' 903 _power8 = 'enabled' 904 warning('power8 option "true" deprecated, please use "enabled" instead.') 905elif _power8 == 'false' 906 _power8 = 'disabled' 907 warning('power8 option "false" deprecated, please use "disabled" instead.') 908endif 909if _power8 != 'disabled' 910 if host_machine.cpu_family() == 'ppc64' and host_machine.endian() == 'little' 911 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8') 912 error('Altivec is not supported with gcc version < 4.8.') 913 endif 914 if cc.compiles(''' 915 #include <altivec.h> 916 int main() { 917 vector unsigned char r; 918 vector unsigned int v = vec_splat_u32 (1); 919 r = __builtin_vec_vgbbd ((vector unsigned char) v); 920 return 0; 921 }''', 922 args : '-mpower8-vector', 923 name : 'POWER8 intrinsics') 924 pre_args += ['-D_ARCH_PWR8', '-mpower8-vector'] 925 elif get_option('power8') == 'enabled' 926 error('POWER8 intrinsic support required but not found.') 927 endif 928 endif 929endif 930 931if get_option('vmware-mks-stats') 932 if not with_gallium_svga 933 error('vmware-mks-stats requires gallium VMware/svga driver.') 934 endif 935 pre_args += '-DVMX86_STATS=1' 936endif 937 938_opencl = get_option('gallium-opencl') 939_rtti = get_option('cpp_rtti') 940if _opencl != 'disabled' 941 if not with_gallium 942 error('OpenCL Clover implementation requires at least one gallium driver.') 943 endif 944 if not _rtti 945 error('The Clover OpenCL state tracker requires rtti') 946 endif 947 948 with_libclc = true 949 with_gallium_opencl = true 950 with_opencl_icd = _opencl == 'icd' 951else 952 with_gallium_opencl = false 953 with_opencl_icd = false 954endif 955 956dep_clc = null_dep 957if with_libclc 958 dep_clc = dependency('libclc') 959endif 960 961gl_pkgconfig_c_flags = [] 962if with_platform_x11 963 if with_glx == 'xlib' or with_glx == 'gallium-xlib' 964 pre_args += '-DUSE_XSHM' 965 else 966 pre_args += '-DGLX_INDIRECT_RENDERING' 967 if with_glx_direct 968 pre_args += '-DGLX_DIRECT_RENDERING' 969 endif 970 if with_dri_platform == 'drm' 971 pre_args += '-DGLX_USE_DRM' 972 elif with_dri_platform == 'apple' 973 pre_args += '-DGLX_USE_APPLEGL' 974 elif with_dri_platform == 'windows' 975 pre_args += '-DGLX_USE_WINDOWSGL' 976 endif 977 endif 978else 979 pre_args += '-DEGL_NO_X11' 980 gl_pkgconfig_c_flags += '-DEGL_NO_X11' 981endif 982 983with_android_stub = get_option('android-stub') 984if with_android_stub and not with_platform_android 985 error('`-D android-stub=true` makes no sense without `-D platforms=android`') 986endif 987 988if with_platform_android 989 dep_android_mapper4 = null_dep 990 if not with_android_stub 991 dep_android = [ 992 dependency('cutils'), 993 dependency('hardware'), 994 dependency('sync'), 995 dependency('backtrace') 996 ] 997 if get_option('platform-sdk-version') >= 26 998 dep_android += dependency('nativewindow') 999 endif 1000 if get_option('platform-sdk-version') >= 30 1001 dep_android_mapper4 = dependency('android.hardware.graphics.mapper', version : '>= 4.0', required : false) 1002 endif 1003 endif 1004 pre_args += [ 1005 '-DANDROID', 1006 '-DANDROID_API_LEVEL=' + get_option('platform-sdk-version').to_string() 1007 ] 1008endif 1009 1010if with_platform_ohos 1011 pre_args += '-DHAVE_OHOS_PLATFORM' 1012 dep_ohos = [ 1013 dependency('libsurface'), 1014 dependency('libhilog'), 1015 ] 1016 c_args += '-I../ohos' 1017endif 1018 1019#prog_python = import('python').find_installation('python3') 1020prog_python = '/usr/bin/python3' 1021 1022has_mako = run_command( 1023 prog_python, '-c', 1024 ''' 1025from distutils.version import StrictVersion 1026import mako 1027assert StrictVersion(mako.__version__) > StrictVersion("0.8.0") 1028 ''', check: false) 1029if has_mako.returncode() != 0 1030 error('Python (3.x) mako module >= 0.8.0 required to build mesa.') 1031endif 1032 1033if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6') 1034 error('When using GCC, version 4.4.6 or later is required.') 1035endif 1036 1037# Support systems without ETIME (e.g. FreeBSD) 1038if cc.get_define('ETIME', prefix : '#include <errno.h>') == '' 1039 pre_args += '-DETIME=ETIMEDOUT' 1040endif 1041 1042# Define DEBUG for debug builds only (debugoptimized is not included on this one) 1043if get_option('buildtype') == 'debug' 1044 pre_args += '-DDEBUG' 1045endif 1046 1047with_shader_cache = false 1048_shader_cache = get_option('shader-cache') 1049if _shader_cache == 'true' 1050 _shader_cache = 'enabled' 1051 warning('shader_cache option "true" deprecated, please use "enabled" instead.') 1052elif _shader_cache == 'false' 1053 _shader_cache = 'disabled' 1054 warning('shader_cache option "false" deprecated, please use "disabled" instead.') 1055endif 1056if _shader_cache != 'disabled' 1057 if host_machine.system() == 'windows' 1058 if _shader_cache == 'enabled' 1059 error('Shader Cache does not currently work on Windows') 1060 endif 1061 else 1062 pre_args += '-DENABLE_SHADER_CACHE' 1063 if not get_option('shader-cache-default') 1064 pre_args += '-DSHADER_CACHE_DISABLE_BY_DEFAULT' 1065 endif 1066 with_shader_cache = true 1067 endif 1068endif 1069 1070if with_shader_cache 1071 shader_cache_max_size = get_option('shader-cache-max-size') 1072 if shader_cache_max_size != '' 1073 pre_args += '-DMESA_SHADER_CACHE_MAX_SIZE="@0@"'.format(shader_cache_max_size) 1074 endif 1075endif 1076 1077# Check for GCC style builtins 1078foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs', 1079 'ffsll', 'popcount', 'popcountll', 'unreachable', 'types_compatible_p'] 1080 if cc.has_function(b) 1081 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper()) 1082 endif 1083endforeach 1084 1085# check for GCC __attribute__ 1086_attributes = [ 1087 'const', 'flatten', 'malloc', 'pure', 'unused', 'warn_unused_result', 1088 'weak', 'format', 'packed', 'returns_nonnull', 'alias', 'noreturn', 1089] 1090foreach a : cc.get_supported_function_attributes(_attributes) 1091 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper()) 1092endforeach 1093if cc.has_function_attribute('visibility:hidden') 1094 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY' 1095endif 1096if cc.compiles('__uint128_t foo(void) { return 0; }', 1097 name : '__uint128_t') 1098 pre_args += '-DHAVE_UINT128' 1099endif 1100 1101if cc.has_function('reallocarray') 1102 pre_args += '-DHAVE_REALLOCARRAY' 1103endif 1104 1105# TODO: this is very incomplete 1106if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku', 'android'].contains(host_machine.system()) 1107 pre_args += '-D_GNU_SOURCE' 1108elif host_machine.system() == 'sunos' 1109 pre_args += '-D__EXTENSIONS__' 1110elif host_machine.system() == 'windows' 1111 pre_args += [ 1112 '-D_WINDOWS', '-D_WIN32_WINNT=0x0A00', '-DWINVER=0x0A00', 1113 '-DPIPE_SUBSYSTEM_WINDOWS_USER', 1114 '-D_USE_MATH_DEFINES', # XXX: scons didn't use this for mingw 1115 ] 1116 if cc.get_argument_syntax() == 'msvc' 1117 pre_args += [ 1118 '-DVC_EXTRALEAN', 1119 '-D_CRT_SECURE_NO_WARNINGS', 1120 '-D_CRT_SECURE_NO_DEPRECATE', 1121 '-D_SCL_SECURE_NO_WARNINGS', 1122 '-D_SCL_SECURE_NO_DEPRECATE', 1123 '-D_ALLOW_KEYWORD_MACROS', 1124 '-D_HAS_EXCEPTIONS=0', # Tell C++ STL to not use exceptions 1125 '-DNOMINMAX', 1126 ] 1127 else 1128 # When the target is not mingw/ucrt 1129 # NOTE: clang's stddef.h are conflict with mingw/ucrt's stddef.h 1130 # So do not include headers that defined in clang for detecting 1131 # _UCRT 1132 if cc.compiles(''' 1133 #include <string.h> 1134 #if defined(__MINGW32__) && defined(_UCRT) 1135 #error 1136 #endif 1137 int main(void) { return 0; }''') 1138 pre_args += ['-D__MSVCRT_VERSION__=0x0700'] 1139 endif 1140 endif 1141elif host_machine.system() == 'openbsd' 1142 pre_args += '-D_ISOC11_SOURCE' 1143endif 1144 1145# Check for generic C arguments 1146c_msvc_compat_args = [] 1147no_override_init_args = [] 1148cpp_msvc_compat_args = [] 1149if cc.get_argument_syntax() == 'msvc' 1150 _trial = [ 1151 '/wd4018', # signed/unsigned mismatch 1152 '/wd4056', # overflow in floating-point constant arithmetic 1153 '/wd4244', # conversion from 'type1' to 'type2', possible loss of data 1154 '/wd4267', # 'var' : conversion from 'size_t' to 'type', possible loss of data 1155 '/wd4305', # trancation from 'type1' to 'type2' 1156 '/wd4351', # new behavior: elements of array 'array' will be default initialized 1157 '/wd4756', # overflow in constant arithmetic 1158 '/wd4800', # forcing value to bool 'true' or 'false' (performance warning) 1159 '/wd4996', # disabled deprecated POSIX name warnings 1160 '/wd4291', # no matching operator delete found 1161 '/wd4146', # unary minus operator applied to unsigned type, result still unsigned 1162 '/wd4200', # nonstandard extension used: zero-sized array in struct/union 1163 '/wd4624', # destructor was implicitly defined as deleted [from LLVM] 1164 '/wd4309', # 'initializing': truncation of constant value 1165 '/wd4838', # conversion from 'int' to 'const char' requires a narrowing conversion 1166 '/wd5105', # macro expansion producing 'defined' has undefined behavior (winbase.h, need Windows SDK upgrade) 1167 '/we4020', # Error when passing the wrong number of parameters 1168 '/we4024', # Error when passing different type of parameter 1169 '/Zc:__cplusplus', #Set __cplusplus macro to match the /std:c++<version> on the command line 1170 ] 1171 c_args += cc.get_supported_arguments(_trial) 1172 cpp_args += cpp.get_supported_arguments(_trial) 1173else 1174 _trial_c = [ 1175 '-Werror=implicit-function-declaration', 1176 '-Werror=missing-prototypes', 1177 '-Werror=return-type', 1178 '-Werror=empty-body', 1179 '-Werror=incompatible-pointer-types', 1180 '-Werror=int-conversion', 1181 '-Wimplicit-fallthrough', 1182 '-Wno-missing-field-initializers', 1183 '-Wno-format-truncation', 1184 '-fno-math-errno', 1185 '-fno-trapping-math', 1186 '-Qunused-arguments', 1187 '-fno-common', 1188 # Clang 1189 '-Wno-microsoft-enum-value', 1190 '-Wno-unused-function', 1191 ] 1192 _trial_cpp = [ 1193 '-Werror=return-type', 1194 '-Werror=empty-body', 1195 '-Wno-non-virtual-dtor', 1196 '-Wno-missing-field-initializers', 1197 '-Wno-format-truncation', 1198 '-fno-math-errno', 1199 '-fno-trapping-math', 1200 '-Qunused-arguments', 1201 # Some classes use custom new operator which zeroes memory, however 1202 # gcc does aggressive dead-store elimination which threats all writes 1203 # to the memory before the constructor as "dead stores". 1204 # For now we disable this optimization. 1205 '-flifetime-dse=1', 1206 # Clang 1207 '-Wno-microsoft-enum-value', 1208 ] 1209 1210 # MinGW chokes on format specifiers and I can't get it all working 1211 if not (cc.get_argument_syntax() == 'gcc' and host_machine.system() == 'windows') 1212 _trial_c += ['-Werror=format', '-Wformat-security'] 1213 _trial_cpp += ['-Werror=format', '-Wformat-security'] 1214 endif 1215 1216 # FreeBSD annotated <pthread.h> but Mesa isn't ready 1217 if not (cc.get_id() == 'clang' and host_machine.system() == 'freebsd') 1218 _trial_c += ['-Werror=thread-safety'] 1219 endif 1220 1221 # If the compiler supports it, put function and data symbols in their 1222 # own sections and GC the sections after linking. This lets drivers 1223 # drop shared code unused by that specific driver (particularly 1224 # relevant for Vulkan drivers). 1225 if cc.has_link_argument('-Wl,--gc-sections') 1226 _trial_c += ['-ffunction-sections', '-fdata-sections'] 1227 _trial_cpp += ['-ffunction-sections', '-fdata-sections'] 1228 endif 1229 1230 # Variables that are only used for assertions are considered unused in release 1231 # builds. Don't treat this as an error, since we build with -Werror even for 1232 # release in CI. 1233 if get_option('buildtype') == 'release' 1234 _trial_c += ['-Wno-unused-variable', '-Wno-unused-but-set-variable'] 1235 _trial_cpp += ['-Wno-unused-variable', '-Wno-unused-but-set-variable'] 1236 endif 1237 1238 c_args += cc.get_supported_arguments(_trial_c) 1239 cpp_args += cpp.get_supported_arguments(_trial_cpp) 1240 1241 no_override_init_args += cc.get_supported_arguments( 1242 ['-Wno-override-init', '-Wno-initializer-overrides'] 1243 ) 1244 1245 # Check for C and C++ arguments for MSVC compatibility. These are only used 1246 # in parts of the mesa code base that need to compile with MSVC, mainly 1247 # common code 1248 _trial_msvc = ['-Werror=pointer-arith', '-Werror=vla', '-Werror=gnu-empty-initializer'] 1249 c_msvc_compat_args += cc.get_supported_arguments(_trial_msvc) 1250 cpp_msvc_compat_args += cpp.get_supported_arguments(_trial_msvc) 1251endif 1252 1253# set linker arguments 1254if host_machine.system() == 'windows' 1255 if cc.get_argument_syntax() == 'msvc' 1256 add_project_link_arguments( 1257 '/fixed:no', 1258 '/dynamicbase', 1259 '/nxcompat', 1260 language : ['c', 'cpp'], 1261 ) 1262 if get_option('buildtype') != 'debug' 1263 add_project_link_arguments( 1264 '/incremental:no', 1265 language : ['c', 'cpp'], 1266 ) 1267 endif 1268 else 1269 add_project_link_arguments( 1270 cc.get_supported_link_arguments( 1271 '-Wl,--nxcompat', 1272 '-Wl,--dynamicbase', 1273 '-static-libgcc', 1274 '-static-libstdc++', 1275 ), 1276 language : ['c'], 1277 ) 1278 add_project_link_arguments( 1279 cpp.get_supported_link_arguments( 1280 '-Wl,--nxcompat', 1281 '-Wl,--dynamicbase', 1282 '-static-libgcc', 1283 '-static-libstdc++', 1284 ), 1285 language : ['cpp'], 1286 ) 1287 endif 1288endif 1289 1290if host_machine.cpu_family().startswith('x86') and cc.get_argument_syntax() != 'msvc' 1291 pre_args += '-DUSE_SSE41' 1292 with_sse41 = true 1293 sse41_args = ['-msse4.1'] 1294 1295 if host_machine.cpu_family() == 'x86' 1296 if get_option('sse2') 1297 # These settings make generated GCC code match MSVC and follow 1298 # GCC advice on https://gcc.gnu.org/wiki/FloatingPointMath#x86note 1299 # 1300 # NOTE: We need to ensure stack is realigned given that we 1301 # produce shared objects, and have no control over the stack 1302 # alignment policy of the application. Therefore we need 1303 # -mstackrealign or -mincoming-stack-boundary=2. 1304 # 1305 # XXX: We could have SSE without -mstackrealign if we always used 1306 # __attribute__((force_align_arg_pointer)), but that's not 1307 # always the case. 1308 c_args += ['-msse2', '-mfpmath=sse', '-mstackrealign'] 1309 else 1310 # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but 1311 # that's not guaranteed 1312 sse41_args += '-mstackrealign' 1313 endif 1314 endif 1315else 1316 with_sse41 = false 1317 sse41_args = [] 1318endif 1319 1320# Check for GCC style atomics 1321dep_atomic = null_dep 1322 1323if cc.compiles('''#include <stdint.h> 1324 int main() { 1325 struct { 1326 uint64_t *v; 1327 } x; 1328 return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & 1329 (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); 1330 1331 }''', 1332 name : 'GCC atomic builtins') 1333 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' 1334 1335 # Not all atomic calls can be turned into lock-free instructions, in which 1336 # GCC will make calls into the libatomic library. Check whether we need to 1337 # link with -latomic. 1338 # 1339 # This can happen for 64-bit atomic operations on 32-bit architectures such 1340 # as ARM. 1341 if not cc.links('''#include <stdint.h> 1342 int main() { 1343 struct { 1344 uint64_t *v; 1345 } x; 1346 return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & 1347 (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); 1348 }''', 1349 name : 'GCC atomic builtins required -latomic') 1350 dep_atomic = cc.find_library('atomic') 1351 endif 1352endif 1353if not cc.links('''#include <stdint.h> 1354 uint64_t v; 1355 int main() { 1356 return __sync_add_and_fetch(&v, (uint64_t)1); 1357 }''', 1358 dependencies : dep_atomic, 1359 name : 'GCC 64bit atomics') 1360 pre_args += '-DMISSING_64BIT_ATOMICS' 1361endif 1362 1363dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows) 1364 1365# TODO: shared/static? Is this even worth doing? 1366 1367with_asm_arch = '' 1368if host_machine.cpu_family() == 'x86' 1369 if system_has_kms_drm or host_machine.system() == 'gnu' 1370 with_asm_arch = 'x86' 1371 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM', 1372 '-DUSE_SSE_ASM'] 1373 1374 if with_glx_read_only_text 1375 pre_args += ['-DGLX_X86_READONLY_TEXT'] 1376 endif 1377 endif 1378elif host_machine.cpu_family() == 'x86_64' 1379 if system_has_kms_drm 1380 with_asm_arch = 'x86_64' 1381 pre_args += ['-DUSE_X86_64_ASM'] 1382 endif 1383elif host_machine.cpu_family() == 'arm' 1384 if system_has_kms_drm 1385 with_asm_arch = 'arm' 1386 pre_args += ['-DUSE_ARM_ASM'] 1387 endif 1388elif host_machine.cpu_family() == 'aarch64' 1389 if system_has_kms_drm 1390 with_asm_arch = 'aarch64' 1391 pre_args += ['-DUSE_AARCH64_ASM'] 1392 endif 1393elif host_machine.cpu_family() == 'sparc64' 1394 if system_has_kms_drm 1395 with_asm_arch = 'sparc' 1396 pre_args += ['-DUSE_SPARC_ASM'] 1397 endif 1398elif host_machine.cpu_family() == 'ppc64' and host_machine.endian() == 'little' 1399 if system_has_kms_drm 1400 with_asm_arch = 'ppc64le' 1401 pre_args += ['-DUSE_PPC64LE_ASM'] 1402 endif 1403elif host_machine.cpu_family() == 'mips64' and host_machine.endian() == 'little' 1404 if system_has_kms_drm 1405 with_asm_arch = 'mips64el' 1406 pre_args += ['-DUSE_MIPS64EL_ASM'] 1407 endif 1408endif 1409 1410# Check for standard headers and functions 1411if (cc.has_header_symbol('sys/sysmacros.h', 'major') and 1412 cc.has_header_symbol('sys/sysmacros.h', 'minor') and 1413 cc.has_header_symbol('sys/sysmacros.h', 'makedev')) 1414 pre_args += '-DMAJOR_IN_SYSMACROS' 1415endif 1416if (cc.has_header_symbol('sys/mkdev.h', 'major') and 1417 cc.has_header_symbol('sys/mkdev.h', 'minor') and 1418 cc.has_header_symbol('sys/mkdev.h', 'makedev')) 1419 pre_args += '-DMAJOR_IN_MKDEV' 1420endif 1421 1422if cc.check_header('sched.h') 1423 pre_args += '-DHAS_SCHED_H' 1424 if cc.has_function('sched_getaffinity') 1425 pre_args += '-DHAS_SCHED_GETAFFINITY' 1426 endif 1427endif 1428 1429if not ['linux'].contains(host_machine.system()) 1430 # Deprecated on Linux and requires <sys/types.h> on FreeBSD and OpenBSD 1431 if cc.check_header('sys/sysctl.h', prefix : '#include <sys/types.h>') 1432 pre_args += '-DHAVE_SYS_SYSCTL_H' 1433 endif 1434endif 1435 1436foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h', 'cet.h', 'pthread_np.h'] 1437 if cc.check_header(h) 1438 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) 1439 endif 1440endforeach 1441 1442functions_to_detect = { 1443 'strtof': '', 1444 'mkostemp': '', 1445 'timespec_get': '#include <time.h>', 1446 'memfd_create': '', 1447 'random_r': '', 1448 'flock': '', 1449 'strtok_r': '', 1450 'getrandom': '', 1451 'qsort_r': '', 1452 'qsort_s': '', 1453} 1454 1455foreach f, prefix: functions_to_detect 1456 if cc.has_function(f, prefix: prefix) 1457 pre_args += '-DHAVE_@0@'.format(f.to_upper()) 1458 endif 1459endforeach 1460 1461if cc.has_header_symbol('time.h', 'struct timespec') 1462 pre_args += '-DHAVE_STRUCT_TIMESPEC' 1463endif 1464 1465with_c11_threads = false 1466if cc.has_function('thrd_create', prefix: '#include <threads.h>') 1467 if with_platform_android 1468 # Current only Android's c11 <threads.h> are verified 1469 pre_args += '-DHAVE_THRD_CREATE' 1470 with_c11_threads = true 1471 endif 1472endif 1473 1474if cc.has_header_symbol('errno.h', 'program_invocation_name', 1475 args : '-D_GNU_SOURCE') 1476 pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME' 1477elif with_tools.contains('intel') 1478 error('Intel tools require the program_invocation_name variable') 1479endif 1480 1481if cc.has_header_symbol('math.h', 'issignaling', 1482 args : '-D_GNU_SOURCE') 1483 pre_args += '-DHAVE_ISSIGNALING' 1484endif 1485 1486# MinGW provides a __builtin_posix_memalign function, but not a posix_memalign. 1487# This means that this check will succeed, but then compilation will later 1488# fail. MSVC doesn't have this function at all, so only check for it on 1489# non-windows platforms. 1490if host_machine.system() != 'windows' 1491 if cc.has_function('posix_memalign') 1492 pre_args += '-DHAVE_POSIX_MEMALIGN' 1493 endif 1494endif 1495 1496if cc.has_member('struct dirent', 'd_type', prefix: '''#include <sys/types.h> 1497 #include <dirent.h>''') 1498 pre_args += '-DHAVE_DIRENT_D_TYPE' 1499endif 1500 1501# strtod locale support 1502if cc.links(''' 1503 #define _GNU_SOURCE 1504 #include <stdlib.h> 1505 #include <locale.h> 1506 #ifdef HAVE_XLOCALE_H 1507 #include <xlocale.h> 1508 #endif 1509 int main() { 1510 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL); 1511 const char *s = "1.0"; 1512 char *end; 1513 double d = strtod_l(s, end, loc); 1514 float f = strtof_l(s, end, loc); 1515 freelocale(loc); 1516 return 0; 1517 }''', 1518 args : pre_args, 1519 name : 'strtod has locale support') 1520 pre_args += '-DHAVE_STRTOD_L' 1521endif 1522 1523# Check for some linker flags 1524ld_args_bsymbolic = [] 1525if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic') 1526 ld_args_bsymbolic += '-Wl,-Bsymbolic' 1527endif 1528ld_args_gc_sections = [] 1529if cc.links('static char unused() { return 5; } int main() { return 0; }', 1530 args : '-Wl,--gc-sections', name : 'gc-sections') 1531 ld_args_gc_sections += '-Wl,--gc-sections' 1532endif 1533with_ld_version_script = false 1534if cc.links('int main() { return 0; }', 1535 args : '-Wl,--version-script=@0@'.format( 1536 join_paths(meson.source_root(), 'build-support/conftest.map')), 1537 name : 'version-script') 1538 with_ld_version_script = true 1539endif 1540with_ld_dynamic_list = false 1541if cc.links('int main() { return 0; }', 1542 args : '-Wl,--dynamic-list=@0@'.format( 1543 join_paths(meson.source_root(), 'build-support/conftest.dyn')), 1544 name : 'dynamic-list') 1545 with_ld_dynamic_list = true 1546endif 1547 1548ld_args_build_id = cc.get_supported_link_arguments('-Wl,--build-id=sha1') 1549 1550# check for dl support 1551dep_dl = null_dep 1552if host_machine.system() != 'windows' 1553 if not cc.has_function('dlopen') 1554 dep_dl = cc.find_library('dl', required : true) 1555 endif 1556 if cc.has_function('dladdr', dependencies : dep_dl) 1557 # This is really only required for util/disk_cache.h 1558 pre_args += '-DHAVE_DLADDR' 1559 endif 1560endif 1561 1562if cc.has_function('dl_iterate_phdr') 1563 pre_args += '-DHAVE_DL_ITERATE_PHDR' 1564elif with_intel_vk 1565 error('Intel "Anvil" Vulkan driver requires the dl_iterate_phdr function') 1566endif 1567 1568# Determine whether or not the rt library is needed for time functions 1569if host_machine.system() == 'windows' or cc.has_function('clock_gettime') 1570 dep_clock = null_dep 1571else 1572 dep_clock = cc.find_library('rt') 1573endif 1574 1575dep_zlib = dependency('zlib', version : '>= 1.2.3', 1576 fallback : ['zlib', 'zlib_dep'], 1577 required : get_option('zlib')) 1578if dep_zlib.found() 1579 pre_args += '-DHAVE_ZLIB' 1580endif 1581 1582_zstd = get_option('zstd') 1583if _zstd == 'true' 1584 _zstd = 'enabled' 1585 warning('zstd option "true" deprecated, please use "enabled" instead.') 1586elif _zstd == 'false' 1587 _zstd = 'disabled' 1588 warning('zstd option "false" deprecated, please use "disabled" instead.') 1589endif 1590if _zstd != 'disabled' 1591 dep_zstd = dependency('libzstd', required : _zstd == 'enabled') 1592 if dep_zstd.found() 1593 pre_args += '-DHAVE_ZSTD' 1594 endif 1595else 1596 dep_zstd = null_dep 1597endif 1598 1599with_compression = dep_zlib.found() or dep_zstd.found() 1600if with_compression 1601 pre_args += '-DHAVE_COMPRESSION' 1602elif with_shader_cache 1603 error('Shader Cache requires compression') 1604endif 1605 1606dep_thread = dependency('threads') 1607if dep_thread.found() and host_machine.system() != 'windows' 1608 pre_args += '-DHAVE_PTHREAD' 1609 if host_machine.system() != 'netbsd' and cc.has_function( 1610 'pthread_setaffinity_np', 1611 dependencies : dep_thread, 1612 prefix : '#include <pthread.h>', 1613 args : '-D_GNU_SOURCE') 1614 pre_args += '-DHAVE_PTHREAD_SETAFFINITY' 1615 endif 1616endif 1617if host_machine.system() == 'darwin' 1618 dep_expat = meson.get_compiler('c').find_library('expat') 1619elif host_machine.system() != 'windows' 1620 dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'], 1621 required: not with_platform_android) 1622else 1623 dep_expat = null_dep 1624endif 1625# this only exists on linux so either this is linux and it will be found, or 1626# it's not linux and wont 1627dep_m = cc.find_library('m', required : false) 1628 1629if host_machine.system() == 'windows' 1630 dep_regex = meson.get_compiler('c').find_library('regex', required : false) 1631 if not dep_regex.found() 1632 dep_regex = declare_dependency(compile_args : ['-DNO_REGEX']) 1633 endif 1634else 1635 dep_regex = null_dep 1636endif 1637 1638if with_platform_haiku 1639 dep_network = cc.find_library('network') 1640endif 1641 1642dep_futex = null_dep 1643if host_machine.system() == 'windows' 1644 if (get_option('min-windows-version') < 8) 1645 pre_args += '-DWINDOWS_NO_FUTEX' 1646 else 1647 dep_futex = cc.find_library('synchronization', required : true) 1648 endif 1649endif 1650 1651# Check for libdrm. Various drivers have different libdrm version requirements, 1652# but we always want to use the same version for all libdrm modules. That means 1653# even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and 1654# bar are both on use 2.4.3 for both of them 1655dep_libdrm_amdgpu = null_dep 1656dep_libdrm_radeon = null_dep 1657dep_libdrm_nouveau = null_dep 1658dep_libdrm_intel = null_dep 1659 1660_drm_amdgpu_ver = '2.4.110' 1661_drm_radeon_ver = '2.4.71' 1662_drm_nouveau_ver = '2.4.102' 1663_drm_intel_ver = '2.4.75' 1664_drm_ver = '2.4.109' 1665 1666_libdrm_checks = [ 1667 ['intel', with_gallium_i915], 1668 ['amdgpu', (with_amd_vk and not with_platform_windows) or with_gallium_radeonsi], 1669 ['radeon', (with_gallium_radeonsi or with_gallium_r300 or with_gallium_r600)], 1670 ['nouveau', with_gallium_nouveau], 1671] 1672 1673# Loop over the enables versions and get the highest libdrm requirement for all 1674# active drivers. 1675_drm_blame = '' 1676foreach d : _libdrm_checks 1677 ver = get_variable('_drm_@0@_ver'.format(d[0])) 1678 if d[1] and ver.version_compare('>' + _drm_ver) 1679 _drm_ver = ver 1680 _drm_blame = d[0] 1681 endif 1682endforeach 1683if _drm_blame != '' 1684 message('libdrm @0@ needed because @1@ has the highest requirement'.format(_drm_ver, _drm_blame)) 1685endif 1686 1687# Then get each libdrm module 1688foreach d : _libdrm_checks 1689 if d[1] 1690 set_variable( 1691 'dep_libdrm_' + d[0], 1692 dependency('libdrm_' + d[0], version : '>=' + _drm_ver) 1693 ) 1694 endif 1695endforeach 1696 1697dep_hilog = dependency( 1698 'libhilog' 1699) 1700 1701with_gallium_drisw_kms = false 1702dep_libdrm = dependency( 1703 'libdrm', version : '>=' + _drm_ver, 1704 # GNU/Hurd includes egl_dri2, without drm. 1705 required : (with_dri2 and host_machine.system() != 'gnu') or with_dri3 1706) 1707if dep_libdrm.found() 1708 pre_args += '-DHAVE_LIBDRM' 1709 if with_dri_platform == 'drm' and with_dri 1710 with_gallium_drisw_kms = true 1711 endif 1712endif 1713 1714if with_dri 1715 pre_args += '-DHAVE_DRI' 1716endif 1717if with_dri2 1718 pre_args += '-DHAVE_DRI2' 1719endif 1720if with_gallium_drisw_kms 1721 pre_args += '-DHAVE_DRISW_KMS' 1722endif 1723 1724dep_libudev = dependency('libudev', required : false) 1725if dep_libudev.found() 1726 pre_args += '-DHAVE_LIBUDEV' 1727endif 1728 1729llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine'] 1730llvm_optional_modules = ['coroutines'] 1731if with_amd_vk or with_gallium_radeonsi or with_gallium_r600 1732 llvm_modules += ['amdgpu', 'bitreader', 'ipo'] 1733 if with_gallium_r600 1734 llvm_modules += 'asmparser' 1735 endif 1736endif 1737if with_gallium_opencl 1738 llvm_modules += [ 1739 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader', 1740 'lto', 'option', 'objcarcopts', 'profiledata' 1741 ] 1742 llvm_optional_modules += ['all-targets', 'frontendopenmp'] 1743endif 1744if with_clc 1745 llvm_modules += ['coverage', 'target', 'linker', 'irreader', 'option', 'libdriver', 'lto'] 1746 llvm_optional_modules += ['all-targets'] 1747endif 1748draw_with_llvm = get_option('draw-use-llvm') 1749if draw_with_llvm 1750 llvm_modules += 'native' 1751endif 1752 1753if with_amd_vk or with_gallium_radeonsi 1754 _llvm_version = '>= 11.0.0' 1755elif with_clc 1756 _llvm_version = '>= 10.0.0' 1757elif with_gallium_opencl 1758 _llvm_version = '>= 8.0.0' 1759else 1760 _llvm_version = '>= 3.9.0' 1761endif 1762 1763_shared_llvm = get_option('shared-llvm') 1764if _shared_llvm == 'true' 1765 _shared_llvm = 'enabled' 1766 warning('shared_llvm option "true" deprecated, please use "enabled" instead.') 1767elif _shared_llvm == 'false' 1768 _shared_llvm = 'disabled' 1769 warning('shared_llvm option "false" deprecated, please use "disabled" instead.') 1770endif 1771if _shared_llvm == 'auto' 1772 _shared_llvm = (host_machine.system() != 'windows') 1773else 1774 _shared_llvm = (_shared_llvm == 'enabled') 1775endif 1776_llvm = get_option('llvm') 1777if _llvm == 'true' 1778 _llvm = 'enabled' 1779 warning('llvm option "true" deprecated, please use "enabled" instead.') 1780elif _llvm == 'false' 1781 _llvm = 'disabled' 1782 warning('llvm option "false" deprecated, please use "disabled" instead.') 1783endif 1784 1785# the cmake method can only link statically, so don't attempt to use it if we 1786# want to link dynamically. Before 0.54.0 meson will try cmake even when shared 1787# linking is requested, so we need to force the config-tool method to be used 1788# in that case, but in 0.54.0 meson won't try the cmake method if shared 1789# linking is requested. 1790_llvm_method = 'auto' 1791if meson.version().version_compare('< 0.54.0') and _shared_llvm 1792 _llvm_method = 'config-tool' 1793endif 1794 1795dep_llvm = null_dep 1796with_llvm = false 1797if _llvm != 'disabled' 1798 dep_llvm = dependency( 1799 'llvm', 1800 version : _llvm_version, 1801 modules : llvm_modules, 1802 optional_modules : llvm_optional_modules, 1803 required : ( 1804 with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or with_clc 1805 or _llvm == 'enabled' 1806 ), 1807 static : not _shared_llvm, 1808 method : _llvm_method, 1809 fallback : ['llvm', 'dep_llvm'], 1810 include_type : 'system', 1811 ) 1812 with_llvm = dep_llvm.found() 1813endif 1814if with_llvm 1815 pre_args += '-DLLVM_AVAILABLE' 1816 pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version()) 1817 pre_args += '-DLLVM_IS_SHARED=@0@'.format(_shared_llvm.to_int()) 1818 1819 if draw_with_llvm 1820 pre_args += '-DDRAW_LLVM_AVAILABLE' 1821 elif with_swrast_vk 1822 error('Lavapipe requires LLVM draw support.') 1823 endif 1824 1825 if host_machine.system() != 'windows' 1826 # LLVM can be built without rtti, turning off rtti changes the ABI of C++ 1827 # programs, so we need to build all C++ code in mesa without rtti as well to 1828 # ensure that linking works. Note that Win32 compilers does handle mismatching RTTI 1829 # without issues, so only apply this for other compilers. 1830 if dep_llvm.type_name() == 'internal' 1831 _llvm_rtti = subproject('llvm').get_variable('has_rtti', true) 1832 else 1833 # The CMake finder will return 'ON', the llvm-config will return 'YES' 1834 _llvm_rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti')) 1835 endif 1836 if _rtti != _llvm_rtti 1837 if _llvm_rtti 1838 error('LLVM was built with RTTI, cannot build Mesa with RTTI disabled. Remove cpp_rtti disable switch or use LLVM built without LLVM_ENABLE_RTTI.') 1839 else 1840 error('LLVM was built without RTTI, so Mesa must also disable RTTI. Use an LLVM built with LLVM_ENABLE_RTTI or add cpp_rtti=false.') 1841 endif 1842 endif 1843 endif 1844 1845 if cc.get_argument_syntax() == 'msvc' 1846 # Suppress "/DELAYLOAD:ole32.dll/shell32.dll ignored" warnings that LLVM adds 1847 add_project_link_arguments( 1848 '/ignore:4199', 1849 language : ['c', 'cpp'], 1850 ) 1851 endif 1852elif with_amd_vk and with_aco_tests 1853 error('ACO tests require LLVM, but LLVM is disabled.') 1854elif with_gallium_radeonsi or with_swrast_vk 1855 error('The following drivers require LLVM: RadeonSI, SWR, Lavapipe. One of these is enabled, but LLVM is disabled.') 1856elif with_gallium_opencl 1857 error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.') 1858elif with_clc 1859 error('The CLC compiler requires LLVM, but LLVM is disabled.') 1860else 1861 draw_with_llvm = false 1862endif 1863 1864with_opencl_spirv = (_opencl != 'disabled' and get_option('opencl-spirv')) or with_clc 1865if with_opencl_spirv 1866 chosen_llvm_version_array = dep_llvm.version().split('.') 1867 chosen_llvm_version_major = chosen_llvm_version_array[0].to_int() 1868 chosen_llvm_version_minor = chosen_llvm_version_array[1].to_int() 1869 1870 # Require an SPIRV-LLVM-Translator version compatible with the chosen LLVM 1871 # one. 1872 _llvmspirvlib_version = [ 1873 # This first version check is still needed as maybe LLVM 8.0 was picked but 1874 # we do not want to accept SPIRV-LLVM-Translator 8.0.0.1 as that version does 1875 # not have the required API and those are only available starting from 1876 # 8.0.1.3. 1877 '>= 8.0.1.3', 1878 '>= @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor), 1879 '< @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor + 1) ] 1880 1881 dep_spirv_tools = dependency('SPIRV-Tools', required : true, version : '>= 2018.0') 1882 # LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator 1883 dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : true, version : _llvmspirvlib_version) 1884else 1885 dep_spirv_tools = null_dep 1886 dep_llvmspirvlib = null_dep 1887endif 1888 1889dep_clang = null_dep 1890if with_clc 1891 llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir') 1892 1893 dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false) 1894 1895 if not dep_clang.found() or not _shared_llvm 1896 clang_modules = [ 1897 'clangBasic', 'clangAST', 'clangCodeGen', 'clangLex', 1898 'clangDriver', 'clangFrontend', 'clangFrontendTool', 1899 'clangHandleCXX', 'clangHandleLLVM', 'clangSerialization', 1900 'clangSema', 'clangParse', 'clangEdit', 'clangAnalysis' 1901 ] 1902 1903 dep_clang = [] 1904 foreach m : clang_modules 1905 dep_clang += cpp.find_library(m, dirs : llvm_libdir, required : true) 1906 endforeach 1907 endif 1908endif 1909 1910# Be explicit about only using this lib on Windows, to avoid picking 1911# up random libs with the generic name 'libversion' 1912dep_version = null_dep 1913if host_machine.system() == 'windows' 1914 dep_version = cpp.find_library('version') 1915endif 1916 1917with_opencl_native = _opencl != 'disabled' and get_option('opencl-native') 1918 1919if (with_amd_vk or with_gallium_radeonsi or 1920 (with_gallium_opencl and with_opencl_native) or 1921 (with_gallium_r600 and with_llvm)) 1922 dep_elf = dependency('libelf', required : false) 1923 if not with_platform_windows and not dep_elf.found() 1924 dep_elf = cc.find_library('elf') 1925 endif 1926else 1927 dep_elf = null_dep 1928endif 1929 1930dep_glvnd = null_dep 1931if with_glvnd 1932 dep_glvnd = dependency('libglvnd', version : '>= 1.3.2') 1933 pre_args += '-DUSE_LIBGLVND=1' 1934endif 1935 1936_valgrind = get_option('valgrind') 1937if _valgrind == 'true' 1938 _valgrind = 'enabled' 1939 warning('valgrind option "true" deprecated, please use "enabled" instead.') 1940elif _valgrind == 'false' 1941 _valgrind = 'disabled' 1942 warning('valgrind option "false" deprecated, please use "disabled" instead.') 1943endif 1944if _valgrind != 'disabled' 1945 dep_valgrind = dependency('valgrind', required : _valgrind == 'enabled') 1946 if dep_valgrind.found() 1947 pre_args += '-DHAVE_VALGRIND' 1948 endif 1949else 1950 dep_valgrind = null_dep 1951endif 1952 1953# AddressSanitizer's leak reports need all the symbols to be present at exit to 1954# decode well, which runs afoul of our dlopen()/dlclose()ing of the DRI drivers. 1955# Set a flag so we can skip the dlclose for asan builds. 1956if ['address', 'address,undefined'].contains(get_option('b_sanitize')) 1957 asan_c_args = ['-DBUILT_WITH_ASAN=1'] 1958else 1959 asan_c_args = ['-DBUILT_WITH_ASAN=0'] 1960endif 1961 1962yacc_is_bison = true 1963 1964if build_machine.system() == 'windows' 1965 # Prefer the winflexbison versions, they're much easier to install and have 1966 # better windows support. 1967 1968 prog_flex = find_program('win_flex', required : false) 1969 if prog_flex.found() 1970 # windows compatibility (uses <io.h> instead of <unistd.h> and _isatty, 1971 # _fileno functions) 1972 prog_flex = [prog_flex, '--wincompat'] 1973 else 1974 prog_flex = [find_program('flex', 'lex', required : with_any_opengl)] 1975 endif 1976 # Force flex to use const keyword in prototypes, as relies on __cplusplus or 1977 # __STDC__ macro to determine whether it's safe to use const keyword 1978 prog_flex += '-DYY_USE_CONST=' 1979 1980 prog_flex_cpp = prog_flex 1981 # Convince win_flex to use <inttypes.h> for C++ files 1982 # Note that we are using a C99 version here rather than C11, 1983 # because using a C11 version can cause the MSVC CRT headers to define 1984 # static_assert to _Static_assert, which breaks other parts of the CRT 1985 prog_flex_cpp += '-D__STDC_VERSION__=199901' 1986 1987 prog_bison = find_program('win_bison', required : false) 1988 if not prog_bison.found() 1989 prog_bison = find_program('bison', 'yacc', required : with_any_opengl) 1990 endif 1991else 1992 prog_bison = find_program('bison', required : false) 1993 1994 if not prog_bison.found() 1995 prog_bison = find_program('byacc', required : with_any_opengl) 1996 yacc_is_bison = false 1997 endif 1998 1999 # Disable deprecated keyword warnings, since we have to use them for 2000 # old-bison compat. See discussion in 2001 # https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2161 2002 if find_program('bison', required : false, version : '> 2.3').found() 2003 prog_bison = [prog_bison, '-Wno-deprecated'] 2004 endif 2005 2006 prog_flex = find_program('flex', required : with_any_opengl) 2007 prog_flex_cpp = prog_flex 2008endif 2009 2010dep_selinux = null_dep 2011if get_option('selinux') 2012 if get_option('execmem') != true 2013 warning('execmem option is disabled, selinux will not be able to use execmem.') 2014 endif 2015 dep_selinux = dependency('libselinux') 2016 pre_args += '-DMESA_SELINUX' 2017endif 2018 2019if get_option('execmem') 2020 pre_args += '-DMESA_EXECMEM' 2021endif 2022 2023_libunwind = get_option('libunwind') 2024if _libunwind == 'true' 2025 _libunwind = 'enabled' 2026 warning('libunwind option "true" deprecated, please use "enabled" instead.') 2027elif _libunwind == 'false' 2028 _libunwind = 'disabled' 2029 warning('libunwind option "false" deprecated, please use "disabled" instead.') 2030endif 2031if _libunwind != 'disabled' and not with_platform_android 2032 if host_machine.system() == 'darwin' 2033 dep_unwind = meson.get_compiler('c').find_library('System') 2034 else 2035 dep_unwind = dependency('libunwind', required : _libunwind == 'enabled') 2036 endif 2037 if dep_unwind.found() 2038 pre_args += '-DHAVE_LIBUNWIND' 2039 endif 2040else 2041 dep_unwind = null_dep 2042endif 2043 2044if with_osmesa 2045 if not with_gallium_softpipe 2046 error('OSMesa gallium requires gallium softpipe or llvmpipe.') 2047 endif 2048 if host_machine.system() == 'windows' 2049 osmesa_lib_name = 'osmesa' 2050 else 2051 osmesa_lib_name = 'OSMesa' 2052 endif 2053 osmesa_bits = get_option('osmesa-bits') 2054 if osmesa_bits != 'unspecified' 2055 warning('osmesa-bits option is deprecated and have no effect, please remove it.') 2056 endif 2057endif 2058 2059# TODO: symbol mangling 2060 2061if with_platform_wayland 2062 dep_wl_scanner = dependency('wayland-scanner', native: true) 2063 prog_wl_scanner = find_program(dep_wl_scanner.get_variable(pkgconfig : 'wayland_scanner')) 2064 if dep_wl_scanner.version().version_compare('>= 1.15') 2065 wl_scanner_arg = 'private-code' 2066 else 2067 wl_scanner_arg = 'code' 2068 endif 2069 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.24') 2070 dep_wayland_client = dependency('wayland-client', version : '>=1.18') 2071 dep_wayland_server = dependency('wayland-server', version : '>=1.18') 2072 if with_egl 2073 dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3') 2074 dep_wayland_egl_headers = dep_wayland_egl.partial_dependency(compile_args : true) 2075 endif 2076 wayland_dmabuf_xml = join_paths( 2077 dep_wl_protocols.get_variable(pkgconfig : 'pkgdatadir'), 'unstable', 2078 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml' 2079 ) 2080 pre_args += '-DWL_HIDE_DEPRECATED' 2081endif 2082 2083dep_x11 = null_dep 2084dep_xext = null_dep 2085dep_xfixes = null_dep 2086dep_x11_xcb = null_dep 2087dep_xcb = null_dep 2088dep_xcb_glx = null_dep 2089dep_xcb_dri2 = null_dep 2090dep_xcb_dri3 = null_dep 2091dep_dri2proto = null_dep 2092dep_glproto = null_dep 2093dep_xxf86vm = null_dep 2094dep_xcb_dri3 = null_dep 2095dep_xcb_present = null_dep 2096dep_xcb_sync = null_dep 2097dep_xcb_xfixes = null_dep 2098dep_xshmfence = null_dep 2099dep_xcb_xrandr = null_dep 2100dep_xcb_shm = null_dep 2101dep_xlib_xrandr = null_dep 2102dep_openmp = null_dep 2103 2104# Even if we find OpenMP, Gitlab CI fails to link with gcc/i386 and clang/anyarch. 2105if host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc' 2106 dep_openmp = dependency('openmp', required : false) 2107 if dep_openmp.found() 2108 pre_args += ['-DHAVE_OPENMP'] 2109 endif 2110endif 2111 2112if with_platform_x11 2113 if with_glx == 'xlib' or with_glx == 'gallium-xlib' 2114 dep_x11 = dependency('x11') 2115 dep_xext = dependency('xext') 2116 dep_xcb = dependency('xcb') 2117 elif with_glx == 'dri' 2118 dep_x11 = dependency('x11') 2119 dep_xext = dependency('xext') 2120 dep_xfixes = dependency('xfixes', version : '>= 2.0') 2121 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1') 2122 dep_xcb_shm = dependency('xcb-shm') 2123 endif 2124 if (with_any_vk or with_glx == 'dri' or with_egl or 2125 (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or 2126 with_gallium_omx != 'disabled')) 2127 dep_xcb = dependency('xcb') 2128 dep_x11_xcb = dependency('x11-xcb') 2129 if with_dri_platform == 'drm' and not dep_libdrm.found() 2130 error('libdrm required for gallium video statetrackers when using x11') 2131 endif 2132 endif 2133 if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm') 2134 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8') 2135 2136 if with_dri3 2137 pre_args += '-DHAVE_DRI3' 2138 dep_xcb_dri3 = dependency('xcb-dri3') 2139 dep_xcb_present = dependency('xcb-present') 2140 # until xcb-dri3 has been around long enough to make a hard-dependency: 2141 if (dep_xcb_dri3.version().version_compare('>= 1.13') and 2142 dep_xcb_present.version().version_compare('>= 1.13')) 2143 pre_args += '-DHAVE_DRI3_MODIFIERS' 2144 endif 2145 dep_xcb_shm = dependency('xcb-shm') 2146 dep_xcb_sync = dependency('xcb-sync') 2147 dep_xshmfence = dependency('xshmfence', version : '>= 1.1') 2148 endif 2149 endif 2150 if with_glx == 'dri' or with_glx == 'xlib' or with_glx == 'gallium-xlib' 2151 dep_glproto = dependency('glproto', version : '>= 1.4.14') 2152 endif 2153 if with_glx == 'dri' 2154 if with_dri_platform == 'drm' 2155 dep_dri2proto = dependency('dri2proto', version : '>= 2.8') 2156 if with_glx_direct 2157 dep_xxf86vm = dependency('xxf86vm') 2158 endif 2159 endif 2160 endif 2161 if (with_egl or 2162 with_dri3 or ( 2163 with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or 2164 with_gallium_omx != 'disabled')) 2165 dep_xcb_xfixes = dependency('xcb-xfixes') 2166 endif 2167 if with_xlib_lease or with_any_vk 2168 dep_xcb_xrandr = dependency('xcb-randr') 2169 endif 2170 if with_xlib_lease 2171 dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3') 2172 endif 2173endif 2174 2175if get_option('gallium-extra-hud') 2176 pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1' 2177endif 2178 2179_sensors = get_option('lmsensors') 2180if _sensors == 'true' 2181 _sensors = 'enabled' 2182 warning('lmsensors option "true" deprecated, please use "enabled" instead.') 2183elif _sensors == 'false' 2184 _sensors = 'disabled' 2185 warning('lmsensors option "false" deprecated, please use "disabled" instead.') 2186endif 2187if _sensors != 'disabled' 2188 dep_lmsensors = cc.find_library('sensors', required : _sensors == 'enabled') 2189 if dep_lmsensors.found() 2190 pre_args += '-DHAVE_LIBSENSORS=1' 2191 endif 2192else 2193 dep_lmsensors = null_dep 2194endif 2195 2196_shader_replacement = get_option('custom-shader-replacement') 2197if _shader_replacement == '' 2198else 2199 pre_args += '-DCUSTOM_SHADER_REPLACEMENT' 2200endif 2201 2202with_perfetto = get_option('perfetto') 2203with_datasources = get_option('datasources') 2204with_any_datasource = with_datasources.length() != 0 2205if with_perfetto 2206 dep_perfetto = dependency('perfetto', fallback: ['perfetto', 'dep_perfetto']) 2207 pre_args += '-DHAVE_PERFETTO' 2208endif 2209 2210add_project_arguments(pre_args, language : ['c', 'cpp']) 2211add_project_arguments(c_args, language : ['c']) 2212add_project_arguments(cpp_args, language : ['cpp']) 2213 2214gl_priv_reqs = [] 2215 2216if with_glx == 'xlib' or with_glx == 'gallium-xlib' 2217 gl_priv_reqs += ['x11', 'xext', 'xcb'] 2218elif with_glx == 'dri' 2219 gl_priv_reqs += [ 2220 'x11', 'xext', 'xfixes', 'x11-xcb', 'xcb', 2221 'xcb-glx >= 1.8.1'] 2222 if with_dri_platform == 'drm' 2223 gl_priv_reqs += 'xcb-dri2 >= 1.8' 2224 if with_glx_direct 2225 gl_priv_reqs += 'xxf86vm' 2226 endif 2227 endif 2228endif 2229if dep_libdrm.found() 2230 gl_priv_reqs += 'libdrm >= 2.4.75' 2231endif 2232 2233gl_priv_libs = [] 2234if dep_thread.found() 2235 gl_priv_libs += ['-lpthread', '-pthread'] 2236endif 2237if dep_m.found() 2238 gl_priv_libs += '-lm' 2239endif 2240if dep_dl.found() 2241 gl_priv_libs += '-ldl' 2242endif 2243 2244# FIXME: autotools lists this as incomplete 2245gbm_priv_libs = [] 2246if dep_dl.found() 2247 gbm_priv_libs += '-ldl' 2248endif 2249 2250pkg = import('pkgconfig') 2251 2252if host_machine.system() == 'windows' 2253 prog_dumpbin = find_program('dumpbin', required : false) 2254 with_symbols_check = prog_dumpbin.found() and with_tests 2255 if with_symbols_check 2256 symbols_check_args = ['--dumpbin', prog_dumpbin.path()] 2257 endif 2258else 2259 prog_nm = find_program('nm') 2260 with_symbols_check = with_tests 2261 symbols_check_args = ['--nm', prog_nm.path()] 2262endif 2263 2264# This quirk needs to be applied to sources with functions defined in assembly 2265# as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391 2266gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : [] 2267 2268devenv = environment() 2269 2270subdir('include') 2271subdir('bin') 2272subdir('src') 2273 2274if meson.version().version_compare('>= 0.58') 2275 meson.add_devenv(devenv) 2276endif 2277 2278lines = ['', 2279 'prefix: ' + get_option('prefix'), 2280 'libdir: ' + get_option('libdir'), 2281 'includedir: ' + get_option('includedir'), 2282 '', 2283 'OpenGL: @0@ (ES1: @1@ ES2: @2@)'.format(with_opengl ? 'yes' : 'no', 2284 with_gles1 ? 'yes' : 'no', 2285 with_gles2 ? 'yes' : 'no'), 2286] 2287 2288if with_osmesa 2289 lines += '' 2290 lines += 'OSMesa: lib' + osmesa_lib_name 2291else 2292 lines += 'OSMesa: no' 2293endif 2294 2295if with_dri 2296 lines += '' 2297 lines += 'DRI platform: ' + with_dri_platform 2298 if dri_drivers.length() != 0 and dri_drivers != [''] 2299 lines += 'DRI drivers: ' + ' '.join(dri_drivers) 2300 else 2301 lines += 'DRI drivers: no' 2302 endif 2303 lines += 'DRI driver dir: ' + dri_drivers_path 2304endif 2305 2306if with_glx != 'disabled' 2307 lines += '' 2308 if with_glx == 'dri' 2309 lines += 'GLX: DRI-based' 2310 elif with_glx == 'xlib' 2311 lines += 'GLX: Xlib-based' 2312 else 2313 lines += 'GLX: ' + with_glx 2314 endif 2315endif 2316 2317lines += '' 2318lines += 'EGL: ' + (with_egl ? 'yes' : 'no') 2319if with_egl 2320 egl_drivers = [] 2321 if with_dri 2322 egl_drivers += 'builtin:egl_dri2' 2323 endif 2324 if with_dri3 2325 egl_drivers += 'builtin:egl_dri3' 2326 endif 2327 if with_platform_windows 2328 egl_drivers += 'builtin:wgl' 2329 endif 2330 lines += 'EGL drivers: ' + ' '.join(egl_drivers) 2331endif 2332if with_egl or with_any_vk 2333 lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms) 2334endif 2335lines += 'GBM: ' + (with_gbm ? 'yes' : 'no') 2336if with_gbm 2337 lines += 'GBM backends path: ' + gbm_backends_path 2338endif 2339 2340lines += '' 2341lines += 'Video Codecs: ' + ' '.join(_codecs) 2342lines += '' 2343 2344if with_any_vk 2345 lines += 'Vulkan drivers: ' + ' '.join(_vulkan_drivers) 2346 lines += 'Vulkan ICD dir: ' + with_vulkan_icd_dir 2347 if with_any_vulkan_layers 2348 lines += 'Vulkan layers: ' + ' '.join(get_option('vulkan-layers')) 2349 endif 2350else 2351 lines += 'Vulkan drivers: no' 2352endif 2353 2354lines += '' 2355if with_llvm 2356 lines += 'llvm: yes' 2357 lines += 'llvm-version: ' + dep_llvm.version() 2358else 2359 lines += 'llvm: no' 2360endif 2361 2362lines += '' 2363if with_gallium 2364 lines += 'Gallium drivers: ' + ' '.join(gallium_drivers) 2365 gallium_st = ['mesa'] 2366 if with_gallium_xa 2367 gallium_st += 'xa' 2368 endif 2369 if with_gallium_xvmc 2370 gallium_st += 'xvmc' 2371 endif 2372 if with_gallium_vdpau 2373 gallium_st += 'vdpau' 2374 endif 2375 if with_gallium_omx != 'disabled' 2376 gallium_st += 'omx' + with_gallium_omx 2377 endif 2378 if with_gallium_va 2379 gallium_st += 'va' 2380 endif 2381 if with_gallium_st_nine 2382 gallium_st += 'nine' 2383 endif 2384 if with_gallium_opencl 2385 gallium_st += 'clover' 2386 endif 2387 lines += 'Gallium st: ' + ' '.join(gallium_st) 2388else 2389 lines += 'Gallium: no' 2390endif 2391 2392lines += 'HUD lmsensors: ' + (dep_lmsensors.found() ? 'yes' : 'no') 2393 2394lines += '' 2395lines += 'Shared-glapi: ' + (with_shared_glapi ? 'yes' : 'no') 2396 2397lines += '' 2398lines += 'Perfetto: ' + (with_perfetto ? 'yes' : 'no') 2399if with_any_datasource 2400 lines += 'Perfetto ds: ' + ' '.join(with_datasources) 2401endif 2402 2403 2404indent = ' ' 2405summary = indent + ('\n' + indent).join(lines) 2406message('Configuration summary:\n@0@\n'.format(summary)) 2407