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