blob: 02264aeed4ef3b0e66a9a033a139e3c1b552060c [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
Ville Syrjälä22899642017-10-10 01:15:42 +030075with_dri_i915 = false
Dylan Baker32180562017-09-20 20:11:32 -070076with_dri_i965 = false
Dylan Bakerc2cd5802017-10-03 17:06:22 -070077with_dri_swrast = false
Dylan Baker32180562017-09-20 20:11:32 -070078_drivers = get_option('dri-drivers')
79if _drivers != ''
80 _split = _drivers.split(',')
Ville Syrjälä22899642017-10-10 01:15:42 +030081 with_dri_i915 = _split.contains('i915')
Dylan Baker32180562017-09-20 20:11:32 -070082 with_dri_i965 = _split.contains('i965')
Dylan Bakerc2cd5802017-10-03 17:06:22 -070083 with_dri_swrast = _split.contains('swrast')
Dylan Baker32180562017-09-20 20:11:32 -070084 with_dri = true
85endif
86
Ville Syrjälä22899642017-10-10 01:15:42 +030087dep_libdrm_intel = []
88if with_dri_i915
89 dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
90endif
91
Dylan Baker32180562017-09-20 20:11:32 -070092if not with_dri
93 with_gles1 = false
94 with_gles2 = false
95 with_opengl = false
96 with_any_opengl = false
97 with_shared_glapi = false
98endif
Dylan Bakerd1992252017-09-14 17:57:17 -070099
Dylan Bakera47c5252017-09-22 12:55:00 -0700100# TODO: other OSes
101with_dri_platform = 'drm'
102
103with_gallium = false
104# TODO: gallium drivers
105
106# TODO: conditionalize libdrm requirement
107dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
108pre_args += '-DHAVE_LIBDRM'
109
110with_dri2 = with_dri_platform == 'drm' and dep_libdrm.found()
111with_dri3 = get_option('dri3')
112if with_dri3 == 'auto'
Dylan Baker816bf7d12017-09-28 15:53:53 -0700113 if host_machine.system() == 'linux' and with_dri2
Dylan Bakera47c5252017-09-22 12:55:00 -0700114 with_dri3 = true
115 else
116 with_dri3 = false
117 endif
118elif with_dri3 == 'yes'
Dylan Baker816bf7d12017-09-28 15:53:53 -0700119 if not with_dri2
120 error('dri3 support requires libdrm')
121 endif
Dylan Bakera47c5252017-09-22 12:55:00 -0700122 with_dri3 = true
123else
124 with_dri3 = false
125endif
126
Dylan Bakerd1992252017-09-14 17:57:17 -0700127# TODO: there are more platforms required for non-vulkan drivers
128with_platform_wayland = false
129with_platform_x11 = false
130_platforms = get_option('platforms')
131if _platforms != ''
132 _split = _platforms.split(',')
133 with_platform_x11 = _split.contains('x11')
134 with_platform_wayland = _split.contains('wayland')
135endif
136
Dylan Baker816bf7d12017-09-28 15:53:53 -0700137with_gbm = get_option('gbm')
138if with_gbm == 'auto' and with_dri # TODO: or gallium
139 with_gbm = host_machine.system() == 'linux'
140elif with_gbm == 'yes'
141 if not ['linux', 'bsd'].contains(host_machine.system())
142 error('GBM only supports unix-like platforms')
143 endif
144 with_gbm = true
145else
146 with_gbm = false
147endif
148
Dylan Bakera47c5252017-09-22 12:55:00 -0700149with_glx = get_option('glx')
150if with_glx != 'disabled'
151 pre_args += '-DGLX_USE_TLS'
152 if not (with_platform_x11 and with_any_opengl) and with_glx != 'auto'
153 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
154 elif with_glx == 'gallium-xlib'
155 if not with_gallium
156 error('Gallium-xlib based GLX requires at least one gallium driver')
157 elif with_dri
158 error('gallium-xlib conflicts with any dri driver')
159 endif
160 elif with_glx == 'dri' and not with_dri
161 error('dri based GLX requires at least one DRI driver')
162 elif with_glx == 'auto'
163 if with_dri
164 with_glx = 'dri'
165 elif with_gallium
166 with_glx = 'gallium-xlib'
167 elif with_platform_x11 and with_any_opengl
168 with_glx = 'xlib'
169 else
170 with_glx = 'disabled'
171 endif
172 endif
173endif
174
175with_glvnd = get_option('glvnd')
176if with_glvnd and with_glx != 'dri'
177 message('glvnd requires dri based glx')
178endif
179
180# TODO: toggle for this
181with_glx_direct = true
182
Dylan Bakerd1992252017-09-14 17:57:17 -0700183if with_vulkan_icd_dir == ''
184 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
185endif
186
187with_intel_vk = false
188with_amd_vk = false
Dylan Bakera47c5252017-09-22 12:55:00 -0700189with_any_vk = false
Dylan Bakerd1992252017-09-14 17:57:17 -0700190_vulkan_drivers = get_option('vulkan-drivers')
191if _vulkan_drivers != ''
192 _split = _vulkan_drivers.split(',')
193 with_intel_vk = _split.contains('intel')
194 with_amd_vk = _split.contains('amd')
Dylan Bakera47c5252017-09-22 12:55:00 -0700195 with_any_vk = with_amd_vk or with_intel_vk
Dylan Bakerd1992252017-09-14 17:57:17 -0700196 if not (with_platform_x11 or with_platform_wayland)
197 error('Vulkan requires at least one platform (x11, wayland)')
198 endif
Dylan Bakera47c5252017-09-22 12:55:00 -0700199 if with_platform_x11 and not with_dri3
200 error('Vulkan drivers require dri3 for X11 support')
201 endif
202endif
203
204if with_dri # TODO: or gallium
205 if with_glx == 'disabled' # TODO: or egl
206 error('building dri or gallium drivers require at least one window system')
207 endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700208endif
209
210prog_python2 = find_program('python2')
Dylan Baker9342a7d2017-09-28 10:48:30 -0700211has_mako = run_command(prog_python2, '-c', 'import mako')
212if has_mako.returncode() != 0
213 error('Python (2.x) mako module required to build mesa.')
214endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700215
216cc = meson.get_compiler('c')
217if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
Eric Engestrom1262e822017-09-29 15:25:18 +0100218 error('When using GCC, version 4.4.6 or later is required.')
Dylan Bakerd1992252017-09-14 17:57:17 -0700219endif
220
Dylan Bakerd1992252017-09-14 17:57:17 -0700221# Define DEBUG for debug and debugoptimized builds
222if get_option('buildtype').startswith('debug')
223 pre_args += '-DDEBUG'
224endif
225
Dylan Baker673dda82017-09-20 11:53:29 -0700226if get_option('shader-cache')
227 pre_args += '-DENABLE_SHADER_CACHE'
228elif with_amd_vk
229 error('Radv requires shader cache support')
230endif
231
Dylan Bakerd1992252017-09-14 17:57:17 -0700232# Check for GCC style builtins
233foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
234 'ffsll', 'popcount', 'popcountll', 'unreachable']
235 if cc.has_function(b)
236 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
237 endif
238endforeach
239
Dylan Baker673dda82017-09-20 11:53:29 -0700240# check for GCC __attribute__
Dylan Bakerd1992252017-09-14 17:57:17 -0700241foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
242 'warn_unused_result', 'weak',]
243 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
244 name : '__attribute__((@0@))'.format(a))
245 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
246 endif
247endforeach
248if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
249 name : '__attribute__((format(...)))')
250 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
251endif
252if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
253 name : '__attribute__((packed))')
254 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
255endif
256if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
257 name : '__attribute__((returns_nonnull))')
258 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
259endif
260if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
261 int foo_hid(void) __attribute__((visibility("hidden")));
262 int foo_int(void) __attribute__((visibility("internal")));
263 int foo_pro(void) __attribute__((visibility("protected")));''',
264 name : '__attribute__((visibility(...)))')
265 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
266endif
267if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
268 name : '__attribute__((alias(...)))')
269 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
270endif
271
272# TODO: this is very incomplete
273if host_machine.system() == 'linux'
274 pre_args += '-D_GNU_SOURCE'
275endif
276
277# Check for generic C arguments
278c_args = []
279foreach a : ['-Wall', '-Werror=implicit-function-declaration',
280 '-Werror=missing-prototypes', '-fno-math-errno',
281 '-fno-trapping-math', '-Qunused-arguments']
282 if cc.has_argument(a)
283 c_args += a
284 endif
285endforeach
286c_vis_args = []
287if cc.has_argument('-fvisibility=hidden')
288 c_vis_args += '-fvisibility=hidden'
289endif
290
291# Check for generic C++ arguments
292cpp = meson.get_compiler('cpp')
293cpp_args = []
294foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
295 '-Qunused-arguments', '-Wno-non-virtual-dtor']
296 if cpp.has_argument(a)
297 cpp_args += a
298 endif
299endforeach
300cpp_vis_args = []
301if cpp.has_argument('-fvisibility=hidden')
302 cpp_vis_args += '-fvisibility=hidden'
303endif
304
305# Check for C and C++ arguments for MSVC2013 compatibility. These are only used
306# in parts of the mesa code base that need to compile with old versions of
307# MSVC, mainly common code
308c_msvc_compat_args = []
309cpp_msvc_compat_args = []
310foreach a : ['-Werror=pointer-arith', '-Werror=vla']
311 if cc.has_argument(a)
312 c_msvc_compat_args += a
313 endif
314 if cpp.has_argument(a)
315 cpp_msvc_compat_args += a
316 endif
317endforeach
318
319no_override_init_args = []
320foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
321 if cc.has_argument(a)
322 no_override_init_args += a
323 endif
324endforeach
325
326# TODO: SSE41 (which is only required for core mesa)
327
328# Check for GCC style atomics
329if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
330 name : 'GCC atomic builtins')
331 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
332endif
333if not cc.links('''#include <stdint.h>
334 uint64_t v;
335 int main() {
336 return __sync_add_and_fetch(&v, (uint64_t)1);
337 }''',
338 name : 'GCC 64bit atomics')
339 pre_args += '-DMISSING_64_BIT_ATOMICS'
340endif
341
342# TODO: endian
343# TODO: powr8
344# TODO: shared/static? Is this even worth doing?
345
346# I don't think that I need to set any of the debug stuff, I think meson
347# handles that for us
348
349# TODO: ldflags
350
351# TODO: texture-float (gallium/mesa only)
352
353# TODO: cross-compiling. I don't think this is relavent to meson
354
Dylan Baker32180562017-09-20 20:11:32 -0700355# FIXME: enable asm when cross compiler
356# This is doable (autotools does it), but it's not of immediate concern
357if meson.is_cross_build()
358 message('Cross compiling, disabling asm')
359 with_asm = false
360endif
361
362with_asm_arch = ''
363if with_asm
364 # TODO: SPARC and PPC
365 if host_machine.cpu_family() == 'x86'
366 if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
367 with_asm_arch = 'x86'
368 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
369 '-DUSE_SSE_ASM']
370 endif
371 elif host_machine.cpu_family() == 'x86_64'
372 if host_machine.system() == 'linux'
373 with_asm_arch = 'x86_64'
374 pre_args += ['-DUSE_X86_64_ASM']
375 endif
376 elif host_machine.cpu_family() == 'arm'
377 if host_machine.system() == 'linux'
378 with_asm_arch = 'arm'
379 pre_args += ['-DUSE_ARM_ASM']
380 endif
381 elif host_machine.cpu_family() == 'aarch64'
382 if host_machine.system() == 'linux'
383 with_asm_arch = 'aarch64'
384 pre_args += ['-DUSE_AARCH64_ASM']
385 endif
386 endif
387endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700388
389# Check for standard headers and functions
390if cc.has_header_symbol('sys/sysmacros.h', 'major')
391 pre_args += '-DMAJOR_IN_SYSMACROS'
392elif cc.has_header_symbol('sys/mkdev.h', 'major')
393 pre_args += '-DMAJOR_IN_MKDEV'
394endif
395
396foreach h : ['xlocale.h', 'sys/sysctl.h']
397 if cc.has_header(h)
398 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
399 endif
400endforeach
401
402foreach f : ['strtof', 'mkostemp', 'posix_memalign']
403 if cc.has_function(f)
404 pre_args += '-DHAVE_@0@'.format(f.to_upper())
405 endif
406endforeach
407
408# strtod locale support
409if cc.links('''
410 #define _GNU_SOURCE
411 #include <stdlib.h>
412 #include <locale.h>
413 #ifdef HAVE_XLOCALE_H
414 #include <xlocale.h>
415 #endif
416 int main() {
417 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
418 const char *s = "1.0";
419 char *end;
420 double d = strtod_l(s, end, loc);
421 float f = strtod_l(s, end, loc);
422 freelocale(loc);
423 return 0;
424 }''',
425 extra_args : pre_args,
426 name : 'strtod has locale support')
427 pre_args += '-DHAVE_STRTOD_L'
428endif
429
430# Check for some linker flags
431ld_args_bsymbolic = []
432if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic')
433 ld_args_bsymbolic += '-Wl,-Bsymbolic'
434endif
435ld_args_gc_sections = []
436if cc.links('static char unused() { return 5; } int main() { return 0; }',
437 args : '-Wl,--gc-sections')
438 ld_args_gc_sections += '-Wl,--gc-sections'
439endif
440
441# check for dl support
442if cc.has_function('dlopen')
443 dep_dl = []
444else
445 dep_dl = cc.find_library('dl')
446endif
Dylan Baker32180562017-09-20 20:11:32 -0700447if cc.has_function('dladdr', dependencies : dep_dl)
448 # This is really only required for megadrivers
449 pre_args += '-DHAVE_DLADDR'
Dylan Bakerd1992252017-09-14 17:57:17 -0700450endif
451
452if cc.has_function('dl_iterate_phdr')
453 pre_args += '-DHAVE_DL_ITERATE_PHDR'
454else
455 # TODO: this is required for vulkan
456endif
457
458# Determine whether or not the rt library is needed for time functions
459if cc.has_function('clock_gettime')
460 dep_clock = []
461else
462 dep_clock = cc.find_library('rt')
463endif
464
465# TODO: some of these may be conditional
466dep_zlib = dependency('zlib', version : '>= 1.2.3')
467dep_thread = dependency('threads')
468pre_args += '-DHAVE_PTHREAD'
Dylan Bakercc4f5872017-09-27 11:30:21 -0700469dep_elf = dependency('libelf', required : false)
470if not dep_elf.found()
Dylan Baker97aea7d2017-10-04 11:36:06 -0700471 dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover, r600, radeonsi
Dylan Bakercc4f5872017-09-27 11:30:21 -0700472endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700473dep_expat = dependency('expat')
474# this only exists on linux so either this is linux and it will be found, or
475# its not linux and and wont
476dep_m = cc.find_library('m', required : false)
477
Dylan Baker673dda82017-09-20 11:53:29 -0700478dep_libdrm_amdgpu = []
479if with_amd_vk
480 dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82')
481endif
482
483llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
484if with_amd_vk
485 llvm_modules += ['amdgpu', 'bitreader', 'ipo']
486endif
487dep_llvm = dependency(
488 'llvm', version : '>= 3.9.0', required : false, modules : llvm_modules,
489)
490if not dep_llvm.found()
491 if with_amd_vk
492 error('Radv requires llvm.')
493 endif
494else
495 _llvm_version = dep_llvm.version().split('.')
496 # Development versions of LLVM have an 'svn' suffix, we don't want that for
497 # our version checks.
498 _llvm_patch = _llvm_version[2]
499 if _llvm_patch.endswith('svn')
500 _llvm_patch = _llvm_patch.split('s')[0]
501 endif
502 pre_args += [
503 '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
504 '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
505 ]
506endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700507
Dylan Bakera47c5252017-09-22 12:55:00 -0700508dep_glvnd = []
509if with_glvnd
510 dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
511 pre_args += '-DUSE_LIBGLVND=1'
512endif
513
Dylan Bakerd1992252017-09-14 17:57:17 -0700514# TODO: make this conditional
515dep_valgrind = dependency('valgrind', required : false)
516if dep_valgrind.found() and with_valgrind
517 pre_args += '-DHAVE_VALGRIND'
518endif
519
520# pthread stubs. Lets not and say we didn't
521
Dylan Baker32180562017-09-20 20:11:32 -0700522prog_bison = find_program('bison', required : with_any_opengl)
523prog_flex = find_program('flex', required : with_any_opengl)
524
Dylan Bakerd1992252017-09-14 17:57:17 -0700525# TODO: selinux
Dylan Baker32180562017-09-20 20:11:32 -0700526dep_selinux = []
Dylan Bakerd1992252017-09-14 17:57:17 -0700527
528# TODO: llvm-prefix and llvm-shared-libs
529
Dylan Bakerd1992252017-09-14 17:57:17 -0700530# TODO: unwind (llvm [radeon, gallivm] and gallium)
531
532# TODO: flags for opengl, gles, dri
533
534# TODO: gallium-hud
535
536# TODO: glx provider
537
538# TODO: osmesa provider
539
540# TODO: flags for xa, egl, gbm, nin, xvmc, vdpau, omx, va, opencl,
541# gallium-tests,
542
543# TODO: gallium drivers
544
Dylan Bakerd1992252017-09-14 17:57:17 -0700545# TODO: symbol mangling
546
Dylan Bakerd1992252017-09-14 17:57:17 -0700547# TODO: egl configuration
548
549if with_platform_wayland
550 prog_wl_scanner = find_program('wayland-scanner')
551 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
552 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
553 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
554else
555 prog_wl_scanner = []
556 dep_wl_protocols = []
557 dep_wayland_client = []
558 dep_wayland_server = []
559endif
560
561dep_xcb_dri2 = []
562dep_xcb_dri3 = []
Dylan Bakera47c5252017-09-22 12:55:00 -0700563dep_dri2proto = []
564dep_glproto = []
565dep_x11 = []
566dep_xf86vm = []
Dylan Bakerd1992252017-09-14 17:57:17 -0700567if with_platform_x11
Dylan Bakera47c5252017-09-22 12:55:00 -0700568 if with_glx == 'xlib'
569 # TODO
570 error('TODO')
571 elif with_glx == 'gallium-xlib'
572 # TODO
573 error('TODO')
Dylan Bakerd1992252017-09-14 17:57:17 -0700574 else
Dylan Bakera47c5252017-09-22 12:55:00 -0700575 pre_args += '-DGLX_INDIRECT_RENDERING'
576 if with_glx_direct
577 pre_args += '-DGLX_DIRECT_RENDERING'
578 endif
579 if with_dri_platform == 'drm'
580 pre_args += '-DGLX_USE_DRM'
581 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
582 dep_x11 = [
583 dependency('x11'),
584 dependency('xext'),
585 dependency('xdamage', version : '>= 1.1'),
586 dependency('xfixes'),
587 dependency('x11-xcb'),
588 dependency('xcb'),
589 dependency('xcb-glx', version : '>= 1.8.1'),
590 ]
591
Ville Syrjälä66b15972017-10-10 01:34:18 +0300592 dep_xf86vm = dependency('xxf86vm', required : false)
Dylan Bakera47c5252017-09-22 12:55:00 -0700593 endif
594 # TODO: XF86VIDMODE
595 endif
596 if with_glx != 'disabled'
597 dep_glproto = dependency('glproto', version : '>= 1.4.14')
598 endif
599 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
600 dep_xcb_dri2 = [
601 dependency('x11-xcb'),
602 dependency('xcb'),
603 dependency('xcb-dri2', version : '>= 1.8'),
604 dependency('xcb-xfixes'),
605 ]
606 pre_args += '-DHAVE_X11_PLATFORM'
607 if with_dri3
608 pre_args += '-DHAVE_DRI3'
609 dep_xcb_dri3 = [
610 dep_xcb_dri2,
611 dependency('xcb-dri3'),
612 dependency('xcb-present'),
613 dependency('xcb-sync'),
614 dependency('xshmfence', version : '>= 1.1'),
615 ]
616 endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700617 endif
618endif
619
620# TODO: platforms for !vulkan
621
Dylan Bakerd1992252017-09-14 17:57:17 -0700622# TODO: osmesa
623
624# TODO: egl
625
626# TODO: xa
627
628# TODO: vallium G3DVL
629
630# TODO: nine
631
632# TODO: clover
633
634# TODO: egl sans x11
635
636# TODO: xvmc
637
638# TODO: gallium tests
639
640# TODO: various libdirs
641
642# TODO: swr
643
644# TODO: gallium driver dirs
645
646# FIXME: this is a workaround for #2326
647prog_touch = find_program('touch')
648dummy_cpp = custom_target(
649 'dummy_cpp',
650 output : 'dummy.cpp',
651 command : [prog_touch, '@OUTPUT@'],
652)
653
654foreach a : pre_args
655 add_project_arguments(a, language : ['c', 'cpp'])
656endforeach
657foreach a : c_args
658 add_project_arguments(a, language : ['c'])
659endforeach
660foreach a : cpp_args
661 add_project_arguments(a, language : ['cpp'])
662endforeach
663
664inc_include = include_directories('include')
665
Dylan Baker32180562017-09-20 20:11:32 -0700666pkg = import('pkgconfig')
667
Dylan Bakerd1992252017-09-14 17:57:17 -0700668subdir('include')
669subdir('src')