blob: 17187f3d90931059f5a0c7c1f3c1340e550a9daf [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"',
Dylan Baker601bd722017-10-09 14:22:07 -070034 '-D_GNU_SOURCE',
Dylan Baker32180562017-09-20 20:11:32 -070035]
36
Dylan Bakere915b8d2017-09-28 14:02:51 -070037with_vulkan_icd_dir = get_option('vulkan-icd-dir')
Dylan Bakerd1992252017-09-14 17:57:17 -070038with_tests = get_option('build-tests')
39with_valgrind = get_option('valgrind')
Dylan Baker32180562017-09-20 20:11:32 -070040with_asm = get_option('asm')
Dylan Baker3b209e92017-10-10 15:25:07 -070041if get_option('texture-float')
42 pre_args += '-DTEXTURE_FLOAT_ENABLED'
43 message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.')
44endif
Dylan Baker32180562017-09-20 20:11:32 -070045
46# XXX: yeah, do these
47with_appledri = false
48with_windowsdri = false
49
Dylan Bakerdb978842017-09-28 13:59:04 -070050dri_drivers_path = get_option('dri-drivers-path')
51if dri_drivers_path == ''
52 dri_drivers_path = join_paths(get_option('libdir'), 'dri')
53endif
54
Dylan Baker32180562017-09-20 20:11:32 -070055with_gles1 = get_option('gles1')
56with_gles2 = get_option('gles2')
57with_opengl = get_option('opengl')
58with_any_opengl = with_opengl or with_gles1 or with_gles2
Dylan Bakera47c5252017-09-22 12:55:00 -070059# Only build shared_glapi if at least one OpenGL API is enabled
60with_shared_glapi = get_option('shared-glapi') and with_any_opengl
Dylan Baker32180562017-09-20 20:11:32 -070061
62# TODO: these will need options, but at the moment they just control header
63# installs
Dylan Baker32180562017-09-20 20:11:32 -070064with_osmesa = false
65
66# shared-glapi is required if at least two OpenGL APIs are being built
67if not with_shared_glapi
68 if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
69 or (with_gles2 and with_opengl))
70 error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
71 endif
72endif
73
74# We require OpenGL for OpenGL ES
75if (with_gles1 or with_gles2) and not with_opengl
76 error('building OpenGL ES without OpenGL is not supported.')
77endif
78
79with_dri = false
Ville Syrjälä22899642017-10-10 01:15:42 +030080with_dri_i915 = false
Dylan Baker32180562017-09-20 20:11:32 -070081with_dri_i965 = false
Dylan Bakerc2cd5802017-10-03 17:06:22 -070082with_dri_swrast = false
Dylan Baker32180562017-09-20 20:11:32 -070083_drivers = get_option('dri-drivers')
84if _drivers != ''
85 _split = _drivers.split(',')
Ville Syrjälä22899642017-10-10 01:15:42 +030086 with_dri_i915 = _split.contains('i915')
Dylan Baker32180562017-09-20 20:11:32 -070087 with_dri_i965 = _split.contains('i965')
Dylan Bakerc2cd5802017-10-03 17:06:22 -070088 with_dri_swrast = _split.contains('swrast')
Dylan Baker32180562017-09-20 20:11:32 -070089 with_dri = true
90endif
91
Ville Syrjälä22899642017-10-10 01:15:42 +030092dep_libdrm_intel = []
93if with_dri_i915
94 dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
95endif
96
Dylan Baker32180562017-09-20 20:11:32 -070097if not with_dri
98 with_gles1 = false
99 with_gles2 = false
100 with_opengl = false
101 with_any_opengl = false
102 with_shared_glapi = false
103endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700104
Dylan Bakera47c5252017-09-22 12:55:00 -0700105# TODO: other OSes
106with_dri_platform = 'drm'
107
108with_gallium = false
109# TODO: gallium drivers
110
111# TODO: conditionalize libdrm requirement
112dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
113pre_args += '-DHAVE_LIBDRM'
114
115with_dri2 = with_dri_platform == 'drm' and dep_libdrm.found()
116with_dri3 = get_option('dri3')
117if with_dri3 == 'auto'
Dylan Baker816bf7d12017-09-28 15:53:53 -0700118 if host_machine.system() == 'linux' and with_dri2
Dylan Bakera47c5252017-09-22 12:55:00 -0700119 with_dri3 = true
120 else
121 with_dri3 = false
122 endif
123elif with_dri3 == 'yes'
Dylan Baker816bf7d12017-09-28 15:53:53 -0700124 if not with_dri2
125 error('dri3 support requires libdrm')
126 endif
Dylan Bakera47c5252017-09-22 12:55:00 -0700127 with_dri3 = true
128else
129 with_dri3 = false
130endif
131
Dylan Bakerd1992252017-09-14 17:57:17 -0700132# TODO: there are more platforms required for non-vulkan drivers
133with_platform_wayland = false
134with_platform_x11 = false
135_platforms = get_option('platforms')
136if _platforms != ''
137 _split = _platforms.split(',')
138 with_platform_x11 = _split.contains('x11')
139 with_platform_wayland = _split.contains('wayland')
140endif
141
Dylan Baker816bf7d12017-09-28 15:53:53 -0700142with_gbm = get_option('gbm')
143if with_gbm == 'auto' and with_dri # TODO: or gallium
144 with_gbm = host_machine.system() == 'linux'
145elif with_gbm == 'yes'
146 if not ['linux', 'bsd'].contains(host_machine.system())
147 error('GBM only supports unix-like platforms')
148 endif
149 with_gbm = true
150else
151 with_gbm = false
152endif
153
Dylan Baker8e611872017-10-11 12:49:31 -0700154pre_args += '-DGLX_USE_TLS'
Dylan Bakera47c5252017-09-22 12:55:00 -0700155with_glx = get_option('glx')
156if with_glx != 'disabled'
Dylan Bakera47c5252017-09-22 12:55:00 -0700157 if not (with_platform_x11 and with_any_opengl) and with_glx != 'auto'
158 error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
159 elif with_glx == 'gallium-xlib'
160 if not with_gallium
161 error('Gallium-xlib based GLX requires at least one gallium driver')
162 elif with_dri
163 error('gallium-xlib conflicts with any dri driver')
164 endif
165 elif with_glx == 'dri' and not with_dri
166 error('dri based GLX requires at least one DRI driver')
167 elif with_glx == 'auto'
168 if with_dri
169 with_glx = 'dri'
170 elif with_gallium
171 with_glx = 'gallium-xlib'
172 elif with_platform_x11 and with_any_opengl
173 with_glx = 'xlib'
174 else
175 with_glx = 'disabled'
176 endif
177 endif
178endif
179
180with_glvnd = get_option('glvnd')
181if with_glvnd and with_glx != 'dri'
182 message('glvnd requires dri based glx')
183endif
184
185# TODO: toggle for this
186with_glx_direct = true
187
Dylan Bakerd1992252017-09-14 17:57:17 -0700188if with_vulkan_icd_dir == ''
189 with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
190endif
191
192with_intel_vk = false
193with_amd_vk = false
Dylan Bakera47c5252017-09-22 12:55:00 -0700194with_any_vk = false
Dylan Bakerd1992252017-09-14 17:57:17 -0700195_vulkan_drivers = get_option('vulkan-drivers')
196if _vulkan_drivers != ''
197 _split = _vulkan_drivers.split(',')
198 with_intel_vk = _split.contains('intel')
199 with_amd_vk = _split.contains('amd')
Dylan Bakera47c5252017-09-22 12:55:00 -0700200 with_any_vk = with_amd_vk or with_intel_vk
Dylan Bakerd1992252017-09-14 17:57:17 -0700201 if not (with_platform_x11 or with_platform_wayland)
202 error('Vulkan requires at least one platform (x11, wayland)')
203 endif
Dylan Bakera47c5252017-09-22 12:55:00 -0700204 if with_platform_x11 and not with_dri3
205 error('Vulkan drivers require dri3 for X11 support')
206 endif
207endif
208
209if with_dri # TODO: or gallium
210 if with_glx == 'disabled' # TODO: or egl
211 error('building dri or gallium drivers require at least one window system')
212 endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700213endif
214
215prog_python2 = find_program('python2')
Dylan Baker9342a7d2017-09-28 10:48:30 -0700216has_mako = run_command(prog_python2, '-c', 'import mako')
217if has_mako.returncode() != 0
218 error('Python (2.x) mako module required to build mesa.')
219endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700220
221cc = meson.get_compiler('c')
222if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
Eric Engestrom1262e822017-09-29 15:25:18 +0100223 error('When using GCC, version 4.4.6 or later is required.')
Dylan Bakerd1992252017-09-14 17:57:17 -0700224endif
225
Dylan Bakerd1992252017-09-14 17:57:17 -0700226# Define DEBUG for debug and debugoptimized builds
227if get_option('buildtype').startswith('debug')
228 pre_args += '-DDEBUG'
229endif
230
Dylan Baker673dda82017-09-20 11:53:29 -0700231if get_option('shader-cache')
232 pre_args += '-DENABLE_SHADER_CACHE'
233elif with_amd_vk
234 error('Radv requires shader cache support')
235endif
236
Dylan Bakerd1992252017-09-14 17:57:17 -0700237# Check for GCC style builtins
238foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
239 'ffsll', 'popcount', 'popcountll', 'unreachable']
240 if cc.has_function(b)
241 pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
242 endif
243endforeach
244
Dylan Baker673dda82017-09-20 11:53:29 -0700245# check for GCC __attribute__
Dylan Bakerd1992252017-09-14 17:57:17 -0700246foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
247 'warn_unused_result', 'weak',]
248 if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
249 name : '__attribute__((@0@))'.format(a))
250 pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
251 endif
252endforeach
253if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
254 name : '__attribute__((format(...)))')
255 pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
256endif
257if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
258 name : '__attribute__((packed))')
259 pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
260endif
261if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
262 name : '__attribute__((returns_nonnull))')
263 pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
264endif
265if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
266 int foo_hid(void) __attribute__((visibility("hidden")));
267 int foo_int(void) __attribute__((visibility("internal")));
268 int foo_pro(void) __attribute__((visibility("protected")));''',
269 name : '__attribute__((visibility(...)))')
270 pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
271endif
272if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
273 name : '__attribute__((alias(...)))')
274 pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
275endif
276
277# TODO: this is very incomplete
278if host_machine.system() == 'linux'
279 pre_args += '-D_GNU_SOURCE'
280endif
281
282# Check for generic C arguments
283c_args = []
284foreach a : ['-Wall', '-Werror=implicit-function-declaration',
285 '-Werror=missing-prototypes', '-fno-math-errno',
286 '-fno-trapping-math', '-Qunused-arguments']
287 if cc.has_argument(a)
288 c_args += a
289 endif
290endforeach
291c_vis_args = []
292if cc.has_argument('-fvisibility=hidden')
293 c_vis_args += '-fvisibility=hidden'
294endif
295
296# Check for generic C++ arguments
297cpp = meson.get_compiler('cpp')
298cpp_args = []
299foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
300 '-Qunused-arguments', '-Wno-non-virtual-dtor']
301 if cpp.has_argument(a)
302 cpp_args += a
303 endif
304endforeach
305cpp_vis_args = []
306if cpp.has_argument('-fvisibility=hidden')
307 cpp_vis_args += '-fvisibility=hidden'
308endif
309
310# Check for C and C++ arguments for MSVC2013 compatibility. These are only used
311# in parts of the mesa code base that need to compile with old versions of
312# MSVC, mainly common code
313c_msvc_compat_args = []
314cpp_msvc_compat_args = []
315foreach a : ['-Werror=pointer-arith', '-Werror=vla']
316 if cc.has_argument(a)
317 c_msvc_compat_args += a
318 endif
319 if cpp.has_argument(a)
320 cpp_msvc_compat_args += a
321 endif
322endforeach
323
324no_override_init_args = []
325foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
326 if cc.has_argument(a)
327 no_override_init_args += a
328 endif
329endforeach
330
331# TODO: SSE41 (which is only required for core mesa)
332
333# Check for GCC style atomics
334if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
335 name : 'GCC atomic builtins')
336 pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
337endif
338if not cc.links('''#include <stdint.h>
339 uint64_t v;
340 int main() {
341 return __sync_add_and_fetch(&v, (uint64_t)1);
342 }''',
343 name : 'GCC 64bit atomics')
344 pre_args += '-DMISSING_64_BIT_ATOMICS'
345endif
346
347# TODO: endian
348# TODO: powr8
349# TODO: shared/static? Is this even worth doing?
350
351# I don't think that I need to set any of the debug stuff, I think meson
352# handles that for us
353
354# TODO: ldflags
355
356# TODO: texture-float (gallium/mesa only)
357
358# TODO: cross-compiling. I don't think this is relavent to meson
359
Dylan Baker32180562017-09-20 20:11:32 -0700360# FIXME: enable asm when cross compiler
361# This is doable (autotools does it), but it's not of immediate concern
362if meson.is_cross_build()
363 message('Cross compiling, disabling asm')
364 with_asm = false
365endif
366
367with_asm_arch = ''
368if with_asm
369 # TODO: SPARC and PPC
370 if host_machine.cpu_family() == 'x86'
371 if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
372 with_asm_arch = 'x86'
373 pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
374 '-DUSE_SSE_ASM']
375 endif
376 elif host_machine.cpu_family() == 'x86_64'
377 if host_machine.system() == 'linux'
378 with_asm_arch = 'x86_64'
379 pre_args += ['-DUSE_X86_64_ASM']
380 endif
381 elif host_machine.cpu_family() == 'arm'
382 if host_machine.system() == 'linux'
383 with_asm_arch = 'arm'
384 pre_args += ['-DUSE_ARM_ASM']
385 endif
386 elif host_machine.cpu_family() == 'aarch64'
387 if host_machine.system() == 'linux'
388 with_asm_arch = 'aarch64'
389 pre_args += ['-DUSE_AARCH64_ASM']
390 endif
391 endif
392endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700393
394# Check for standard headers and functions
395if cc.has_header_symbol('sys/sysmacros.h', 'major')
396 pre_args += '-DMAJOR_IN_SYSMACROS'
397elif cc.has_header_symbol('sys/mkdev.h', 'major')
398 pre_args += '-DMAJOR_IN_MKDEV'
399endif
400
401foreach h : ['xlocale.h', 'sys/sysctl.h']
402 if cc.has_header(h)
403 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
404 endif
405endforeach
406
407foreach f : ['strtof', 'mkostemp', 'posix_memalign']
408 if cc.has_function(f)
409 pre_args += '-DHAVE_@0@'.format(f.to_upper())
410 endif
411endforeach
412
413# strtod locale support
414if cc.links('''
415 #define _GNU_SOURCE
416 #include <stdlib.h>
417 #include <locale.h>
418 #ifdef HAVE_XLOCALE_H
419 #include <xlocale.h>
420 #endif
421 int main() {
422 locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
423 const char *s = "1.0";
424 char *end;
425 double d = strtod_l(s, end, loc);
426 float f = strtod_l(s, end, loc);
427 freelocale(loc);
428 return 0;
429 }''',
430 extra_args : pre_args,
431 name : 'strtod has locale support')
432 pre_args += '-DHAVE_STRTOD_L'
433endif
434
435# Check for some linker flags
436ld_args_bsymbolic = []
Dylan Bakere21e0a62017-09-30 13:15:52 -0700437if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
Dylan Bakerd1992252017-09-14 17:57:17 -0700438 ld_args_bsymbolic += '-Wl,-Bsymbolic'
439endif
440ld_args_gc_sections = []
441if cc.links('static char unused() { return 5; } int main() { return 0; }',
Dylan Bakere21e0a62017-09-30 13:15:52 -0700442 args : '-Wl,--gc-sections', name : 'gc-sections')
Dylan Bakerd1992252017-09-14 17:57:17 -0700443 ld_args_gc_sections += '-Wl,--gc-sections'
444endif
Dylan Bakere21e0a62017-09-30 13:15:52 -0700445with_ld_version_script = false
446if cc.links('int main() { return 0; }',
447 args : '-Wl,--version-script=@0@'.format(
448 join_paths(meson.source_root(), 'build-support/conftest.map')),
449 name : 'version-script')
450 with_ld_version_script = true
451endif
452with_ld_dynamic_list = false
453if cc.links('int main() { return 0; }',
454 args : '-Wl,--dynamic-list=@0@'.format(
455 join_paths(meson.source_root(), 'build-support/conftest.dyn')),
456 name : 'dynamic-list')
457 with_ld_dynamic_list = true
458endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700459
460# check for dl support
461if cc.has_function('dlopen')
462 dep_dl = []
463else
464 dep_dl = cc.find_library('dl')
465endif
Dylan Baker32180562017-09-20 20:11:32 -0700466if cc.has_function('dladdr', dependencies : dep_dl)
467 # This is really only required for megadrivers
468 pre_args += '-DHAVE_DLADDR'
Dylan Bakerd1992252017-09-14 17:57:17 -0700469endif
470
471if cc.has_function('dl_iterate_phdr')
472 pre_args += '-DHAVE_DL_ITERATE_PHDR'
473else
474 # TODO: this is required for vulkan
475endif
476
477# Determine whether or not the rt library is needed for time functions
478if cc.has_function('clock_gettime')
479 dep_clock = []
480else
481 dep_clock = cc.find_library('rt')
482endif
483
484# TODO: some of these may be conditional
485dep_zlib = dependency('zlib', version : '>= 1.2.3')
486dep_thread = dependency('threads')
487pre_args += '-DHAVE_PTHREAD'
Dylan Bakercc4f5872017-09-27 11:30:21 -0700488dep_elf = dependency('libelf', required : false)
489if not dep_elf.found()
Dylan Baker97aea7d2017-10-04 11:36:06 -0700490 dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover, r600, radeonsi
Dylan Bakercc4f5872017-09-27 11:30:21 -0700491endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700492dep_expat = dependency('expat')
493# this only exists on linux so either this is linux and it will be found, or
494# its not linux and and wont
495dep_m = cc.find_library('m', required : false)
496
Dylan Baker673dda82017-09-20 11:53:29 -0700497dep_libdrm_amdgpu = []
498if with_amd_vk
499 dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82')
500endif
501
502llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
503if with_amd_vk
504 llvm_modules += ['amdgpu', 'bitreader', 'ipo']
505endif
506dep_llvm = dependency(
507 'llvm', version : '>= 3.9.0', required : false, modules : llvm_modules,
508)
509if not dep_llvm.found()
510 if with_amd_vk
511 error('Radv requires llvm.')
512 endif
513else
514 _llvm_version = dep_llvm.version().split('.')
515 # Development versions of LLVM have an 'svn' suffix, we don't want that for
516 # our version checks.
517 _llvm_patch = _llvm_version[2]
518 if _llvm_patch.endswith('svn')
519 _llvm_patch = _llvm_patch.split('s')[0]
520 endif
521 pre_args += [
522 '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
523 '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
524 ]
525endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700526
Dylan Bakera47c5252017-09-22 12:55:00 -0700527dep_glvnd = []
528if with_glvnd
529 dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
530 pre_args += '-DUSE_LIBGLVND=1'
531endif
532
Dylan Bakerd1992252017-09-14 17:57:17 -0700533# TODO: make this conditional
534dep_valgrind = dependency('valgrind', required : false)
535if dep_valgrind.found() and with_valgrind
536 pre_args += '-DHAVE_VALGRIND'
537endif
538
539# pthread stubs. Lets not and say we didn't
540
Dylan Baker32180562017-09-20 20:11:32 -0700541prog_bison = find_program('bison', required : with_any_opengl)
542prog_flex = find_program('flex', required : with_any_opengl)
543
Dylan Bakerd1992252017-09-14 17:57:17 -0700544# TODO: selinux
Dylan Baker32180562017-09-20 20:11:32 -0700545dep_selinux = []
Dylan Bakerd1992252017-09-14 17:57:17 -0700546
547# TODO: llvm-prefix and llvm-shared-libs
548
Dylan Bakerd1992252017-09-14 17:57:17 -0700549# TODO: unwind (llvm [radeon, gallivm] and gallium)
550
551# TODO: flags for opengl, gles, dri
552
553# TODO: gallium-hud
554
555# TODO: glx provider
556
557# TODO: osmesa provider
558
559# TODO: flags for xa, egl, gbm, nin, xvmc, vdpau, omx, va, opencl,
560# gallium-tests,
561
562# TODO: gallium drivers
563
Dylan Bakerd1992252017-09-14 17:57:17 -0700564# TODO: symbol mangling
565
Dylan Bakerd1992252017-09-14 17:57:17 -0700566# TODO: egl configuration
567
568if with_platform_wayland
569 prog_wl_scanner = find_program('wayland-scanner')
570 dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
571 dep_wayland_client = dependency('wayland-client', version : '>=1.11')
572 dep_wayland_server = dependency('wayland-server', version : '>=1.11')
573else
574 prog_wl_scanner = []
575 dep_wl_protocols = []
576 dep_wayland_client = []
577 dep_wayland_server = []
578endif
579
580dep_xcb_dri2 = []
581dep_xcb_dri3 = []
Dylan Bakera47c5252017-09-22 12:55:00 -0700582dep_dri2proto = []
583dep_glproto = []
584dep_x11 = []
585dep_xf86vm = []
Dylan Bakerd1992252017-09-14 17:57:17 -0700586if with_platform_x11
Dylan Bakera47c5252017-09-22 12:55:00 -0700587 if with_glx == 'xlib'
588 # TODO
589 error('TODO')
590 elif with_glx == 'gallium-xlib'
591 # TODO
592 error('TODO')
Dylan Bakerd1992252017-09-14 17:57:17 -0700593 else
Dylan Bakera47c5252017-09-22 12:55:00 -0700594 pre_args += '-DGLX_INDIRECT_RENDERING'
595 if with_glx_direct
596 pre_args += '-DGLX_DIRECT_RENDERING'
597 endif
598 if with_dri_platform == 'drm'
599 pre_args += '-DGLX_USE_DRM'
600 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
601 dep_x11 = [
602 dependency('x11'),
603 dependency('xext'),
604 dependency('xdamage', version : '>= 1.1'),
605 dependency('xfixes'),
606 dependency('x11-xcb'),
607 dependency('xcb'),
608 dependency('xcb-glx', version : '>= 1.8.1'),
609 ]
610
Ville Syrjälä66b15972017-10-10 01:34:18 +0300611 dep_xf86vm = dependency('xxf86vm', required : false)
Dylan Bakera47c5252017-09-22 12:55:00 -0700612 endif
613 # TODO: XF86VIDMODE
614 endif
615 if with_glx != 'disabled'
616 dep_glproto = dependency('glproto', version : '>= 1.4.14')
617 endif
618 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
619 dep_xcb_dri2 = [
620 dependency('x11-xcb'),
621 dependency('xcb'),
622 dependency('xcb-dri2', version : '>= 1.8'),
623 dependency('xcb-xfixes'),
624 ]
625 pre_args += '-DHAVE_X11_PLATFORM'
626 if with_dri3
627 pre_args += '-DHAVE_DRI3'
628 dep_xcb_dri3 = [
629 dep_xcb_dri2,
630 dependency('xcb-dri3'),
631 dependency('xcb-present'),
632 dependency('xcb-sync'),
633 dependency('xshmfence', version : '>= 1.1'),
634 ]
635 endif
Dylan Bakerd1992252017-09-14 17:57:17 -0700636 endif
637endif
638
639# TODO: platforms for !vulkan
640
Dylan Bakerd1992252017-09-14 17:57:17 -0700641# TODO: osmesa
642
643# TODO: egl
644
645# TODO: xa
646
647# TODO: vallium G3DVL
648
649# TODO: nine
650
651# TODO: clover
652
653# TODO: egl sans x11
654
655# TODO: xvmc
656
657# TODO: gallium tests
658
659# TODO: various libdirs
660
661# TODO: swr
662
663# TODO: gallium driver dirs
664
665# FIXME: this is a workaround for #2326
666prog_touch = find_program('touch')
667dummy_cpp = custom_target(
668 'dummy_cpp',
669 output : 'dummy.cpp',
670 command : [prog_touch, '@OUTPUT@'],
671)
672
673foreach a : pre_args
674 add_project_arguments(a, language : ['c', 'cpp'])
675endforeach
676foreach a : c_args
677 add_project_arguments(a, language : ['c'])
678endforeach
679foreach a : cpp_args
680 add_project_arguments(a, language : ['cpp'])
681endforeach
682
683inc_include = include_directories('include')
684
Dylan Baker32180562017-09-20 20:11:32 -0700685pkg = import('pkgconfig')
686
Dylan Bakerd1992252017-09-14 17:57:17 -0700687subdir('include')
688subdir('src')