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 if get_option('texture-float')
50 pre_args += '-DTEXTURE_FLOAT_ENABLED'
51 message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.')
56 with_windowsdri = false
58 dri_drivers_path = get_option('dri-drivers-path')
59 if dri_drivers_path == ''
60 dri_drivers_path = join_paths(get_option('libdir'), 'dri')
63 with_gles1 = get_option('gles1')
64 with_gles2 = get_option('gles2')
65 with_opengl = get_option('opengl')
66 with_any_opengl = with_opengl or with_gles1 or with_gles2
67 # Only build shared_glapi if at least one OpenGL API is enabled
68 with_shared_glapi = get_option('shared-glapi') and with_any_opengl
70 # TODO: these will need options, but at the moment they just control header
74 # shared-glapi is required if at least two OpenGL APIs are being built
75 if not with_shared_glapi
76 if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
77 or (with_gles2 and with_opengl))
78 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
82 # We require OpenGL for OpenGL ES
83 if (with_gles1 or with_gles2) and not with_opengl
84 error('building OpenGL ES without OpenGL is not supported.')
92 with_dri_nouveau = false
93 with_dri_swrast = false
94 _drivers = get_option('dri-drivers')
96 _split = _drivers.split(',')
97 with_dri_i915 = _split.contains('i915')
98 with_dri_i965 = _split.contains('i965')
99 with_dri_r100 = _split.contains('r100')
100 with_dri_r200 = _split.contains('r200')
101 with_dri_nouveau = _split.contains('nouveau')
102 with_dri_swrast = _split.contains('swrast')
107 with_gallium_pl111 = false
108 with_gallium_radeonsi = false
109 with_gallium_nouveau = false
110 with_gallium_freedreno = false
111 with_gallium_softpipe = false
112 with_gallium_vc4 = false
113 with_gallium_vc5 = false
114 with_gallium_etnaviv = false
115 with_gallium_imx = false
116 _drivers = get_option('gallium-drivers')
118 _split = _drivers.split(',')
119 with_gallium_pl111 = _split.contains('pl111')
120 with_gallium_radeonsi = _split.contains('radeonsi')
121 with_gallium_nouveau = _split.contains('nouveau')
122 with_gallium_freedreno = _split.contains('freedreno')
123 with_gallium_softpipe = _split.contains('swrast')
124 with_gallium_vc4 = _split.contains('vc4')
125 with_gallium_vc5 = _split.contains('vc5')
126 with_gallium_etnaviv = _split.contains('etnaviv')
127 with_gallium_imx = _split.contains('imx')
132 if not (with_dri or with_gallium)
136 with_any_opengl = false
137 with_shared_glapi = false
140 if with_dri_swrast and with_gallium_softpipe
141 error('Only one swrast provider can be built')
143 if with_gallium_imx and not with_gallium_etnaviv
144 error('IMX driver requires etnaviv driver')
147 dep_libdrm_intel = []
149 dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
153 with_dri_platform = 'drm'
155 # TODO: android platform
156 with_platform_wayland = false
157 with_platform_x11 = false
158 with_platform_drm = false
159 with_platform_surfaceless = false
160 egl_native_platform = ''
161 _platforms = get_option('platforms')
163 _split = _platforms.split(',')
164 with_platform_x11 = _split.contains('x11')
165 with_platform_wayland = _split.contains('wayland')
166 with_platform_drm = _split.contains('drm')
167 with_platform_surfaceless = _split.contains('surfaceless')
168 egl_native_platform = _split[0]
171 with_gbm = get_option('gbm')
172 if with_gbm == 'auto' and with_dri # TODO: or gallium
173 with_gbm = host_machine.system() == 'linux'
174 elif with_gbm == 'yes'
175 if not ['linux', 'bsd'].contains(host_machine.system())
176 error('GBM only supports unix-like platforms')
183 _egl = get_option('egl')
185 with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
188 error('EGL requires dri')
189 elif not with_shared_glapi
190 error('EGL requires shared-glapi')
191 elif egl_native_platform == ''
192 error('No platforms specified, consider -Dplatforms=drm,x11 at least')
200 if with_egl and with_gallium_radeonsi and not (with_platform_drm or with_platform_surfaceless)
201 error('RadeonSI requires drm or surfaceless platform when using EGL')
204 pre_args += '-DGLX_USE_TLS'
205 with_glx = get_option('glx')
206 if with_glx != 'disabled'
207 if not (with_platform_x11 and with_any_opengl)
208 if with_glx == 'auto'
209 with_glx = 'disabled'
211 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
213 elif with_glx == 'gallium-xlib'
215 error('Gallium-xlib based GLX requires at least one gallium driver')
217 error('gallium-xlib conflicts with any dri driver')
219 elif with_glx == 'dri' and not with_dri
220 error('dri based GLX requires at least one DRI driver')
221 elif with_glx == 'auto'
225 with_glx = 'gallium-xlib'
226 elif with_platform_x11 and with_any_opengl
229 with_glx = 'disabled'
234 with_glvnd = get_option('glvnd')
235 if with_glvnd and with_glx != 'dri'
236 message('glvnd requires dri based glx')
239 # TODO: toggle for this
240 with_glx_direct = true
242 if with_vulkan_icd_dir == ''
243 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
246 with_intel_vk = false
249 _vulkan_drivers = get_option('vulkan-drivers')
250 if _vulkan_drivers != ''
251 _split = _vulkan_drivers.split(',')
252 with_intel_vk = _split.contains('intel')
253 with_amd_vk = _split.contains('amd')
254 with_any_vk = with_amd_vk or with_intel_vk
255 if not (with_platform_x11 or with_platform_wayland)
256 error('Vulkan requires at least one platform (x11, wayland)')
260 with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
261 with_dri3 = get_option('dri3')
262 if with_dri3 == 'auto'
263 if host_machine.system() == 'linux' and with_dri2
268 elif with_dri3 == 'yes'
274 if with_any_vk and (with_platform_x11 and not with_dri3)
275 error('Vulkan drivers require dri3 for X11 support')
277 if with_dri or with_gallium
278 if with_glx == 'disabled' and not with_egl
279 error('building dri or gallium drivers require at least one window system')
283 with_gallium_xvmc = false
284 with_gallium_vdpau = false
285 with_gallium_omx = false # this is bellagio
286 with_gallium_va = false
287 with_gallium_media = false
289 _drivers = get_option('gallium-media')
291 _split = _drivers.split(',')
292 with_gallium_xvmc = _split.contains('xvmc')
293 with_gallium_vdpau = _split.contains('vdpau')
294 with_gallium_omx = _split.contains('omx')
295 with_gallium_va = _split.contains('va')
296 with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or
297 with_gallium_omx or with_gallium_va)
300 gl_pkgconfig_c_flags = []
302 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
303 pre_args += '-DHAVE_X11_PLATFORM'
305 if with_glx == 'xlib'
308 elif with_glx == 'gallium-xlib'
312 pre_args += '-DGLX_INDIRECT_RENDERING'
314 pre_args += '-DGLX_DIRECT_RENDERING'
316 if with_dri_platform == 'drm'
317 pre_args += '-DGLX_USE_DRM'
321 pre_args += '-DMESA_EGL_NO_X11_HEADERS'
322 gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS'
325 if with_egl and not with_gbm
326 error('EGL drm platform requires gbm')
328 pre_args += '-DHAVE_DRM_PLATFORM'
330 if with_platform_surfaceless
331 pre_args += '-DHAVE_SURFACELESS_PLATFORM'
334 prog_python2 = find_program('python2')
335 has_mako = run_command(prog_python2, '-c', 'import mako')
336 if has_mako.returncode() != 0
337 error('Python (2.x) mako module required to build mesa.')
340 cc = meson.get_compiler('c')
341 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
342 error('When using GCC, version 4.4.6 or later is required.')
345 # Define DEBUG for debug and debugoptimized builds
346 if get_option('buildtype').startswith('debug')
347 pre_args += '-DDEBUG'
350 if get_option('shader-cache')
351 pre_args += '-DENABLE_SHADER_CACHE'
353 error('Radv requires shader cache support')
356 # Check for GCC style builtins
357 foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
358 'ffsll', 'popcount', 'popcountll', 'unreachable']
359 if cc.has_function(b)
360 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
364 # check for GCC __attribute__
365 foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
366 'warn_unused_result', 'weak',]
367 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
368 name : '__attribute__((@0@))'.format(a))
369 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
372 if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
373 name : '__attribute__((format(...)))')
374 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
376 if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
377 name : '__attribute__((packed))')
378 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
380 if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
381 name : '__attribute__((returns_nonnull))')
382 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
384 if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
385 int foo_hid(void) __attribute__((visibility("hidden")));
386 int foo_int(void) __attribute__((visibility("internal")));
387 int foo_pro(void) __attribute__((visibility("protected")));''',
388 name : '__attribute__((visibility(...)))')
389 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
391 if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
392 name : '__attribute__((alias(...)))')
393 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
396 # TODO: this is very incomplete
397 if host_machine.system() == 'linux'
398 pre_args += '-D_GNU_SOURCE'
401 # Check for generic C arguments
403 foreach a : ['-Wall', '-Werror=implicit-function-declaration',
404 '-Werror=missing-prototypes', '-fno-math-errno',
405 '-fno-trapping-math', '-Qunused-arguments']
406 if cc.has_argument(a)
411 if cc.has_argument('-fvisibility=hidden')
412 c_vis_args += '-fvisibility=hidden'
415 # Check for generic C++ arguments
416 cpp = meson.get_compiler('cpp')
418 foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
419 '-Qunused-arguments', '-Wno-non-virtual-dtor']
420 if cpp.has_argument(a)
425 if cpp.has_argument('-fvisibility=hidden')
426 cpp_vis_args += '-fvisibility=hidden'
429 # Check for C and C++ arguments for MSVC2013 compatibility. These are only used
430 # in parts of the mesa code base that need to compile with old versions of
431 # MSVC, mainly common code
432 c_msvc_compat_args = []
433 cpp_msvc_compat_args = []
434 foreach a : ['-Werror=pointer-arith', '-Werror=vla']
435 if cc.has_argument(a)
436 c_msvc_compat_args += a
438 if cpp.has_argument(a)
439 cpp_msvc_compat_args += a
443 no_override_init_args = []
444 foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
445 if cc.has_argument(a)
446 no_override_init_args += a
450 # TODO: SSE41 (which is only required for core mesa)
452 # Check for GCC style atomics
453 if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
454 name : 'GCC atomic builtins')
455 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
457 if not cc.links('''#include <stdint.h>
460 return __sync_add_and_fetch(&v, (uint64_t)1);
462 name : 'GCC 64bit atomics')
463 pre_args += '-DMISSING_64_BIT_ATOMICS'
468 # TODO: shared/static? Is this even worth doing?
470 # I don't think that I need to set any of the debug stuff, I think meson
471 # handles that for us
475 # TODO: texture-float (gallium/mesa only)
477 # TODO: cross-compiling. I don't think this is relavent to meson
479 # FIXME: enable asm when cross compiler
480 # This is doable (autotools does it), but it's not of immediate concern
481 if meson.is_cross_build()
482 message('Cross compiling, disabling asm')
488 # TODO: SPARC and PPC
489 if host_machine.cpu_family() == 'x86'
490 if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
491 with_asm_arch = 'x86'
492 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
495 elif host_machine.cpu_family() == 'x86_64'
496 if host_machine.system() == 'linux'
497 with_asm_arch = 'x86_64'
498 pre_args += ['-DUSE_X86_64_ASM']
500 elif host_machine.cpu_family() == 'arm'
501 if host_machine.system() == 'linux'
502 with_asm_arch = 'arm'
503 pre_args += ['-DUSE_ARM_ASM']
505 elif host_machine.cpu_family() == 'aarch64'
506 if host_machine.system() == 'linux'
507 with_asm_arch = 'aarch64'
508 pre_args += ['-DUSE_AARCH64_ASM']
513 # Check for standard headers and functions
514 if cc.has_header_symbol('sys/sysmacros.h', 'major')
515 pre_args += '-DMAJOR_IN_SYSMACROS'
516 elif cc.has_header_symbol('sys/mkdev.h', 'major')
517 pre_args += '-DMAJOR_IN_MKDEV'
520 foreach h : ['xlocale.h', 'sys/sysctl.h']
522 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
526 foreach f : ['strtof', 'mkostemp', 'posix_memalign']
527 if cc.has_function(f)
528 pre_args += '-DHAVE_@0@'.format(f.to_upper())
532 # strtod locale support
537 #ifdef HAVE_XLOCALE_H
541 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
542 const char *s = "1.0";
544 double d = strtod_l(s, end, loc);
545 float f = strtod_l(s, end, loc);
549 extra_args : pre_args,
550 name : 'strtod has locale support')
551 pre_args += '-DHAVE_STRTOD_L'
554 # Check for some linker flags
555 ld_args_bsymbolic = []
556 if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
557 ld_args_bsymbolic += '-Wl,-Bsymbolic'
559 ld_args_gc_sections = []
560 if cc.links('static char unused() { return 5; } int main() { return 0; }',
561 args : '-Wl,--gc-sections', name : 'gc-sections')
562 ld_args_gc_sections += '-Wl,--gc-sections'
564 with_ld_version_script = false
565 if cc.links('int main() { return 0; }',
566 args : '-Wl,--version-script=@0@'.format(
567 join_paths(meson.source_root(), 'build-support/conftest.map')),
568 name : 'version-script')
569 with_ld_version_script = true
571 with_ld_dynamic_list = false
572 if cc.links('int main() { return 0; }',
573 args : '-Wl,--dynamic-list=@0@'.format(
574 join_paths(meson.source_root(), 'build-support/conftest.dyn')),
575 name : 'dynamic-list')
576 with_ld_dynamic_list = true
579 # check for dl support
580 if cc.has_function('dlopen')
583 dep_dl = cc.find_library('dl')
585 if cc.has_function('dladdr', dependencies : dep_dl)
586 # This is really only required for megadrivers
587 pre_args += '-DHAVE_DLADDR'
590 if cc.has_function('dl_iterate_phdr')
591 pre_args += '-DHAVE_DL_ITERATE_PHDR'
593 # TODO: this is required for vulkan
596 # Determine whether or not the rt library is needed for time functions
597 if cc.has_function('clock_gettime')
600 dep_clock = cc.find_library('rt')
603 with_gallium_drisw_kms = false
604 dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
605 required : with_dri2 or with_dri3)
606 if dep_libdrm.found()
607 pre_args += '-DHAVE_LIBDRM'
608 if with_dri_platform == 'drm' and with_dri
609 with_gallium_drisw_kms = true
613 # TODO: some of these may be conditional
614 dep_zlib = dependency('zlib', version : '>= 1.2.3')
615 dep_thread = dependency('threads')
616 if dep_thread.found() and host_machine.system() == 'linux'
617 pre_args += '-DHAVE_PTHREAD'
619 dep_elf = dependency('libelf', required : false)
620 if not dep_elf.found() and (with_amd_vk or with_gallium_radeonsi) # TODO: clover, r600
621 dep_elf = cc.find_library('elf')
623 dep_expat = dependency('expat')
624 # this only exists on linux so either this is linux and it will be found, or
625 # its not linux and and wont
626 dep_m = cc.find_library('m', required : false)
628 dep_libdrm_amdgpu = []
629 dep_libdrm_radeon = []
630 dep_libdrm_nouveau = []
631 dep_libdrm_etnaviv = []
632 dep_libdrm_freedreno = []
633 if with_amd_vk or with_gallium_radeonsi
634 dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.85')
636 if with_gallium_radeonsi or with_dri_r100 or with_dri_r200
637 dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
639 if with_gallium_nouveau or with_dri_nouveau
640 dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
642 if with_gallium_etnaviv
643 dep_libdrm_etnaviv = dependency('libdrm_etnaviv', version : '>= 2.4.82')
645 if with_gallium_freedreno
646 dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>= 2.4.74')
649 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
651 llvm_modules += ['amdgpu', 'bitreader', 'ipo']
653 dep_llvm = dependency(
654 'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules,
658 _llvm_version = dep_llvm.version().split('.')
659 # Development versions of LLVM have an 'svn' suffix, we don't want that for
660 # our version checks.
661 _llvm_patch = _llvm_version[2]
662 if _llvm_patch.endswith('svn')
663 _llvm_patch = _llvm_patch.split('s')[0]
666 '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
667 '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
670 if with_gallium_softpipe
671 error('Cannot find LLVM to build LLVMPipe. If you wanted softpipe pass -Dllvm=false to meson')
672 elif with_amd_vk or with_gallium_radeonsi # etc
673 error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM was not found.')
676 elif with_amd_vk or with_gallium_radeonsi
677 error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM is disabled.')
682 dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
683 pre_args += '-DUSE_LIBGLVND=1'
686 # TODO: make this conditional
687 dep_valgrind = dependency('valgrind', required : false)
688 if dep_valgrind.found() and with_valgrind
689 pre_args += '-DHAVE_VALGRIND'
692 # pthread stubs. Lets not and say we didn't
694 prog_bison = find_program('bison', required : with_any_opengl)
695 prog_flex = find_program('flex', required : with_any_opengl)
700 # TODO: llvm-prefix and llvm-shared-libs
702 dep_unwind = dependency('libunwind', required : false)
703 if dep_unwind.found() and with_libunwind
704 pre_args += '-DHAVE_LIBUNWIND'
707 # TODO: flags for opengl, gles, dri
713 # TODO: osmesa provider
715 # TODO: symbol mangling
717 if with_platform_wayland
718 prog_wl_scanner = find_program('wayland-scanner')
719 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
720 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
721 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
722 wayland_dmabuf_xml = join_paths(
723 dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
724 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
726 pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
729 dep_wl_protocols = []
730 dep_wayland_client = []
731 dep_wayland_server = []
732 wayland_dmabuf_xml = ''
752 if with_glx == 'dri' and with_dri_platform == 'drm'
753 dep_x11 = dependency('x11')
754 dep_xext = dependency('xext')
755 dep_xdamage = dependency('xdamage', version : '>= 1.1')
756 dep_xfixes = dependency('xfixes')
757 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
758 dep_xf86vm = dependency('xxf86vm', required : false)
760 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
761 dep_xcb = dependency('xcb')
762 dep_x11_xcb = dependency('x11-xcb')
763 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
766 pre_args += '-DHAVE_DRI3'
767 dep_xcb_dri3 = dependency('xcb-dri3')
768 dep_xcb_present = dependency('xcb-present')
769 dep_xcb_sync = dependency('xcb-sync')
770 dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
773 if with_glx != 'disabled'
774 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
775 dep_glproto = dependency('glproto', version : '>= 1.4.14')
778 dep_xcb_xfixes = dependency('xcb-xfixes')
784 # TODO: vallium G3DVL
790 # TODO: gallium tests
792 # TODO: various libdirs
796 # TODO: gallium driver dirs
798 # FIXME: this is a workaround for #2326
799 prog_touch = find_program('touch')
800 dummy_cpp = custom_target(
802 output : 'dummy.cpp',
803 command : [prog_touch, '@OUTPUT@'],
807 add_project_arguments(a, language : ['c', 'cpp'])
810 add_project_arguments(a, language : ['c'])
813 add_project_arguments(a, language : ['cpp'])
816 inc_include = include_directories('include')
819 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
820 'xcb-glx >= 1.8.1', 'libdrm >= 2.4.75',
822 if dep_xf86vm != [] and dep_xf86vm.found()
823 gl_priv_reqs += 'xf86vm'
825 if with_dri_platform == 'drm'
826 gl_priv_reqs += 'xcb-dri2 >= 1.8'
830 if dep_thread.found()
831 gl_priv_libs += ['-lpthread', '-pthread']
834 gl_priv_libs += '-lm'
837 gl_priv_libs += '-ldl'
840 pkg = import('pkgconfig')