blob: 79ee1a334593312ba231a6bd9fea17327284f8ce [file] [log] [blame]
Dylan Bakerd1992252017-09-14 17:57:17 -07001# 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
21project('mesa', ['c', 'cpp'], version : '17.3.0-devel', license : 'MIT',
Dylan Baker052c0d52017-09-30 20:04:09 -070022 default_options : ['c_std=c99', 'cpp_std=c++11'])
Dylan Bakerd1992252017-09-14 17:57:17 -070023
Dylan Baker32180562017-09-20 20:11:32 -070024# 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++.
27pre_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]
35
Dylan Bakere915b8d2017-09-28 14:02:51 -070036with_vulkan_icd_dir = get_option('vulkan-icd-dir')
Dylan Bakerd1992252017-09-14 17:57:17 -070037with_tests = get_option('build-tests')
38with_valgrind = get_option('valgrind')
Dylan Baker32180562017-09-20 20:11:32 -070039with_asm = get_option('asm')
40
41# XXX: yeah, do these
42with_appledri = false
43with_windowsdri = false
44
Dylan Bakerdb978842017-09-28 13:59:04 -070045dri_drivers_path = get_option('dri-drivers-path')
46if dri_drivers_path == ''
47 dri_drivers_path = join_paths(get_option('libdir'), 'dri')
48endif
49
Dylan Baker32180562017-09-20 20:11:32 -070050with_gles1 = get_option('gles1')
51with_gles2 = get_option('gles2')
52with_opengl = get_option('opengl')
53with_any_opengl = with_opengl or with_gles1 or with_gles2
Dylan Bakera47c5252017-09-22 12:55:00 -070054# Only build shared_glapi if at least one OpenGL API is enabled
55with_shared_glapi = get_option('shared-glapi') and with_any_opengl
Dylan Baker32180562017-09-20 20:11:32 -070056
57# TODO: these will need options, but at the moment they just control header
58# installs
Dylan Baker32180562017-09-20 20:11:32 -070059with_osmesa = false
60
61# shared-glapi is required if at least two OpenGL APIs are being built
62if not with_shared_glapi
63 if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
64 or (with_gles2 and with_opengl))
65 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
66 endif
67endif
68
69# We require OpenGL for OpenGL ES
70if (with_gles1 or with_gles2) and not with_opengl
71 error('building OpenGL ES without OpenGL is not supported.')
72endif
73
74with_dri = false
75with_dri_i965 = false
76_drivers = get_option('dri-drivers')
77if _drivers != ''
78 _split = _drivers.split(',')
79 with_dri_i965 = _split.contains('i965')
80 with_dri = true
81endif
82
83if not with_dri
84 with_gles1 = false
85 with_gles2 = false
86 with_opengl = false
87 with_any_opengl = false
88 with_shared_glapi = false
89endif
Dylan Bakerd1992252017-09-14 17:57:17 -070090
Dylan Bakera47c5252017-09-22 12:55:00 -070091# TODO: other OSes
92with_dri_platform = 'drm'
93
94with_gallium = false
95# TODO: gallium drivers
96
97# TODO: conditionalize libdrm requirement
98dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
99pre_args += '-DHAVE_LIBDRM'
100
101with_dri2 = with_dri_platform == 'drm' and dep_libdrm.found()
102with_dri3 = get_option('dri3')
103if with_dri3 == 'auto'
Dylan Baker816bf7d12017-09-28 15:53:53 -0700104 if host_machine.system() == 'linux' and with_dri2
Dylan Bakera47c5252017-09-22 12:55:00 -0700105 with_dri3 = true
106 else
107 with_dri3 = false
108 endif
109elif with_dri3 == 'yes'
Dylan Baker816bf7d12017-09-28 15:53:53 -0700110 if not with_dri2
111 error('dri3 support requires libdrm')
112 endif
Dylan Bakera47c5252017-09-22 12:55:00 -0700113 with_dri3 = true
114else
115 with_dri3 = false
116endif
117
Dylan Bakerd1992252017-09-14 17:57:17 -0700118# TODO: there are more platforms required for non-vulkan drivers
119with_platform_wayland = false
120with_platform_x11 = false
121_platforms = get_option('platforms')
122if _platforms != ''
123 _split = _platforms.split(',')
124 with_platform_x11 = _split.contains('x11')
125 with_platform_wayland = _split.contains('wayland')
126endif
127
Dylan Baker816bf7d12017-09-28 15:53:53 -0700128with_gbm = get_option('gbm')
129if with_gbm == 'auto' and with_dri # TODO: or gallium
130 with_gbm = host_machine.system() == 'linux'
131elif with_gbm == 'yes'
132 if not ['linux', 'bsd'].contains(host_machine.system())
133 error('GBM only supports unix-like platforms')
134 endif
135 with_gbm = true
136else
137 with_gbm = false
138endif
139
Dylan Bakera47c5252017-09-22 12:55:00 -0700140with_glx = get_option('glx')
141if with_glx != 'disabled'
142 pre_args += '-DGLX_USE_TLS'
143 if not (with_platform_x11 and with_any_opengl) and with_glx != 'auto'
144 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
145 elif with_glx == 'gallium-xlib'
146 if not with_gallium
147 error('Gallium-xlib based GLX requires at least one gallium driver')
148 elif with_dri
149 error('gallium-xlib conflicts with any dri driver')
150 endif
151 elif with_glx == 'dri' and not with_dri
152 error('dri based GLX requires at least one DRI driver')
153 elif with_glx == 'auto'
154 if with_dri
155 with_glx = 'dri'
156 elif with_gallium
157 with_glx = 'gallium-xlib'
158 elif with_platform_x11 and with_any_opengl
159 with_glx = 'xlib'
160 else
161 with_glx = 'disabled'
162 endif
163 endif
164endif
165
166with_glvnd = get_option('glvnd')
167if with_glvnd and with_glx != 'dri'
168 message('glvnd requires dri based glx')
169endif
170
171# TODO: toggle for this
172with_glx_direct = true
173
Dylan Bakerd1992252017-09-14 17:57:17 -0700174if with_vulkan_icd_dir == ''
175 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
176endif
177
178with_intel_vk = false
179with_amd_vk = false
Dylan Bakera47c5252017-09-22 12:55:00 -0700180with_any_vk = false
Dylan Bakerd1992252017-09-14 17:57:17 -0700181_vulkan_drivers = get_option('vulkan-drivers')
182if _vulkan_drivers != ''
183 _split = _vulkan_drivers.split(',')
184 with_intel_vk = _split.contains('intel')
185 with_amd_vk = _split.contains('amd')
Dylan Bakera47c5252017-09-22 12:55:00 -0700186 with_any_vk = with_amd_vk or with_intel_vk
Dylan Bakerd1992252017-09-14 17:57:17 -0700187 if not (with_platform_x11 or with_platform_wayland)
188 error('Vulkan requires at least one platform (x11, wayland)')
189 endif
Dylan Bakera47c5252017-09-22 12:55:00 -0700190 if with_platform_x11 and not with_dri3
191 error('Vulkan drivers require dri3 for X11 support')
192 endif
193endif
194
195if with_dri # TODO: or gallium
196 if with_glx == 'disabled' # TODO: or egl
197 error('building dri or gallium drivers require at least one window system')
198 endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700199endif
200
201prog_python2 = find_program('python2')
Dylan Baker9342a7d2017-09-28 10:48:30 -0700202has_mako = run_command(prog_python2, '-c', 'import mako')
203if has_mako.returncode() != 0
204 error('Python (2.x) mako module required to build mesa.')
205endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700206
207cc = meson.get_compiler('c')
208if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
Eric Engestrom1262e822017-09-29 15:25:18 +0100209 error('When using GCC, version 4.4.6 or later is required.')
Dylan Bakerd1992252017-09-14 17:57:17 -0700210endif
211
Dylan Bakerd1992252017-09-14 17:57:17 -0700212# Define DEBUG for debug and debugoptimized builds
213if get_option('buildtype').startswith('debug')
214 pre_args += '-DDEBUG'
215endif
216
Dylan Baker673dda82017-09-20 11:53:29 -0700217if get_option('shader-cache')
218 pre_args += '-DENABLE_SHADER_CACHE'
219elif with_amd_vk
220 error('Radv requires shader cache support')
221endif
222
Dylan Bakerd1992252017-09-14 17:57:17 -0700223# Check for GCC style builtins
224foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
225 'ffsll', 'popcount', 'popcountll', 'unreachable']
226 if cc.has_function(b)
227 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
228 endif
229endforeach
230
Dylan Baker673dda82017-09-20 11:53:29 -0700231# check for GCC __attribute__
Dylan Bakerd1992252017-09-14 17:57:17 -0700232foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
233 'warn_unused_result', 'weak',]
234 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
235 name : '__attribute__((@0@))'.format(a))
236 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
237 endif
238endforeach
239if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
240 name : '__attribute__((format(...)))')
241 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
242endif
243if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
244 name : '__attribute__((packed))')
245 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
246endif
247if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
248 name : '__attribute__((returns_nonnull))')
249 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
250endif
251if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
252 int foo_hid(void) __attribute__((visibility("hidden")));
253 int foo_int(void) __attribute__((visibility("internal")));
254 int foo_pro(void) __attribute__((visibility("protected")));''',
255 name : '__attribute__((visibility(...)))')
256 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
257endif
258if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
259 name : '__attribute__((alias(...)))')
260 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
261endif
262
263# TODO: this is very incomplete
264if host_machine.system() == 'linux'
265 pre_args += '-D_GNU_SOURCE'
266endif
267
268# Check for generic C arguments
269c_args = []
270foreach a : ['-Wall', '-Werror=implicit-function-declaration',
271 '-Werror=missing-prototypes', '-fno-math-errno',
272 '-fno-trapping-math', '-Qunused-arguments']
273 if cc.has_argument(a)
274 c_args += a
275 endif
276endforeach
277c_vis_args = []
278if cc.has_argument('-fvisibility=hidden')
279 c_vis_args += '-fvisibility=hidden'
280endif
281
282# Check for generic C++ arguments
283cpp = meson.get_compiler('cpp')
284cpp_args = []
285foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
286 '-Qunused-arguments', '-Wno-non-virtual-dtor']
287 if cpp.has_argument(a)
288 cpp_args += a
289 endif
290endforeach
291cpp_vis_args = []
292if cpp.has_argument('-fvisibility=hidden')
293 cpp_vis_args += '-fvisibility=hidden'
294endif
295
296# Check for C and C++ arguments for MSVC2013 compatibility. These are only used
297# in parts of the mesa code base that need to compile with old versions of
298# MSVC, mainly common code
299c_msvc_compat_args = []
300cpp_msvc_compat_args = []
301foreach a : ['-Werror=pointer-arith', '-Werror=vla']
302 if cc.has_argument(a)
303 c_msvc_compat_args += a
304 endif
305 if cpp.has_argument(a)
306 cpp_msvc_compat_args += a
307 endif
308endforeach
309
310no_override_init_args = []
311foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
312 if cc.has_argument(a)
313 no_override_init_args += a
314 endif
315endforeach
316
317# TODO: SSE41 (which is only required for core mesa)
318
319# Check for GCC style atomics
320if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
321 name : 'GCC atomic builtins')
322 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
323endif
324if not cc.links('''#include <stdint.h>
325 uint64_t v;
326 int main() {
327 return __sync_add_and_fetch(&v, (uint64_t)1);
328 }''',
329 name : 'GCC 64bit atomics')
330 pre_args += '-DMISSING_64_BIT_ATOMICS'
331endif
332
333# TODO: endian
334# TODO: powr8
335# TODO: shared/static? Is this even worth doing?
336
337# I don't think that I need to set any of the debug stuff, I think meson
338# handles that for us
339
340# TODO: ldflags
341
342# TODO: texture-float (gallium/mesa only)
343
344# TODO: cross-compiling. I don't think this is relavent to meson
345
Dylan Baker32180562017-09-20 20:11:32 -0700346# FIXME: enable asm when cross compiler
347# This is doable (autotools does it), but it's not of immediate concern
348if meson.is_cross_build()
349 message('Cross compiling, disabling asm')
350 with_asm = false
351endif
352
353with_asm_arch = ''
354if with_asm
355 # TODO: SPARC and PPC
356 if host_machine.cpu_family() == 'x86'
357 if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
358 with_asm_arch = 'x86'
359 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
360 '-DUSE_SSE_ASM']
361 endif
362 elif host_machine.cpu_family() == 'x86_64'
363 if host_machine.system() == 'linux'
364 with_asm_arch = 'x86_64'
365 pre_args += ['-DUSE_X86_64_ASM']
366 endif
367 elif host_machine.cpu_family() == 'arm'
368 if host_machine.system() == 'linux'
369 with_asm_arch = 'arm'
370 pre_args += ['-DUSE_ARM_ASM']
371 endif
372 elif host_machine.cpu_family() == 'aarch64'
373 if host_machine.system() == 'linux'
374 with_asm_arch = 'aarch64'
375 pre_args += ['-DUSE_AARCH64_ASM']
376 endif
377 endif
378endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700379
380# Check for standard headers and functions
381if cc.has_header_symbol('sys/sysmacros.h', 'major')
382 pre_args += '-DMAJOR_IN_SYSMACROS'
383elif cc.has_header_symbol('sys/mkdev.h', 'major')
384 pre_args += '-DMAJOR_IN_MKDEV'
385endif
386
387foreach h : ['xlocale.h', 'sys/sysctl.h']
388 if cc.has_header(h)
389 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
390 endif
391endforeach
392
393foreach f : ['strtof', 'mkostemp', 'posix_memalign']
394 if cc.has_function(f)
395 pre_args += '-DHAVE_@0@'.format(f.to_upper())
396 endif
397endforeach
398
399# strtod locale support
400if cc.links('''
401 #define _GNU_SOURCE
402 #include <stdlib.h>
403 #include <locale.h>
404 #ifdef HAVE_XLOCALE_H
405 #include <xlocale.h>
406 #endif
407 int main() {
408 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
409 const char *s = "1.0";
410 char *end;
411 double d = strtod_l(s, end, loc);
412 float f = strtod_l(s, end, loc);
413 freelocale(loc);
414 return 0;
415 }''',
416 extra_args : pre_args,
417 name : 'strtod has locale support')
418 pre_args += '-DHAVE_STRTOD_L'
419endif
420
421# Check for some linker flags
422ld_args_bsymbolic = []
423if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic')
424 ld_args_bsymbolic += '-Wl,-Bsymbolic'
425endif
426ld_args_gc_sections = []
427if cc.links('static char unused() { return 5; } int main() { return 0; }',
428 args : '-Wl,--gc-sections')
429 ld_args_gc_sections += '-Wl,--gc-sections'
430endif
431
432# check for dl support
433if cc.has_function('dlopen')
434 dep_dl = []
435else
436 dep_dl = cc.find_library('dl')
437endif
Dylan Baker32180562017-09-20 20:11:32 -0700438if cc.has_function('dladdr', dependencies : dep_dl)
439 # This is really only required for megadrivers
440 pre_args += '-DHAVE_DLADDR'
Dylan Bakerd1992252017-09-14 17:57:17 -0700441endif
442
443if cc.has_function('dl_iterate_phdr')
444 pre_args += '-DHAVE_DL_ITERATE_PHDR'
445else
446 # TODO: this is required for vulkan
447endif
448
449# Determine whether or not the rt library is needed for time functions
450if cc.has_function('clock_gettime')
451 dep_clock = []
452else
453 dep_clock = cc.find_library('rt')
454endif
455
456# TODO: some of these may be conditional
457dep_zlib = dependency('zlib', version : '>= 1.2.3')
458dep_thread = dependency('threads')
459pre_args += '-DHAVE_PTHREAD'
Dylan Bakercc4f5872017-09-27 11:30:21 -0700460dep_elf = dependency('libelf', required : false)
461if not dep_elf.found()
Dylan Baker97aea7d2017-10-04 11:36:06 -0700462 dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover, r600, radeonsi
Dylan Bakercc4f5872017-09-27 11:30:21 -0700463endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700464dep_expat = dependency('expat')
465# this only exists on linux so either this is linux and it will be found, or
466# its not linux and and wont
467dep_m = cc.find_library('m', required : false)
468
Dylan Baker673dda82017-09-20 11:53:29 -0700469dep_libdrm_amdgpu = []
470if with_amd_vk
471 dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82')
472endif
473
474llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
475if with_amd_vk
476 llvm_modules += ['amdgpu', 'bitreader', 'ipo']
477endif
478dep_llvm = dependency(
479 'llvm', version : '>= 3.9.0', required : false, modules : llvm_modules,
480)
481if not dep_llvm.found()
482 if with_amd_vk
483 error('Radv requires llvm.')
484 endif
485else
486 _llvm_version = dep_llvm.version().split('.')
487 # Development versions of LLVM have an 'svn' suffix, we don't want that for
488 # our version checks.
489 _llvm_patch = _llvm_version[2]
490 if _llvm_patch.endswith('svn')
491 _llvm_patch = _llvm_patch.split('s')[0]
492 endif
493 pre_args += [
494 '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
495 '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
496 ]
497endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700498
Dylan Bakera47c5252017-09-22 12:55:00 -0700499dep_glvnd = []
500if with_glvnd
501 dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
502 pre_args += '-DUSE_LIBGLVND=1'
503endif
504
Dylan Bakerd1992252017-09-14 17:57:17 -0700505# TODO: make this conditional
506dep_valgrind = dependency('valgrind', required : false)
507if dep_valgrind.found() and with_valgrind
508 pre_args += '-DHAVE_VALGRIND'
509endif
510
511# pthread stubs. Lets not and say we didn't
512
Dylan Baker32180562017-09-20 20:11:32 -0700513prog_bison = find_program('bison', required : with_any_opengl)
514prog_flex = find_program('flex', required : with_any_opengl)
515
Dylan Bakerd1992252017-09-14 17:57:17 -0700516# TODO: selinux
Dylan Baker32180562017-09-20 20:11:32 -0700517dep_selinux = []
Dylan Bakerd1992252017-09-14 17:57:17 -0700518
519# TODO: llvm-prefix and llvm-shared-libs
520
Dylan Bakerd1992252017-09-14 17:57:17 -0700521# TODO: unwind (llvm [radeon, gallivm] and gallium)
522
523# TODO: flags for opengl, gles, dri
524
525# TODO: gallium-hud
526
527# TODO: glx provider
528
529# TODO: osmesa provider
530
531# TODO: flags for xa, egl, gbm, nin, xvmc, vdpau, omx, va, opencl,
532# gallium-tests,
533
534# TODO: gallium drivers
535
Dylan Bakerd1992252017-09-14 17:57:17 -0700536# TODO: symbol mangling
537
Dylan Bakerd1992252017-09-14 17:57:17 -0700538# TODO: egl configuration
539
540if with_platform_wayland
541 prog_wl_scanner = find_program('wayland-scanner')
542 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
543 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
544 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
545else
546 prog_wl_scanner = []
547 dep_wl_protocols = []
548 dep_wayland_client = []
549 dep_wayland_server = []
550endif
551
552dep_xcb_dri2 = []
553dep_xcb_dri3 = []
Dylan Bakera47c5252017-09-22 12:55:00 -0700554dep_dri2proto = []
555dep_glproto = []
556dep_x11 = []
557dep_xf86vm = []
Dylan Bakerd1992252017-09-14 17:57:17 -0700558if with_platform_x11
Dylan Bakera47c5252017-09-22 12:55:00 -0700559 if with_glx == 'xlib'
560 # TODO
561 error('TODO')
562 elif with_glx == 'gallium-xlib'
563 # TODO
564 error('TODO')
Dylan Bakerd1992252017-09-14 17:57:17 -0700565 else
Dylan Bakera47c5252017-09-22 12:55:00 -0700566 pre_args += '-DGLX_INDIRECT_RENDERING'
567 if with_glx_direct
568 pre_args += '-DGLX_DIRECT_RENDERING'
569 endif
570 if with_dri_platform == 'drm'
571 pre_args += '-DGLX_USE_DRM'
572 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
573 dep_x11 = [
574 dependency('x11'),
575 dependency('xext'),
576 dependency('xdamage', version : '>= 1.1'),
577 dependency('xfixes'),
578 dependency('x11-xcb'),
579 dependency('xcb'),
580 dependency('xcb-glx', version : '>= 1.8.1'),
581 ]
582
583 dep_xf86vm = dependency('xf86vm', required : false)
584 endif
585 # TODO: XF86VIDMODE
586 endif
587 if with_glx != 'disabled'
588 dep_glproto = dependency('glproto', version : '>= 1.4.14')
589 endif
590 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
591 dep_xcb_dri2 = [
592 dependency('x11-xcb'),
593 dependency('xcb'),
594 dependency('xcb-dri2', version : '>= 1.8'),
595 dependency('xcb-xfixes'),
596 ]
597 pre_args += '-DHAVE_X11_PLATFORM'
598 if with_dri3
599 pre_args += '-DHAVE_DRI3'
600 dep_xcb_dri3 = [
601 dep_xcb_dri2,
602 dependency('xcb-dri3'),
603 dependency('xcb-present'),
604 dependency('xcb-sync'),
605 dependency('xshmfence', version : '>= 1.1'),
606 ]
607 endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700608 endif
609endif
610
611# TODO: platforms for !vulkan
612
Dylan Bakerd1992252017-09-14 17:57:17 -0700613# TODO: osmesa
614
615# TODO: egl
616
617# TODO: xa
618
619# TODO: vallium G3DVL
620
621# TODO: nine
622
623# TODO: clover
624
625# TODO: egl sans x11
626
627# TODO: xvmc
628
629# TODO: gallium tests
630
631# TODO: various libdirs
632
633# TODO: swr
634
635# TODO: gallium driver dirs
636
637# FIXME: this is a workaround for #2326
638prog_touch = find_program('touch')
639dummy_cpp = custom_target(
640 'dummy_cpp',
641 output : 'dummy.cpp',
642 command : [prog_touch, '@OUTPUT@'],
643)
644
645foreach a : pre_args
646 add_project_arguments(a, language : ['c', 'cpp'])
647endforeach
648foreach a : c_args
649 add_project_arguments(a, language : ['c'])
650endforeach
651foreach a : cpp_args
652 add_project_arguments(a, language : ['cpp'])
653endforeach
654
655inc_include = include_directories('include')
656
Dylan Baker32180562017-09-20 20:11:32 -0700657pkg = import('pkgconfig')
658
Dylan Bakerd1992252017-09-14 17:57:17 -0700659subdir('include')
660subdir('src')