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