1 # Copyright © 2017 Intel Corporation
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:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
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
24 version : '17.3.0-devel',
26 meson_version : '>= 0.42',
27 default_options : ['c_std=c99', 'cpp_std=c++11']
30 # Arguments for the preprocessor, put these in a separate array from the C and
31 # C++ (cpp in meson terminology) arguments since they need to be added to the
32 # default arguments for both C and C++.
34 '-D__STDC_CONSTANT_MACROS',
35 '-D__STDC_FORMAT_MACROS',
36 '-D__STDC_LIMIT_MACROS',
37 '-DVERSION="@0@"'.format(meson.project_version()),
38 '-DPACKAGE_VERSION=VERSION',
39 '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"',
43 with_vulkan_icd_dir = get_option('vulkan-icd-dir')
44 with_tests = get_option('build-tests')
45 with_valgrind = get_option('valgrind')
46 with_libunwind = get_option('libunwind')
47 with_asm = get_option('asm')
48 with_llvm = get_option('llvm')
49 with_osmesa = get_option('osmesa')
50 if get_option('texture-float')
51 pre_args += '-DTEXTURE_FLOAT_ENABLED'
52 message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.')
57 with_windowsdri = false
59 dri_drivers_path = get_option('dri-drivers-path')
60 if dri_drivers_path == ''
61 dri_drivers_path = join_paths(get_option('libdir'), 'dri')
64 with_gles1 = get_option('gles1')
65 with_gles2 = get_option('gles2')
66 with_opengl = get_option('opengl')
67 with_any_opengl = with_opengl or with_gles1 or with_gles2
68 # Only build shared_glapi if at least one OpenGL API is enabled
69 with_shared_glapi = get_option('shared-glapi') and with_any_opengl
72 # shared-glapi is required if at least two OpenGL APIs are being built
73 if not with_shared_glapi
74 if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
75 or (with_gles2 and with_opengl))
76 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
80 # We require OpenGL for OpenGL ES
81 if (with_gles1 or with_gles2) and not with_opengl
82 error('building OpenGL ES without OpenGL is not supported.')
90 with_dri_nouveau = false
91 with_dri_swrast = false
92 _drivers = get_option('dri-drivers')
94 _split = _drivers.split(',')
95 with_dri_i915 = _split.contains('i915')
96 with_dri_i965 = _split.contains('i965')
97 with_dri_r100 = _split.contains('r100')
98 with_dri_r200 = _split.contains('r200')
99 with_dri_nouveau = _split.contains('nouveau')
100 with_dri_swrast = _split.contains('swrast')
105 with_gallium_pl111 = false
106 with_gallium_radeonsi = false
107 with_gallium_nouveau = false
108 with_gallium_freedreno = false
109 with_gallium_softpipe = false
110 with_gallium_vc4 = false
111 with_gallium_vc5 = false
112 with_gallium_etnaviv = false
113 with_gallium_imx = false
114 _drivers = get_option('gallium-drivers')
116 _split = _drivers.split(',')
117 with_gallium_pl111 = _split.contains('pl111')
118 with_gallium_radeonsi = _split.contains('radeonsi')
119 with_gallium_nouveau = _split.contains('nouveau')
120 with_gallium_freedreno = _split.contains('freedreno')
121 with_gallium_softpipe = _split.contains('swrast')
122 with_gallium_vc4 = _split.contains('vc4')
123 with_gallium_vc5 = _split.contains('vc5')
124 with_gallium_etnaviv = _split.contains('etnaviv')
125 with_gallium_imx = _split.contains('imx')
130 if not (with_dri or with_gallium)
134 with_any_opengl = false
135 with_shared_glapi = false
138 if with_dri_swrast and with_gallium_softpipe
139 error('Only one swrast provider can be built')
141 if with_gallium_imx and not with_gallium_etnaviv
142 error('IMX driver requires etnaviv driver')
145 dep_libdrm_intel = []
147 dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
151 with_dri_platform = 'drm'
153 with_platform_android = false
154 with_platform_wayland = false
155 with_platform_x11 = false
156 with_platform_drm = false
157 with_platform_surfaceless = false
158 egl_native_platform = ''
159 _platforms = get_option('platforms')
161 _split = _platforms.split(',')
162 with_platform_android = _split.contains('android')
163 with_platform_x11 = _split.contains('x11')
164 with_platform_wayland = _split.contains('wayland')
165 with_platform_drm = _split.contains('drm')
166 with_platform_surfaceless = _split.contains('surfaceless')
167 egl_native_platform = _split[0]
170 with_gbm = get_option('gbm')
171 if with_gbm == 'auto' and with_dri # TODO: or gallium
172 with_gbm = host_machine.system() == 'linux'
173 elif with_gbm == 'true'
174 if not ['linux', 'bsd'].contains(host_machine.system())
175 error('GBM only supports unix-like platforms')
182 _egl = get_option('egl')
184 with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
187 error('EGL requires dri')
188 elif not with_shared_glapi
189 error('EGL requires shared-glapi')
190 elif egl_native_platform == ''
191 error('No platforms specified, consider -Dplatforms=drm,x11 at least')
199 if with_egl and with_gallium_radeonsi and not (with_platform_drm or with_platform_surfaceless)
200 error('RadeonSI requires drm or surfaceless platform when using EGL')
203 pre_args += '-DGLX_USE_TLS'
204 with_glx = get_option('glx')
205 if with_glx != 'disabled'
206 if not (with_platform_x11 and with_any_opengl)
207 if with_glx == 'auto'
208 with_glx = 'disabled'
210 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
212 elif with_glx == 'gallium-xlib'
214 error('Gallium-xlib based GLX requires at least one gallium driver')
216 error('gallium-xlib conflicts with any dri driver')
218 elif with_glx == 'dri' and not with_dri
219 error('dri based GLX requires at least one DRI driver')
220 elif with_glx == 'auto'
224 with_glx = 'gallium-xlib'
225 elif with_platform_x11 and with_any_opengl
228 with_glx = 'disabled'
233 with_glvnd = get_option('glvnd')
234 if with_glvnd and with_glx != 'dri'
235 message('glvnd requires dri based glx')
238 # TODO: toggle for this
239 with_glx_direct = true
241 if with_vulkan_icd_dir == ''
242 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
245 with_intel_vk = false
248 _vulkan_drivers = get_option('vulkan-drivers')
249 if _vulkan_drivers != ''
250 _split = _vulkan_drivers.split(',')
251 with_intel_vk = _split.contains('intel')
252 with_amd_vk = _split.contains('amd')
253 with_any_vk = with_amd_vk or with_intel_vk
254 if not (with_platform_x11 or with_platform_wayland or with_platform_android)
255 error('Vulkan requires at least one platform (x11, wayland, android)')
259 with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
260 with_dri3 = get_option('dri3')
261 if with_dri3 == 'auto'
262 if host_machine.system() == 'linux' and with_dri2
267 elif with_dri3 == 'true'
273 if with_any_vk and (with_platform_x11 and not with_dri3)
274 error('Vulkan drivers require dri3 for X11 support')
276 if with_dri or with_gallium
277 if with_glx == 'disabled' and not with_egl
278 error('building dri or gallium drivers require at least one window system')
282 with_gallium_xvmc = false
283 with_gallium_vdpau = false
284 with_gallium_omx = false # this is bellagio
285 with_gallium_va = false
286 with_gallium_media = false
288 _drivers = get_option('gallium-media')
290 _split = _drivers.split(',')
291 with_gallium_xvmc = _split.contains('xvmc')
292 with_gallium_vdpau = _split.contains('vdpau')
293 with_gallium_omx = _split.contains('omx')
294 with_gallium_va = _split.contains('va')
295 with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or
296 with_gallium_omx or with_gallium_va)
299 gl_pkgconfig_c_flags = []
301 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
302 pre_args += '-DHAVE_X11_PLATFORM'
304 if with_glx == 'xlib'
307 elif with_glx == 'gallium-xlib'
311 pre_args += '-DGLX_INDIRECT_RENDERING'
313 pre_args += '-DGLX_DIRECT_RENDERING'
315 if with_dri_platform == 'drm'
316 pre_args += '-DGLX_USE_DRM'
320 pre_args += '-DMESA_EGL_NO_X11_HEADERS'
321 gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS'
324 if with_egl and not with_gbm
325 error('EGL drm platform requires gbm')
327 pre_args += '-DHAVE_DRM_PLATFORM'
329 if with_platform_surfaceless
330 pre_args += '-DHAVE_SURFACELESS_PLATFORM'
332 if with_platform_android
334 dependency('cutils'),
335 dependency('hardware'),
338 pre_args += '-DHAVE_ANDROID_PLATFORM'
341 prog_python2 = find_program('python2')
342 has_mako = run_command(prog_python2, '-c', 'import mako')
343 if has_mako.returncode() != 0
344 error('Python (2.x) mako module required to build mesa.')
347 cc = meson.get_compiler('c')
348 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
349 error('When using GCC, version 4.4.6 or later is required.')
352 # Define DEBUG for debug and debugoptimized builds
353 if get_option('buildtype').startswith('debug')
354 pre_args += '-DDEBUG'
357 if get_option('shader-cache')
358 pre_args += '-DENABLE_SHADER_CACHE'
360 error('Radv requires shader cache support')
363 # Check for GCC style builtins
364 foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
365 'ffsll', 'popcount', 'popcountll', 'unreachable']
366 if cc.has_function(b)
367 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
371 # check for GCC __attribute__
372 foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
373 'warn_unused_result', 'weak',]
374 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
375 name : '__attribute__((@0@))'.format(a))
376 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
379 if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
380 name : '__attribute__((format(...)))')
381 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
383 if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
384 name : '__attribute__((packed))')
385 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
387 if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
388 name : '__attribute__((returns_nonnull))')
389 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
391 if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
392 int foo_hid(void) __attribute__((visibility("hidden")));
393 int foo_int(void) __attribute__((visibility("internal")));
394 int foo_pro(void) __attribute__((visibility("protected")));''',
395 name : '__attribute__((visibility(...)))')
396 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
398 if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
399 name : '__attribute__((alias(...)))')
400 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
403 # TODO: this is very incomplete
404 if host_machine.system() == 'linux'
405 pre_args += '-D_GNU_SOURCE'
408 # Check for generic C arguments
410 foreach a : ['-Wall', '-Werror=implicit-function-declaration',
411 '-Werror=missing-prototypes', '-fno-math-errno',
412 '-fno-trapping-math', '-Qunused-arguments']
413 if cc.has_argument(a)
418 if cc.has_argument('-fvisibility=hidden')
419 c_vis_args += '-fvisibility=hidden'
422 # Check for generic C++ arguments
423 cpp = meson.get_compiler('cpp')
425 foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
426 '-Qunused-arguments', '-Wno-non-virtual-dtor']
427 if cpp.has_argument(a)
432 if cpp.has_argument('-fvisibility=hidden')
433 cpp_vis_args += '-fvisibility=hidden'
436 # Check for C and C++ arguments for MSVC2013 compatibility. These are only used
437 # in parts of the mesa code base that need to compile with old versions of
438 # MSVC, mainly common code
439 c_msvc_compat_args = []
440 cpp_msvc_compat_args = []
441 foreach a : ['-Werror=pointer-arith', '-Werror=vla']
442 if cc.has_argument(a)
443 c_msvc_compat_args += a
445 if cpp.has_argument(a)
446 cpp_msvc_compat_args += a
450 no_override_init_args = []
451 foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
452 if cc.has_argument(a)
453 no_override_init_args += a
457 # TODO: SSE41 (which is only required for core mesa)
459 # Check for GCC style atomics
460 if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
461 name : 'GCC atomic builtins')
462 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
464 if not cc.links('''#include <stdint.h>
467 return __sync_add_and_fetch(&v, (uint64_t)1);
469 name : 'GCC 64bit atomics')
470 pre_args += '-DMISSING_64_BIT_ATOMICS'
475 # TODO: shared/static? Is this even worth doing?
477 # I don't think that I need to set any of the debug stuff, I think meson
478 # handles that for us
482 # TODO: texture-float (gallium/mesa only)
484 # TODO: cross-compiling. I don't think this is relavent to meson
486 # FIXME: enable asm when cross compiler
487 # This is doable (autotools does it), but it's not of immediate concern
488 if meson.is_cross_build()
489 message('Cross compiling, disabling asm')
495 # TODO: SPARC and PPC
496 if host_machine.cpu_family() == 'x86'
497 if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
498 with_asm_arch = 'x86'
499 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
502 elif host_machine.cpu_family() == 'x86_64'
503 if host_machine.system() == 'linux'
504 with_asm_arch = 'x86_64'
505 pre_args += ['-DUSE_X86_64_ASM']
507 elif host_machine.cpu_family() == 'arm'
508 if host_machine.system() == 'linux'
509 with_asm_arch = 'arm'
510 pre_args += ['-DUSE_ARM_ASM']
512 elif host_machine.cpu_family() == 'aarch64'
513 if host_machine.system() == 'linux'
514 with_asm_arch = 'aarch64'
515 pre_args += ['-DUSE_AARCH64_ASM']
520 # Check for standard headers and functions
521 if cc.has_header_symbol('sys/sysmacros.h', 'major')
522 pre_args += '-DMAJOR_IN_SYSMACROS'
523 elif cc.has_header_symbol('sys/mkdev.h', 'major')
524 pre_args += '-DMAJOR_IN_MKDEV'
527 foreach h : ['xlocale.h', 'sys/sysctl.h']
529 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
533 foreach f : ['strtof', 'mkostemp', 'posix_memalign']
534 if cc.has_function(f)
535 pre_args += '-DHAVE_@0@'.format(f.to_upper())
539 # strtod locale support
544 #ifdef HAVE_XLOCALE_H
548 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
549 const char *s = "1.0";
551 double d = strtod_l(s, end, loc);
552 float f = strtod_l(s, end, loc);
556 extra_args : pre_args,
557 name : 'strtod has locale support')
558 pre_args += '-DHAVE_STRTOD_L'
561 # Check for some linker flags
562 ld_args_bsymbolic = []
563 if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
564 ld_args_bsymbolic += '-Wl,-Bsymbolic'
566 ld_args_gc_sections = []
567 if cc.links('static char unused() { return 5; } int main() { return 0; }',
568 args : '-Wl,--gc-sections', name : 'gc-sections')
569 ld_args_gc_sections += '-Wl,--gc-sections'
571 with_ld_version_script = false
572 if cc.links('int main() { return 0; }',
573 args : '-Wl,--version-script=@0@'.format(
574 join_paths(meson.source_root(), 'build-support/conftest.map')),
575 name : 'version-script')
576 with_ld_version_script = true
578 with_ld_dynamic_list = false
579 if cc.links('int main() { return 0; }',
580 args : '-Wl,--dynamic-list=@0@'.format(
581 join_paths(meson.source_root(), 'build-support/conftest.dyn')),
582 name : 'dynamic-list')
583 with_ld_dynamic_list = true
586 # check for dl support
587 if cc.has_function('dlopen')
590 dep_dl = cc.find_library('dl')
592 if cc.has_function('dladdr', dependencies : dep_dl)
593 # This is really only required for megadrivers
594 pre_args += '-DHAVE_DLADDR'
597 if cc.has_function('dl_iterate_phdr')
598 pre_args += '-DHAVE_DL_ITERATE_PHDR'
600 # TODO: this is required for vulkan
603 # Determine whether or not the rt library is needed for time functions
604 if cc.has_function('clock_gettime')
607 dep_clock = cc.find_library('rt')
610 with_gallium_drisw_kms = false
611 dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
612 required : with_dri2 or with_dri3)
613 if dep_libdrm.found()
614 pre_args += '-DHAVE_LIBDRM'
615 if with_dri_platform == 'drm' and with_dri
616 with_gallium_drisw_kms = true
620 # TODO: some of these may be conditional
621 dep_zlib = dependency('zlib', version : '>= 1.2.3')
622 dep_thread = dependency('threads')
623 if dep_thread.found() and host_machine.system() == 'linux'
624 pre_args += '-DHAVE_PTHREAD'
626 dep_elf = dependency('libelf', required : false)
627 if not dep_elf.found() and (with_amd_vk or with_gallium_radeonsi) # TODO: clover, r600
628 dep_elf = cc.find_library('elf')
630 dep_expat = dependency('expat')
631 # this only exists on linux so either this is linux and it will be found, or
632 # its not linux and and wont
633 dep_m = cc.find_library('m', required : false)
635 dep_libdrm_amdgpu = []
636 dep_libdrm_radeon = []
637 dep_libdrm_nouveau = []
638 dep_libdrm_etnaviv = []
639 dep_libdrm_freedreno = []
640 if with_amd_vk or with_gallium_radeonsi
641 dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.86')
643 if with_gallium_radeonsi or with_dri_r100 or with_dri_r200
644 dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
646 if with_gallium_nouveau or with_dri_nouveau
647 dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
649 if with_gallium_etnaviv
650 dep_libdrm_etnaviv = dependency('libdrm_etnaviv', version : '>= 2.4.82')
652 if with_gallium_freedreno
653 dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>= 2.4.74')
656 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
658 llvm_modules += ['amdgpu', 'bitreader', 'ipo']
660 dep_llvm = dependency(
661 'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules,
665 _llvm_version = dep_llvm.version().split('.')
666 # Development versions of LLVM have an 'svn' suffix, we don't want that for
667 # our version checks.
668 _llvm_patch = _llvm_version[2]
669 if _llvm_patch.endswith('svn')
670 _llvm_patch = _llvm_patch.split('s')[0]
673 '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
674 '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
677 if with_gallium_softpipe
678 error('Cannot find LLVM to build LLVMPipe. If you wanted softpipe pass -Dllvm=false to meson')
679 elif with_amd_vk or with_gallium_radeonsi # etc
680 error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM was not found.')
683 elif with_amd_vk or with_gallium_radeonsi
684 error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM is disabled.')
689 dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
690 pre_args += '-DUSE_LIBGLVND=1'
693 # TODO: make this conditional
694 if with_valgrind != 'false'
695 dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
696 if dep_valgrind.found()
697 pre_args += '-DHAVE_VALGRIND'
703 # pthread stubs. Lets not and say we didn't
705 prog_bison = find_program('bison', required : with_any_opengl)
706 prog_flex = find_program('flex', required : with_any_opengl)
709 if get_option('selinux')
710 dep_selinux = dependency('libselinux')
711 pre_args += '-DMESA_SELINUX'
714 # TODO: llvm-prefix and llvm-shared-libs
716 if with_libunwind != 'false'
717 dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
718 if dep_unwind.found()
719 pre_args += '-DHAVE_LIBUNWIND'
725 # TODO: flags for opengl, gles, dri
731 if with_osmesa != 'none'
732 if with_osmesa == 'classic' and not with_dri_swrast
733 error('OSMesa classic requires dri (classic) swrast.')
735 if with_osmesa == 'gallium' and not with_gallium_softpipe
736 error('OSMesa gallium requires gallium softpipe or llvmpipe.')
738 osmesa_lib_name = 'OSMesa'
739 osmesa_bits = get_option('osmesa-bits')
740 if osmesa_bits != '8'
741 if with_dri or with_glx != 'disabled'
742 error('OSMesa bits must be 8 if building glx or dir based drivers')
744 osmesa_lib_name = osmesa_lib_name + osmesa_bits
746 '-DCHAN_BITS=@0@'.format(osmesa_bits), '-DDEFAULT_SOFTWARE_DEPTH_BITS=31'
751 # TODO: symbol mangling
753 if with_platform_wayland
754 prog_wl_scanner = find_program('wayland-scanner')
755 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
756 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
757 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
758 wayland_dmabuf_xml = join_paths(
759 dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
760 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
762 pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
765 dep_wl_protocols = []
766 dep_wayland_client = []
767 dep_wayland_server = []
768 wayland_dmabuf_xml = ''
789 if with_glx == 'dri' and with_dri_platform == 'drm'
790 dep_x11 = dependency('x11')
791 dep_xext = dependency('xext')
792 dep_xdamage = dependency('xdamage', version : '>= 1.1')
793 dep_xfixes = dependency('xfixes')
794 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
795 dep_xxf86vm = dependency('xxf86vm', required : false)
797 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
798 dep_xcb = dependency('xcb')
799 dep_x11_xcb = dependency('x11-xcb')
800 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
803 pre_args += '-DHAVE_DRI3'
804 dep_xcb_dri3 = dependency('xcb-dri3')
805 dep_xcb_present = dependency('xcb-present')
806 dep_xcb_sync = dependency('xcb-sync')
807 dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
810 if with_glx != 'disabled'
811 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
812 dep_glproto = dependency('glproto', version : '>= 1.4.14')
815 dep_xcb_xfixes = dependency('xcb-xfixes')
821 # TODO: vallium G3DVL
827 # TODO: gallium tests
829 # TODO: various libdirs
833 # TODO: gallium driver dirs
835 # FIXME: this is a workaround for #2326
836 prog_touch = find_program('touch')
837 dummy_cpp = custom_target(
839 output : 'dummy.cpp',
840 command : [prog_touch, '@OUTPUT@'],
844 add_project_arguments(a, language : ['c', 'cpp'])
847 add_project_arguments(a, language : ['c'])
850 add_project_arguments(a, language : ['cpp'])
853 inc_include = include_directories('include')
856 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
857 'xcb-glx >= 1.8.1', 'libdrm >= 2.4.75',
859 if dep_xxf86vm != [] and dep_xxf86vm.found()
860 gl_priv_reqs += 'xxf86vm'
862 if with_dri_platform == 'drm'
863 gl_priv_reqs += 'xcb-dri2 >= 1.8'
867 if dep_thread.found()
868 gl_priv_libs += ['-lpthread', '-pthread']
871 gl_priv_libs += '-lm'
874 gl_priv_libs += '-ldl'
877 pkg = import('pkgconfig')