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