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