meson: build nouveau (gallium) driver
[mesa.git] / meson.build
1 # Copyright © 2017 Intel Corporation
2
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
9
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
12
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE.
20
21 project('mesa', ['c', 'cpp'], version : '17.3.0-devel', license : 'MIT',
22 default_options : ['c_std=c99', 'cpp_std=c++11'])
23
24 # Arguments for the preprocessor, put these in a separate array from the C and
25 # C++ (cpp in meson terminology) arguments since they need to be added to the
26 # default arguments for both C and C++.
27 pre_args = [
28 '-D__STDC_CONSTANT_MACROS',
29 '-D__STDC_FORMAT_MACROS',
30 '-D__STDC_LIMIT_MACROS',
31 '-DVERSION="@0@"'.format(meson.project_version()),
32 '-DPACKAGE_VERSION=VERSION',
33 '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"',
34 '-D_GNU_SOURCE',
35 ]
36
37 with_vulkan_icd_dir = get_option('vulkan-icd-dir')
38 with_tests = get_option('build-tests')
39 with_valgrind = get_option('valgrind')
40 with_asm = get_option('asm')
41 with_llvm = get_option('llvm')
42 if get_option('texture-float')
43 pre_args += '-DTEXTURE_FLOAT_ENABLED'
44 message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.')
45 endif
46
47 # XXX: yeah, do these
48 with_appledri = false
49 with_windowsdri = false
50
51 dri_drivers_path = get_option('dri-drivers-path')
52 if dri_drivers_path == ''
53 dri_drivers_path = join_paths(get_option('libdir'), 'dri')
54 endif
55
56 with_gles1 = get_option('gles1')
57 with_gles2 = get_option('gles2')
58 with_opengl = get_option('opengl')
59 with_any_opengl = with_opengl or with_gles1 or with_gles2
60 # Only build shared_glapi if at least one OpenGL API is enabled
61 with_shared_glapi = get_option('shared-glapi') and with_any_opengl
62
63 # TODO: these will need options, but at the moment they just control header
64 # installs
65 with_osmesa = false
66
67 # shared-glapi is required if at least two OpenGL APIs are being built
68 if not with_shared_glapi
69 if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
70 or (with_gles2 and with_opengl))
71 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
72 endif
73 endif
74
75 # We require OpenGL for OpenGL ES
76 if (with_gles1 or with_gles2) and not with_opengl
77 error('building OpenGL ES without OpenGL is not supported.')
78 endif
79
80 with_dri = false
81 with_dri_i915 = false
82 with_dri_i965 = false
83 with_dri_swrast = false
84 _drivers = get_option('dri-drivers')
85 if _drivers != ''
86 _split = _drivers.split(',')
87 with_dri_i915 = _split.contains('i915')
88 with_dri_i965 = _split.contains('i965')
89 with_dri_swrast = _split.contains('swrast')
90 with_dri = true
91 endif
92
93 with_gallium = false
94 with_gallium_radeonsi = false
95 with_gallium_nouveau = false
96 with_gallium_softpipe = false
97 _drivers = get_option('gallium-drivers')
98 if _drivers != ''
99 _split = _drivers.split(',')
100 with_gallium_radeonsi = _split.contains('radeonsi')
101 with_gallium_nouveau = _split.contains('nouveau')
102 with_gallium = true
103 with_dri = true
104 endif
105
106 if not (with_dri or with_gallium)
107 with_gles1 = false
108 with_gles2 = false
109 with_opengl = false
110 with_any_opengl = false
111 with_shared_glapi = false
112 endif
113
114 dep_libdrm_intel = []
115 if with_dri_i915
116 dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
117 endif
118
119 # TODO: other OSes
120 with_dri_platform = 'drm'
121
122 # TODO: there are more platforms required for non-vulkan drivers
123 with_platform_wayland = false
124 with_platform_x11 = false
125 with_platform_drm = false
126 _platforms = get_option('platforms')
127 if _platforms != ''
128 _split = _platforms.split(',')
129 with_platform_x11 = _split.contains('x11')
130 with_platform_wayland = _split.contains('wayland')
131 with_platform_drm = _split.contains('drm')
132 endif
133
134 with_gbm = get_option('gbm')
135 if with_gbm == 'auto' and with_dri # TODO: or gallium
136 with_gbm = host_machine.system() == 'linux'
137 elif with_gbm == 'yes'
138 if not ['linux', 'bsd'].contains(host_machine.system())
139 error('GBM only supports unix-like platforms')
140 endif
141 with_gbm = true
142 else
143 with_gbm = false
144 endif
145
146 pre_args += '-DGLX_USE_TLS'
147 with_glx = get_option('glx')
148 if with_glx != 'disabled'
149 if not (with_platform_x11 and with_any_opengl) and with_glx != 'auto'
150 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
151 elif with_glx == 'gallium-xlib'
152 if not with_gallium
153 error('Gallium-xlib based GLX requires at least one gallium driver')
154 elif with_dri
155 error('gallium-xlib conflicts with any dri driver')
156 endif
157 elif with_glx == 'dri' and not with_dri
158 error('dri based GLX requires at least one DRI driver')
159 elif with_glx == 'auto'
160 if with_dri
161 with_glx = 'dri'
162 elif with_gallium
163 with_glx = 'gallium-xlib'
164 elif with_platform_x11 and with_any_opengl
165 with_glx = 'xlib'
166 else
167 with_glx = 'disabled'
168 endif
169 endif
170 endif
171
172 with_glvnd = get_option('glvnd')
173 if with_glvnd and with_glx != 'dri'
174 message('glvnd requires dri based glx')
175 endif
176
177 # TODO: toggle for this
178 with_glx_direct = true
179
180 if with_vulkan_icd_dir == ''
181 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
182 endif
183
184 with_intel_vk = false
185 with_amd_vk = false
186 with_any_vk = false
187 _vulkan_drivers = get_option('vulkan-drivers')
188 if _vulkan_drivers != ''
189 _split = _vulkan_drivers.split(',')
190 with_intel_vk = _split.contains('intel')
191 with_amd_vk = _split.contains('amd')
192 with_any_vk = with_amd_vk or with_intel_vk
193 if not (with_platform_x11 or with_platform_wayland)
194 error('Vulkan requires at least one platform (x11, wayland)')
195 endif
196 endif
197
198 with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
199 with_dri3 = get_option('dri3')
200 if with_dri3 == 'auto'
201 if host_machine.system() == 'linux' and with_dri2
202 with_dri3 = true
203 else
204 with_dri3 = false
205 endif
206 elif with_dri3 == 'yes'
207 with_dri3 = true
208 else
209 with_dri3 = false
210 endif
211
212 if with_any_vk and (with_platform_x11 and not with_dri3)
213 error('Vulkan drivers require dri3 for X11 support')
214 endif
215 if with_dri or with_gallium
216 if with_glx == 'disabled' # TODO: or egl
217 error('building dri or gallium drivers require at least one window system')
218 endif
219 endif
220
221 with_gallium_xvmc = false
222 with_gallium_vdpau = false
223 with_gallium_omx = false # this is bellagio
224 with_gallium_va = false
225 with_gallium_media = false
226 dep_va = []
227 _drivers = get_option('gallium-media')
228 if _drivers != ''
229 _split = _drivers.split(',')
230 with_gallium_xvmc = _split.contains('xvmc')
231 with_gallium_vdpau = _split.contains('vdpau')
232 with_gallium_omx = _split.contains('omx')
233 with_gallium_va = _split.contains('va')
234 with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or
235 with_gallium_omx or with_gallium_va)
236 endif
237
238 if with_platform_x11
239 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
240 pre_args += '-DHAVE_X11_PLATFORM'
241 endif
242 if with_glx == 'xlib'
243 # TODO
244 error('TODO')
245 elif with_glx == 'gallium-xlib'
246 # TODO
247 error('TODO')
248 else
249 pre_args += '-DGLX_INDIRECT_RENDERING'
250 if with_glx_direct
251 pre_args += '-DGLX_DIRECT_RENDERING'
252 endif
253 if with_dri_platform == 'drm'
254 pre_args += '-DGLX_USE_DRM'
255 endif
256 endif
257 endif
258
259 prog_python2 = find_program('python2')
260 has_mako = run_command(prog_python2, '-c', 'import mako')
261 if has_mako.returncode() != 0
262 error('Python (2.x) mako module required to build mesa.')
263 endif
264
265 cc = meson.get_compiler('c')
266 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
267 error('When using GCC, version 4.4.6 or later is required.')
268 endif
269
270 # Define DEBUG for debug and debugoptimized builds
271 if get_option('buildtype').startswith('debug')
272 pre_args += '-DDEBUG'
273 endif
274
275 if get_option('shader-cache')
276 pre_args += '-DENABLE_SHADER_CACHE'
277 elif with_amd_vk
278 error('Radv requires shader cache support')
279 endif
280
281 # Check for GCC style builtins
282 foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
283 'ffsll', 'popcount', 'popcountll', 'unreachable']
284 if cc.has_function(b)
285 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
286 endif
287 endforeach
288
289 # check for GCC __attribute__
290 foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
291 'warn_unused_result', 'weak',]
292 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
293 name : '__attribute__((@0@))'.format(a))
294 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
295 endif
296 endforeach
297 if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
298 name : '__attribute__((format(...)))')
299 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
300 endif
301 if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
302 name : '__attribute__((packed))')
303 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
304 endif
305 if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
306 name : '__attribute__((returns_nonnull))')
307 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
308 endif
309 if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
310 int foo_hid(void) __attribute__((visibility("hidden")));
311 int foo_int(void) __attribute__((visibility("internal")));
312 int foo_pro(void) __attribute__((visibility("protected")));''',
313 name : '__attribute__((visibility(...)))')
314 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
315 endif
316 if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
317 name : '__attribute__((alias(...)))')
318 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
319 endif
320
321 # TODO: this is very incomplete
322 if host_machine.system() == 'linux'
323 pre_args += '-D_GNU_SOURCE'
324 endif
325
326 # Check for generic C arguments
327 c_args = []
328 foreach a : ['-Wall', '-Werror=implicit-function-declaration',
329 '-Werror=missing-prototypes', '-fno-math-errno',
330 '-fno-trapping-math', '-Qunused-arguments']
331 if cc.has_argument(a)
332 c_args += a
333 endif
334 endforeach
335 c_vis_args = []
336 if cc.has_argument('-fvisibility=hidden')
337 c_vis_args += '-fvisibility=hidden'
338 endif
339
340 # Check for generic C++ arguments
341 cpp = meson.get_compiler('cpp')
342 cpp_args = []
343 foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
344 '-Qunused-arguments', '-Wno-non-virtual-dtor']
345 if cpp.has_argument(a)
346 cpp_args += a
347 endif
348 endforeach
349 cpp_vis_args = []
350 if cpp.has_argument('-fvisibility=hidden')
351 cpp_vis_args += '-fvisibility=hidden'
352 endif
353
354 # Check for C and C++ arguments for MSVC2013 compatibility. These are only used
355 # in parts of the mesa code base that need to compile with old versions of
356 # MSVC, mainly common code
357 c_msvc_compat_args = []
358 cpp_msvc_compat_args = []
359 foreach a : ['-Werror=pointer-arith', '-Werror=vla']
360 if cc.has_argument(a)
361 c_msvc_compat_args += a
362 endif
363 if cpp.has_argument(a)
364 cpp_msvc_compat_args += a
365 endif
366 endforeach
367
368 no_override_init_args = []
369 foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
370 if cc.has_argument(a)
371 no_override_init_args += a
372 endif
373 endforeach
374
375 # TODO: SSE41 (which is only required for core mesa)
376
377 # Check for GCC style atomics
378 if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
379 name : 'GCC atomic builtins')
380 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
381 endif
382 if not cc.links('''#include <stdint.h>
383 uint64_t v;
384 int main() {
385 return __sync_add_and_fetch(&v, (uint64_t)1);
386 }''',
387 name : 'GCC 64bit atomics')
388 pre_args += '-DMISSING_64_BIT_ATOMICS'
389 endif
390
391 # TODO: endian
392 # TODO: powr8
393 # TODO: shared/static? Is this even worth doing?
394
395 # I don't think that I need to set any of the debug stuff, I think meson
396 # handles that for us
397
398 # TODO: ldflags
399
400 # TODO: texture-float (gallium/mesa only)
401
402 # TODO: cross-compiling. I don't think this is relavent to meson
403
404 # FIXME: enable asm when cross compiler
405 # This is doable (autotools does it), but it's not of immediate concern
406 if meson.is_cross_build()
407 message('Cross compiling, disabling asm')
408 with_asm = false
409 endif
410
411 with_asm_arch = ''
412 if with_asm
413 # TODO: SPARC and PPC
414 if host_machine.cpu_family() == 'x86'
415 if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
416 with_asm_arch = 'x86'
417 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
418 '-DUSE_SSE_ASM']
419 endif
420 elif host_machine.cpu_family() == 'x86_64'
421 if host_machine.system() == 'linux'
422 with_asm_arch = 'x86_64'
423 pre_args += ['-DUSE_X86_64_ASM']
424 endif
425 elif host_machine.cpu_family() == 'arm'
426 if host_machine.system() == 'linux'
427 with_asm_arch = 'arm'
428 pre_args += ['-DUSE_ARM_ASM']
429 endif
430 elif host_machine.cpu_family() == 'aarch64'
431 if host_machine.system() == 'linux'
432 with_asm_arch = 'aarch64'
433 pre_args += ['-DUSE_AARCH64_ASM']
434 endif
435 endif
436 endif
437
438 # Check for standard headers and functions
439 if cc.has_header_symbol('sys/sysmacros.h', 'major')
440 pre_args += '-DMAJOR_IN_SYSMACROS'
441 elif cc.has_header_symbol('sys/mkdev.h', 'major')
442 pre_args += '-DMAJOR_IN_MKDEV'
443 endif
444
445 foreach h : ['xlocale.h', 'sys/sysctl.h']
446 if cc.has_header(h)
447 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
448 endif
449 endforeach
450
451 foreach f : ['strtof', 'mkostemp', 'posix_memalign']
452 if cc.has_function(f)
453 pre_args += '-DHAVE_@0@'.format(f.to_upper())
454 endif
455 endforeach
456
457 # strtod locale support
458 if cc.links('''
459 #define _GNU_SOURCE
460 #include <stdlib.h>
461 #include <locale.h>
462 #ifdef HAVE_XLOCALE_H
463 #include <xlocale.h>
464 #endif
465 int main() {
466 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
467 const char *s = "1.0";
468 char *end;
469 double d = strtod_l(s, end, loc);
470 float f = strtod_l(s, end, loc);
471 freelocale(loc);
472 return 0;
473 }''',
474 extra_args : pre_args,
475 name : 'strtod has locale support')
476 pre_args += '-DHAVE_STRTOD_L'
477 endif
478
479 # Check for some linker flags
480 ld_args_bsymbolic = []
481 if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
482 ld_args_bsymbolic += '-Wl,-Bsymbolic'
483 endif
484 ld_args_gc_sections = []
485 if cc.links('static char unused() { return 5; } int main() { return 0; }',
486 args : '-Wl,--gc-sections', name : 'gc-sections')
487 ld_args_gc_sections += '-Wl,--gc-sections'
488 endif
489 with_ld_version_script = false
490 if cc.links('int main() { return 0; }',
491 args : '-Wl,--version-script=@0@'.format(
492 join_paths(meson.source_root(), 'build-support/conftest.map')),
493 name : 'version-script')
494 with_ld_version_script = true
495 endif
496 with_ld_dynamic_list = false
497 if cc.links('int main() { return 0; }',
498 args : '-Wl,--dynamic-list=@0@'.format(
499 join_paths(meson.source_root(), 'build-support/conftest.dyn')),
500 name : 'dynamic-list')
501 with_ld_dynamic_list = true
502 endif
503
504 # check for dl support
505 if cc.has_function('dlopen')
506 dep_dl = []
507 else
508 dep_dl = cc.find_library('dl')
509 endif
510 if cc.has_function('dladdr', dependencies : dep_dl)
511 # This is really only required for megadrivers
512 pre_args += '-DHAVE_DLADDR'
513 endif
514
515 if cc.has_function('dl_iterate_phdr')
516 pre_args += '-DHAVE_DL_ITERATE_PHDR'
517 else
518 # TODO: this is required for vulkan
519 endif
520
521 # Determine whether or not the rt library is needed for time functions
522 if cc.has_function('clock_gettime')
523 dep_clock = []
524 else
525 dep_clock = cc.find_library('rt')
526 endif
527
528 with_gallium_drisw_kms = false
529 dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
530 required : with_dri2 or with_dri3)
531 if dep_libdrm.found()
532 pre_args += '-DHAVE_LIBDRM'
533 if with_dri_platform == 'drm' and with_dri
534 with_gallium_drisw_kms = true
535 endif
536 endif
537
538 # TODO: some of these may be conditional
539 dep_zlib = dependency('zlib', version : '>= 1.2.3')
540 dep_thread = dependency('threads')
541 if dep_thread.found() and host_machine.system() == 'linux'
542 pre_args += '-DHAVE_PTHREAD'
543 endif
544 dep_elf = dependency('libelf', required : false)
545 if not dep_elf.found() and (with_amd_vk or with_gallium_radeonsi) # TODO: clover, r600
546 dep_elf = cc.find_library('elf')
547 endif
548 dep_expat = dependency('expat')
549 # this only exists on linux so either this is linux and it will be found, or
550 # its not linux and and wont
551 dep_m = cc.find_library('m', required : false)
552
553 dep_libdrm_amdgpu = []
554 dep_libdrm_radeon = []
555 dep_libdrm_nouveau = []
556 if with_amd_vk or with_gallium_radeonsi
557 dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.84')
558 endif
559 if with_gallium_radeonsi # older radeon too
560 dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
561 endif
562 if with_gallium_nouveau
563 dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
564 endif
565
566 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
567 if with_amd_vk
568 llvm_modules += ['amdgpu', 'bitreader', 'ipo']
569 endif
570 dep_llvm = dependency(
571 'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules,
572 )
573 if with_llvm
574 if dep_llvm.found()
575 _llvm_version = dep_llvm.version().split('.')
576 # Development versions of LLVM have an 'svn' suffix, we don't want that for
577 # our version checks.
578 _llvm_patch = _llvm_version[2]
579 if _llvm_patch.endswith('svn')
580 _llvm_patch = _llvm_patch.split('s')[0]
581 endif
582 pre_args += [
583 '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
584 '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
585 ]
586 else
587 if with_amd_vk or with_gallium_radeonsi
588 error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM was not found.')
589 endif
590 endif
591 elif with_amd_vk or with_gallium_radeonsi
592 error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM is disabled.')
593 endif
594
595 dep_glvnd = []
596 if with_glvnd
597 dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
598 pre_args += '-DUSE_LIBGLVND=1'
599 endif
600
601 # TODO: make this conditional
602 dep_valgrind = dependency('valgrind', required : false)
603 if dep_valgrind.found() and with_valgrind
604 pre_args += '-DHAVE_VALGRIND'
605 endif
606
607 # pthread stubs. Lets not and say we didn't
608
609 prog_bison = find_program('bison', required : with_any_opengl)
610 prog_flex = find_program('flex', required : with_any_opengl)
611
612 # TODO: selinux
613 dep_selinux = []
614
615 # TODO: llvm-prefix and llvm-shared-libs
616
617 dep_unwind = dependency('libunwind', required : false)
618 if dep_unwind.found()
619 pre_args += '-DHAVE_LIBUNWIND'
620 endif
621
622 # TODO: flags for opengl, gles, dri
623
624 # TODO: gallium-hud
625
626 # TODO: glx provider
627
628 # TODO: osmesa provider
629
630 # TODO: symbol mangling
631
632 # TODO: egl configuration
633
634 if with_platform_wayland
635 prog_wl_scanner = find_program('wayland-scanner')
636 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
637 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
638 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
639 else
640 prog_wl_scanner = []
641 dep_wl_protocols = []
642 dep_wayland_client = []
643 dep_wayland_server = []
644 endif
645
646 dep_x11 = []
647 dep_xext = []
648 dep_xdamage = []
649 dep_xfixes = []
650 dep_x11_xcb = []
651 dep_xcb_glx = []
652 dep_xcb_dri2 = []
653 dep_xcb_dri3 = []
654 dep_dri2proto = []
655 dep_glproto = []
656 dep_xf86vm = []
657 dep_xcb_dri3 = []
658 dep_xcb_present = []
659 dep_xcb_sync = []
660 dep_xshmfence = []
661 if with_platform_x11
662 if with_glx == 'dri' and with_dri_platform == 'drm'
663 dep_x11 = dependency('x11')
664 dep_xext = dependency('xext')
665 dep_xdamage = dependency('xdamage', version : '>= 1.1')
666 dep_xfixes = dependency('xfixes')
667 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
668 dep_xf86vm = dependency('xf86vm', required : false)
669 endif
670 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
671 dep_xcb = dependency('xcb')
672 dep_x11_xcb = dependency('x11-xcb')
673 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
674
675 if with_dri3
676 pre_args += '-DHAVE_DRI3'
677 dep_xcb_dri3 = dependency('xcb-dri3')
678 dep_xcb_present = dependency('xcb-present')
679 dep_xcb_sync = dependency('xcb-sync')
680 dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
681 endif
682 endif
683 if with_glx != 'disabled'
684 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
685 dep_glproto = dependency('glproto', version : '>= 1.4.14')
686 endif
687 endif
688
689 # TODO: platforms for !vulkan
690
691 # TODO: osmesa
692
693 # TODO: egl
694
695 # TODO: vallium G3DVL
696
697 # TODO: nine
698
699 # TODO: clover
700
701 # TODO: egl sans x11
702 # TODO: gallium tests
703
704 # TODO: various libdirs
705
706 # TODO: swr
707
708 # TODO: gallium driver dirs
709
710 # FIXME: this is a workaround for #2326
711 prog_touch = find_program('touch')
712 dummy_cpp = custom_target(
713 'dummy_cpp',
714 output : 'dummy.cpp',
715 command : [prog_touch, '@OUTPUT@'],
716 )
717
718 foreach a : pre_args
719 add_project_arguments(a, language : ['c', 'cpp'])
720 endforeach
721 foreach a : c_args
722 add_project_arguments(a, language : ['c'])
723 endforeach
724 foreach a : cpp_args
725 add_project_arguments(a, language : ['cpp'])
726 endforeach
727
728 inc_include = include_directories('include')
729
730 pkg = import('pkgconfig')
731
732 subdir('include')
733 subdir('src')