1 | # Copyright © 2017-2020 Intel Corporation
|
---|
2 |
|
---|
3 | # Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
4 | # of this software and associated documentation files (the "Software"), to deal
|
---|
5 | # in the Software without restriction, including without limitation the rights
|
---|
6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
7 | # copies of the Software, and to permit persons to whom the Software is
|
---|
8 | # furnished to do so, subject to the following conditions:
|
---|
9 |
|
---|
10 | # The above copyright notice and this permission notice shall be included in
|
---|
11 | # all copies or substantial portions of the Software.
|
---|
12 |
|
---|
13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
19 | # SOFTWARE.
|
---|
20 |
|
---|
21 | project(
|
---|
22 | 'mesa',
|
---|
23 | ['c', 'cpp'],
|
---|
24 | version : run_command(
|
---|
25 | [find_program('python3', 'python'), 'bin/meson_get_version.py'],
|
---|
26 | check : true
|
---|
27 | ).stdout(),
|
---|
28 | license : 'MIT',
|
---|
29 | meson_version : '>= 0.52',
|
---|
30 | default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++14']
|
---|
31 | )
|
---|
32 |
|
---|
33 | cc = meson.get_compiler('c')
|
---|
34 | cpp = meson.get_compiler('cpp')
|
---|
35 |
|
---|
36 | null_dep = dependency('', required : false)
|
---|
37 |
|
---|
38 | if get_option('layout') != 'mirror'
|
---|
39 | error('`mirror` is the only build directory layout supported')
|
---|
40 | endif
|
---|
41 |
|
---|
42 | amber = get_option('amber')
|
---|
43 | if amber
|
---|
44 | package_version_suffix=' Amber'
|
---|
45 | else
|
---|
46 | package_version_suffix=''
|
---|
47 | endif
|
---|
48 |
|
---|
49 | # Arguments for the preprocessor, put these in a separate array from the C and
|
---|
50 | # C++ (cpp in meson terminology) arguments since they need to be added to the
|
---|
51 | # default arguments for both C and C++.
|
---|
52 | pre_args = [
|
---|
53 | '-D__STDC_CONSTANT_MACROS',
|
---|
54 | '-D__STDC_FORMAT_MACROS',
|
---|
55 | '-D__STDC_LIMIT_MACROS',
|
---|
56 | '-DPACKAGE_VERSION="@0@@1@"'.format(meson.project_version(), package_version_suffix),
|
---|
57 | '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"',
|
---|
58 | ]
|
---|
59 | c_args = []
|
---|
60 | cpp_args = []
|
---|
61 |
|
---|
62 | with_moltenvk_dir = get_option('moltenvk-dir')
|
---|
63 |
|
---|
64 | if amber
|
---|
65 | pre_args += '-DAMBER'
|
---|
66 | endif
|
---|
67 |
|
---|
68 | with_vulkan_icd_dir = get_option('vulkan-icd-dir')
|
---|
69 | with_tests = get_option('build-tests')
|
---|
70 | with_aco_tests = get_option('build-aco-tests')
|
---|
71 | with_glx_read_only_text = get_option('glx-read-only-text')
|
---|
72 | with_glx_direct = get_option('glx-direct')
|
---|
73 | with_osmesa = get_option('osmesa')
|
---|
74 | with_swr_arches = get_option('swr-arches')
|
---|
75 | with_vulkan_overlay_layer = get_option('vulkan-layers').contains('overlay')
|
---|
76 | with_vulkan_device_select_layer = get_option('vulkan-layers').contains('device-select')
|
---|
77 | with_tools = get_option('tools')
|
---|
78 | if with_tools.contains('all')
|
---|
79 | with_tools = [
|
---|
80 | 'drm-shim',
|
---|
81 | 'etnaviv',
|
---|
82 | 'freedreno',
|
---|
83 | 'glsl',
|
---|
84 | 'intel',
|
---|
85 | 'intel-ui',
|
---|
86 | 'lima',
|
---|
87 | 'nir',
|
---|
88 | 'nouveau',
|
---|
89 | 'xvmc',
|
---|
90 | 'asahi',
|
---|
91 | ]
|
---|
92 | endif
|
---|
93 |
|
---|
94 | with_any_vulkan_layers = get_option('vulkan-layers').length() != 0
|
---|
95 | with_intel_tools = with_tools.contains('intel') or with_tools.contains('intel-ui')
|
---|
96 | with_imgui = with_intel_tools or with_vulkan_overlay_layer
|
---|
97 |
|
---|
98 | dri_drivers_path = get_option('dri-drivers-path')
|
---|
99 | if dri_drivers_path == ''
|
---|
100 | dri_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
|
---|
101 | endif
|
---|
102 | dri_search_path = get_option('dri-search-path')
|
---|
103 | if dri_search_path == ''
|
---|
104 | dri_search_path = dri_drivers_path
|
---|
105 | endif
|
---|
106 |
|
---|
107 | gbm_backends_path = get_option('gbm-backends-path')
|
---|
108 | if gbm_backends_path == ''
|
---|
109 | gbm_backends_path = join_paths(get_option('prefix'), get_option('libdir'), 'gbm')
|
---|
110 | endif
|
---|
111 |
|
---|
112 | with_gles1 = get_option('gles1')
|
---|
113 | if with_gles1 == 'true'
|
---|
114 | with_gles1 = 'enabled'
|
---|
115 | warning('gles1 option "true" deprecated, please use "enabled" instead.')
|
---|
116 | elif with_gles1 == 'false'
|
---|
117 | with_gles1 = 'disabled'
|
---|
118 | warning('gles1 option "false" deprecated, please use "disabled" instead.')
|
---|
119 | endif
|
---|
120 | with_gles2 = get_option('gles2')
|
---|
121 | if with_gles2 == 'true'
|
---|
122 | with_gles2 = 'enabled'
|
---|
123 | warning('gles2 option "true" deprecated, please use "enabled" instead.')
|
---|
124 | elif with_gles2 == 'false'
|
---|
125 | with_gles2 = 'disabled'
|
---|
126 | warning('gles2 option "false" deprecated, please use "disabled" instead.')
|
---|
127 | endif
|
---|
128 | if host_machine.system() == 'windows'
|
---|
129 | if with_gles1 == 'auto'
|
---|
130 | with_gles1 = 'disabled'
|
---|
131 | endif
|
---|
132 | if with_gles2 == 'auto'
|
---|
133 | with_gles2 = 'disabled'
|
---|
134 | endif
|
---|
135 | endif
|
---|
136 | with_opengl = get_option('opengl')
|
---|
137 |
|
---|
138 | # Default shared glapi off for windows, on elsewhere.
|
---|
139 | _sg = get_option('shared-glapi')
|
---|
140 | if _sg == 'true'
|
---|
141 | _sg = 'enabled'
|
---|
142 | warning('shared-glapi option "true" deprecated, please use "enabled" instead.')
|
---|
143 | elif _sg == 'false'
|
---|
144 | _sg = 'disabled'
|
---|
145 | warning('shared-glapi option "false" deprecated, please use "disabled" instead.')
|
---|
146 | endif
|
---|
147 | if _sg == 'auto'
|
---|
148 | with_shared_glapi = host_machine.system() != 'windows'
|
---|
149 | else
|
---|
150 | with_shared_glapi = _sg == 'enabled'
|
---|
151 | endif
|
---|
152 |
|
---|
153 | # shared-glapi is required if at least two OpenGL APIs are being built
|
---|
154 | if not with_shared_glapi
|
---|
155 | if ((with_gles1 == 'enabled' and with_gles2 == 'enabled') or
|
---|
156 | (with_gles1 == 'enabled' and with_opengl) or
|
---|
157 | (with_gles2 == 'enabled' and with_opengl))
|
---|
158 | error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
|
---|
159 | endif
|
---|
160 | with_gles1 = 'disabled'
|
---|
161 | with_gles2 = 'disabled'
|
---|
162 | endif
|
---|
163 |
|
---|
164 | # We require OpenGL for OpenGL ES
|
---|
165 | if not with_opengl
|
---|
166 | if (with_gles1 == 'enabled' or with_gles2 == 'enabled') and not with_opengl
|
---|
167 | error('building OpenGL ES without OpenGL is not supported.')
|
---|
168 | endif
|
---|
169 | with_gles1 = 'disabled'
|
---|
170 | with_gles2 = 'disabled'
|
---|
171 | endif
|
---|
172 |
|
---|
173 | with_gles1 = with_gles1 != 'disabled'
|
---|
174 | with_gles2 = with_gles2 != 'disabled'
|
---|
175 | with_any_opengl = with_opengl or with_gles1 or with_gles2
|
---|
176 | # Only build shared_glapi if at least one OpenGL API is enabled
|
---|
177 | with_shared_glapi = with_shared_glapi and with_any_opengl
|
---|
178 |
|
---|
179 | system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos'].contains(host_machine.system())
|
---|
180 |
|
---|
181 | dri_drivers = get_option('dri-drivers')
|
---|
182 | if dri_drivers.contains('auto')
|
---|
183 | if system_has_kms_drm
|
---|
184 | # TODO: PPC, Sparc
|
---|
185 | if ['x86', 'x86_64'].contains(host_machine.cpu_family())
|
---|
186 | dri_drivers = ['i915', 'i965', 'r100', 'r200', 'nouveau']
|
---|
187 | elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
|
---|
188 | dri_drivers = []
|
---|
189 | elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
|
---|
190 | dri_drivers = ['r100', 'r200', 'nouveau']
|
---|
191 | else
|
---|
192 | error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
|
---|
193 | host_machine.cpu_family()))
|
---|
194 | endif
|
---|
195 | elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
|
---|
196 | # only swrast would make sense here, but gallium swrast is a much better default
|
---|
197 | dri_drivers = []
|
---|
198 | else
|
---|
199 | error('Unknown OS @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
|
---|
200 | host_machine.system()))
|
---|
201 | endif
|
---|
202 | endif
|
---|
203 |
|
---|
204 | with_dri_i915 = dri_drivers.contains('i915')
|
---|
205 | with_dri_i965 = dri_drivers.contains('i965')
|
---|
206 | with_dri_r100 = dri_drivers.contains('r100')
|
---|
207 | with_dri_r200 = dri_drivers.contains('r200')
|
---|
208 | with_dri_nouveau = dri_drivers.contains('nouveau')
|
---|
209 |
|
---|
210 | with_dri = dri_drivers.length() != 0
|
---|
211 |
|
---|
212 | gallium_drivers = get_option('gallium-drivers')
|
---|
213 | if gallium_drivers.contains('auto')
|
---|
214 | if amber
|
---|
215 | gallium_drivers = []
|
---|
216 | elif system_has_kms_drm
|
---|
217 | # TODO: PPC, Sparc
|
---|
218 | if ['x86', 'x86_64'].contains(host_machine.cpu_family())
|
---|
219 | gallium_drivers = [
|
---|
220 | 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'svga', 'swrast',
|
---|
221 | 'iris', 'crocus'
|
---|
222 | ]
|
---|
223 | elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
|
---|
224 | gallium_drivers = [
|
---|
225 | 'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau',
|
---|
226 | 'tegra', 'virgl', 'lima', 'panfrost', 'swrast'
|
---|
227 | ]
|
---|
228 | elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
|
---|
229 | gallium_drivers = [
|
---|
230 | 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'swrast'
|
---|
231 | ]
|
---|
232 | else
|
---|
233 | error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
|
---|
234 | host_machine.cpu_family()))
|
---|
235 | endif
|
---|
236 | elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
|
---|
237 | gallium_drivers = ['swrast']
|
---|
238 | else
|
---|
239 | error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
|
---|
240 | host_machine.system()))
|
---|
241 | endif
|
---|
242 | endif
|
---|
243 | with_gallium_radeonsi = gallium_drivers.contains('radeonsi')
|
---|
244 | with_gallium_r300 = gallium_drivers.contains('r300')
|
---|
245 | with_gallium_r600 = gallium_drivers.contains('r600')
|
---|
246 | with_gallium_nouveau = gallium_drivers.contains('nouveau')
|
---|
247 | with_gallium_freedreno = gallium_drivers.contains('freedreno')
|
---|
248 | with_gallium_softpipe = gallium_drivers.contains('swrast')
|
---|
249 | with_gallium_vc4 = gallium_drivers.contains('vc4')
|
---|
250 | with_gallium_v3d = gallium_drivers.contains('v3d')
|
---|
251 | with_gallium_panfrost = gallium_drivers.contains('panfrost')
|
---|
252 | with_gallium_etnaviv = gallium_drivers.contains('etnaviv')
|
---|
253 | with_gallium_tegra = gallium_drivers.contains('tegra')
|
---|
254 | with_gallium_crocus = gallium_drivers.contains('crocus')
|
---|
255 | with_gallium_iris = gallium_drivers.contains('iris')
|
---|
256 | with_gallium_i915 = gallium_drivers.contains('i915')
|
---|
257 | with_gallium_svga = gallium_drivers.contains('svga')
|
---|
258 | with_gallium_virgl = gallium_drivers.contains('virgl')
|
---|
259 | with_gallium_swr = gallium_drivers.contains('swr')
|
---|
260 | with_gallium_lima = gallium_drivers.contains('lima')
|
---|
261 | with_gallium_zink = gallium_drivers.contains('zink')
|
---|
262 | with_gallium_d3d12 = gallium_drivers.contains('d3d12')
|
---|
263 | with_gallium_asahi = gallium_drivers.contains('asahi')
|
---|
264 |
|
---|
265 | with_gallium = gallium_drivers.length() != 0
|
---|
266 | with_gallium_kmsro = with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_panfrost or with_gallium_lima or with_gallium_freedreno
|
---|
267 |
|
---|
268 | if with_gallium and system_has_kms_drm
|
---|
269 | _glx = get_option('glx')
|
---|
270 | _egl = get_option('egl')
|
---|
271 | if _glx == 'dri' or _egl == 'enabled' or (_glx == 'disabled' and _egl != 'disabled')
|
---|
272 | with_dri = true
|
---|
273 | endif
|
---|
274 | endif
|
---|
275 |
|
---|
276 | _vulkan_drivers = get_option('vulkan-drivers')
|
---|
277 | if _vulkan_drivers.contains('auto')
|
---|
278 | if system_has_kms_drm
|
---|
279 | if amber
|
---|
280 | _vulkan_drivers = []
|
---|
281 | elif host_machine.cpu_family().startswith('x86')
|
---|
282 | _vulkan_drivers = ['amd', 'intel', 'swrast']
|
---|
283 | elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
|
---|
284 | _vulkan_drivers = ['swrast']
|
---|
285 | elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
|
---|
286 | _vulkan_drivers = ['amd', 'swrast']
|
---|
287 | else
|
---|
288 | error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
|
---|
289 | host_machine.cpu_family()))
|
---|
290 | endif
|
---|
291 | elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
|
---|
292 | # No vulkan driver supports windows or macOS currently
|
---|
293 | _vulkan_drivers = []
|
---|
294 | else
|
---|
295 | error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
|
---|
296 | host_machine.system()))
|
---|
297 | endif
|
---|
298 | endif
|
---|
299 |
|
---|
300 | with_intel_vk = _vulkan_drivers.contains('intel')
|
---|
301 | with_amd_vk = _vulkan_drivers.contains('amd')
|
---|
302 | with_freedreno_vk = _vulkan_drivers.contains('freedreno')
|
---|
303 | with_panfrost_vk = _vulkan_drivers.contains('panfrost')
|
---|
304 | with_swrast_vk = _vulkan_drivers.contains('swrast')
|
---|
305 | with_virtio_vk = _vulkan_drivers.contains('virtio-experimental')
|
---|
306 | with_freedreno_kgsl = get_option('freedreno-kgsl')
|
---|
307 | with_broadcom_vk = _vulkan_drivers.contains('broadcom')
|
---|
308 | with_any_vk = _vulkan_drivers.length() != 0
|
---|
309 |
|
---|
310 | with_any_broadcom = with_gallium_vc4 or with_gallium_v3d or with_broadcom_vk
|
---|
311 | with_any_intel = with_dri_i965 or with_intel_vk or with_gallium_iris or with_gallium_crocus
|
---|
312 |
|
---|
313 | if with_swrast_vk and not with_gallium_softpipe
|
---|
314 | error('swrast vulkan requires gallium swrast')
|
---|
315 | endif
|
---|
316 | if with_dri_i915 and with_gallium_i915
|
---|
317 | error('Only one i915 provider can be built')
|
---|
318 | endif
|
---|
319 | if with_gallium_tegra and not with_gallium_nouveau
|
---|
320 | error('tegra driver requires nouveau driver')
|
---|
321 | endif
|
---|
322 | if with_aco_tests and not with_amd_vk
|
---|
323 | error('ACO tests require Radv')
|
---|
324 | endif
|
---|
325 |
|
---|
326 | with_microsoft_clc = get_option('microsoft-clc').enabled()
|
---|
327 | with_clc = with_microsoft_clc
|
---|
328 | with_libclc = with_clc
|
---|
329 | with_spirv_to_dxil = get_option('spirv-to-dxil')
|
---|
330 |
|
---|
331 | if host_machine.system() == 'darwin'
|
---|
332 | with_dri_platform = 'apple'
|
---|
333 | pre_args += '-DBUILDING_MESA'
|
---|
334 | elif ['windows', 'cygwin'].contains(host_machine.system())
|
---|
335 | with_dri_platform = 'windows'
|
---|
336 | elif system_has_kms_drm
|
---|
337 | with_dri_platform = 'drm'
|
---|
338 | else
|
---|
339 | # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
|
---|
340 | # assert here that one of those cases has been met.
|
---|
341 | # FIXME: illumos ends up here as well
|
---|
342 | with_dri_platform = 'none'
|
---|
343 | endif
|
---|
344 |
|
---|
345 | _platforms = get_option('platforms')
|
---|
346 | if _platforms.contains('auto')
|
---|
347 | if system_has_kms_drm
|
---|
348 | _platforms = ['x11', 'wayland']
|
---|
349 | elif ['darwin', 'cygwin'].contains(host_machine.system())
|
---|
350 | _platforms = ['x11']
|
---|
351 | elif ['haiku'].contains(host_machine.system())
|
---|
352 | _platforms = ['haiku']
|
---|
353 | elif host_machine.system() == 'windows'
|
---|
354 | _platforms = ['windows']
|
---|
355 | else
|
---|
356 | error('Unknown OS @0@. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.'.format(
|
---|
357 | host_machine.system()))
|
---|
358 | endif
|
---|
359 | endif
|
---|
360 |
|
---|
361 | with_platform_android = _platforms.contains('android')
|
---|
362 | with_platform_x11 = _platforms.contains('x11')
|
---|
363 | with_platform_wayland = _platforms.contains('wayland')
|
---|
364 | with_platform_haiku = _platforms.contains('haiku')
|
---|
365 | with_platform_windows = _platforms.contains('windows')
|
---|
366 |
|
---|
367 | with_glx = get_option('glx')
|
---|
368 | if with_glx == 'auto'
|
---|
369 | if with_platform_android
|
---|
370 | with_glx = 'disabled'
|
---|
371 | elif with_dri
|
---|
372 | with_glx = 'dri'
|
---|
373 | elif with_platform_haiku
|
---|
374 | with_glx = 'disabled'
|
---|
375 | elif host_machine.system() == 'windows'
|
---|
376 | with_glx = 'disabled'
|
---|
377 | elif with_gallium
|
---|
378 | # Even when building just gallium drivers the user probably wants dri
|
---|
379 | with_glx = 'dri'
|
---|
380 | elif with_platform_x11 and with_any_opengl and not with_any_vk
|
---|
381 | # The automatic behavior should not be to turn on xlib based glx when
|
---|
382 | # building only vulkan drivers
|
---|
383 | with_glx = 'xlib'
|
---|
384 | else
|
---|
385 | with_glx = 'disabled'
|
---|
386 | endif
|
---|
387 | endif
|
---|
388 | if with_glx == 'dri'
|
---|
389 | if with_gallium
|
---|
390 | with_dri = true
|
---|
391 | endif
|
---|
392 | endif
|
---|
393 |
|
---|
394 | if not (with_dri or with_gallium or with_glx != 'disabled')
|
---|
395 | with_gles1 = false
|
---|
396 | with_gles2 = false
|
---|
397 | with_opengl = false
|
---|
398 | with_any_opengl = false
|
---|
399 | with_shared_glapi = false
|
---|
400 | endif
|
---|
401 |
|
---|
402 | _gbm = get_option('gbm')
|
---|
403 | if _gbm == 'true'
|
---|
404 | _gbm = 'enabled'
|
---|
405 | warning('gbm option "true" deprecated, please use "enabled" instead.')
|
---|
406 | elif _gbm == 'false'
|
---|
407 | _gbm = 'disabled'
|
---|
408 | warning('gbm option "false" deprecated, please use "disabled" instead.')
|
---|
409 | endif
|
---|
410 | if _gbm == 'auto'
|
---|
411 | with_gbm = system_has_kms_drm and with_dri
|
---|
412 | else
|
---|
413 | with_gbm = _gbm == 'enabled'
|
---|
414 | endif
|
---|
415 | if with_gbm and not system_has_kms_drm
|
---|
416 | error('GBM only supports DRM/KMS platforms')
|
---|
417 | endif
|
---|
418 |
|
---|
419 | _xlib_lease = get_option('xlib-lease')
|
---|
420 | if _xlib_lease == 'true'
|
---|
421 | _xlib_lease = 'enabled'
|
---|
422 | warning('xlib_lease option "true" deprecated, please use "enabled" instead.')
|
---|
423 | elif _xlib_lease == 'false'
|
---|
424 | _xlib_lease = 'disabled'
|
---|
425 | warning('xlib_lease option "false" deprecated, please use "disabled" instead.')
|
---|
426 | endif
|
---|
427 | if _xlib_lease == 'auto'
|
---|
428 | with_xlib_lease = with_platform_x11 and system_has_kms_drm
|
---|
429 | else
|
---|
430 | with_xlib_lease = _xlib_lease == 'enabled'
|
---|
431 | endif
|
---|
432 |
|
---|
433 | if with_platform_wayland
|
---|
434 | c_args += '-DVK_USE_PLATFORM_WAYLAND_KHR'
|
---|
435 | #add this once aco and other places can build with it
|
---|
436 | #cpp_args += '-DVK_USE_PLATFORM_WAYLAND_KHR'
|
---|
437 | endif
|
---|
438 | if with_platform_x11
|
---|
439 | c_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR']
|
---|
440 | #add this once aco and other places can build with it
|
---|
441 | #cpp_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR']
|
---|
442 | endif
|
---|
443 | if with_platform_windows
|
---|
444 | c_args += '-DVK_USE_PLATFORM_WIN32_KHR'
|
---|
445 | #add this once aco and other places can build with it
|
---|
446 | #cpp_args += '-DVK_USE_PLATFORM_WIN32_KHR'
|
---|
447 | endif
|
---|
448 | if with_platform_android
|
---|
449 | c_args += '-DVK_USE_PLATFORM_ANDROID_KHR'
|
---|
450 | cpp_args += '-DVK_USE_PLATFORM_ANDROID_KHR'
|
---|
451 | endif
|
---|
452 | if with_xlib_lease
|
---|
453 | c_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
|
---|
454 | #add this once aco and other places can build with it
|
---|
455 | #cpp_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
|
---|
456 | endif
|
---|
457 | if system_has_kms_drm and not with_platform_android
|
---|
458 | c_args += '-DVK_USE_PLATFORM_DISPLAY_KHR'
|
---|
459 | cpp_args += '-DVK_USE_PLATFORM_DISPLAY_KHR'
|
---|
460 | endif
|
---|
461 |
|
---|
462 | _egl = get_option('egl')
|
---|
463 | if _egl == 'true'
|
---|
464 | _egl = 'enabled'
|
---|
465 | warning('egl option "true" deprecated, please use "enabled" instead.')
|
---|
466 | elif _egl == 'false'
|
---|
467 | _egl = 'disabled'
|
---|
468 | warning('egl option "false" deprecated, please use "disabled" instead.')
|
---|
469 | endif
|
---|
470 | if _egl == 'auto'
|
---|
471 | with_egl = (
|
---|
472 | host_machine.system() != 'darwin' and
|
---|
473 | (with_platform_windows or with_dri) and
|
---|
474 | with_shared_glapi
|
---|
475 | )
|
---|
476 | elif _egl == 'enabled'
|
---|
477 | if not with_dri and not with_platform_haiku and not with_platform_windows
|
---|
478 | error('EGL requires dri, haiku, or windows')
|
---|
479 | elif not with_shared_glapi
|
---|
480 | error('EGL requires shared-glapi')
|
---|
481 | elif not ['disabled', 'dri'].contains(with_glx)
|
---|
482 | error('EGL requires dri, but a GLX is being built without dri')
|
---|
483 | elif host_machine.system() == 'darwin'
|
---|
484 | error('EGL is not available on MacOS')
|
---|
485 | endif
|
---|
486 | with_egl = true
|
---|
487 | else
|
---|
488 | with_egl = false
|
---|
489 | endif
|
---|
490 |
|
---|
491 | if with_egl
|
---|
492 | _platforms += 'surfaceless'
|
---|
493 | if with_gbm and not with_platform_android
|
---|
494 | _platforms += 'drm'
|
---|
495 | endif
|
---|
496 | endif
|
---|
497 |
|
---|
498 | egl_native_platform = get_option('egl-native-platform')
|
---|
499 | if egl_native_platform.contains('auto')
|
---|
500 | if _platforms.length() != 0
|
---|
501 | egl_native_platform = _platforms[0]
|
---|
502 | else
|
---|
503 | egl_native_platform = 'surfaceless'
|
---|
504 | endif
|
---|
505 | endif
|
---|
506 |
|
---|
507 | if with_egl and not _platforms.contains(egl_native_platform)
|
---|
508 | error('-Degl-native-platform does not specify an enabled platform')
|
---|
509 | endif
|
---|
510 |
|
---|
511 | # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
|
---|
512 | use_elf_tls = false
|
---|
513 | if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and
|
---|
514 | (not with_platform_android or get_option('platform-sdk-version') >= 29) and
|
---|
515 | (not with_platform_windows or not with_shared_glapi))
|
---|
516 | pre_args += '-DUSE_ELF_TLS'
|
---|
517 | use_elf_tls = true
|
---|
518 |
|
---|
519 | if with_platform_android
|
---|
520 | # By default the NDK compiler, at least, emits emutls references instead of
|
---|
521 | # ELF TLS, even when building targeting newer API levels. Make it actually do
|
---|
522 | # ELF TLS instead.
|
---|
523 | c_args += '-fno-emulated-tls'
|
---|
524 | cpp_args += '-fno-emulated-tls'
|
---|
525 | endif
|
---|
526 | endif
|
---|
527 |
|
---|
528 | if with_glx != 'disabled'
|
---|
529 | if not (with_platform_x11 and with_any_opengl)
|
---|
530 | error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
|
---|
531 | elif with_glx == 'gallium-xlib'
|
---|
532 | if not with_gallium
|
---|
533 | error('Gallium-xlib based GLX requires at least one gallium driver')
|
---|
534 | elif not with_gallium_softpipe
|
---|
535 | error('Gallium-xlib based GLX requires softpipe or llvmpipe.')
|
---|
536 | elif with_dri
|
---|
537 | error('gallium-xlib conflicts with any dri driver')
|
---|
538 | endif
|
---|
539 | elif with_glx == 'xlib'
|
---|
540 | if with_dri
|
---|
541 | error('xlib conflicts with any dri driver')
|
---|
542 | endif
|
---|
543 | elif with_glx == 'dri'
|
---|
544 | if not with_shared_glapi
|
---|
545 | error('dri based GLX requires shared-glapi')
|
---|
546 | endif
|
---|
547 | endif
|
---|
548 | endif
|
---|
549 |
|
---|
550 | _glvnd = get_option('glvnd')
|
---|
551 | if _glvnd == 'true' or _glvnd == 'enabled' or (amber and _glvnd == 'auto')
|
---|
552 | with_glvnd = true
|
---|
553 | else
|
---|
554 | with_glvnd = false
|
---|
555 | endif
|
---|
556 |
|
---|
557 | glvnd_vendor_name = get_option('glvnd-vendor-name')
|
---|
558 | if glvnd_vendor_name == 'auto'
|
---|
559 | if amber
|
---|
560 | glvnd_vendor_name = 'amber'
|
---|
561 | else
|
---|
562 | glvnd_vendor_name = 'mesa'
|
---|
563 | endif
|
---|
564 | endif
|
---|
565 |
|
---|
566 | if with_glvnd
|
---|
567 | if with_platform_windows
|
---|
568 | error('glvnd cannot be used on Windows')
|
---|
569 | elif with_glx == 'xlib' or with_glx == 'gallium-xlib'
|
---|
570 | error('Cannot build glvnd support for GLX that is not DRI based.')
|
---|
571 | elif with_glx == 'disabled' and not with_egl
|
---|
572 | error('glvnd requires DRI based GLX and/or EGL')
|
---|
573 | endif
|
---|
574 | if get_option('egl-lib-suffix') != ''
|
---|
575 | error('''EGL lib suffix can't be used with libglvnd''')
|
---|
576 | endif
|
---|
577 | endif
|
---|
578 |
|
---|
579 | if with_vulkan_icd_dir == ''
|
---|
580 | with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
|
---|
581 | endif
|
---|
582 |
|
---|
583 | # GNU/Hurd includes egl_dri2, without drm.
|
---|
584 | with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or
|
---|
585 | host_machine.system() == 'gnu')
|
---|
586 | _dri3 = get_option('dri3')
|
---|
587 | if _dri3 == 'true'
|
---|
588 | _dri3 = 'enabled'
|
---|
589 | warning('dri3 option "true" deprecated, please use "enabled" instead.')
|
---|
590 | elif _dri3 == 'false'
|
---|
591 | _dri3 = 'disabled'
|
---|
592 | warning('dri3 option "false" deprecated, please use "disabled" instead.')
|
---|
593 | endif
|
---|
594 | if _dri3 == 'auto'
|
---|
595 | with_dri3 = system_has_kms_drm and with_dri2
|
---|
596 | else
|
---|
597 | with_dri3 = _dri3 == 'enabled'
|
---|
598 | endif
|
---|
599 |
|
---|
600 | if with_any_vk and (with_platform_x11 and not with_dri3)
|
---|
601 | error('Vulkan drivers require dri3 for X11 support')
|
---|
602 | endif
|
---|
603 | if with_dri
|
---|
604 | if with_glx == 'disabled' and not with_egl and not with_gbm
|
---|
605 | error('building dri drivers require at least one windowing system')
|
---|
606 | endif
|
---|
607 | endif
|
---|
608 |
|
---|
609 | if with_gallium_kmsro and (with_platform_x11 and not with_dri3)
|
---|
610 | error('kmsro requires dri3 for X11 support')
|
---|
611 | endif
|
---|
612 |
|
---|
613 | _vdpau = get_option('gallium-vdpau')
|
---|
614 | if _vdpau == 'true'
|
---|
615 | _vdpau = 'enabled'
|
---|
616 | warning('gallium-vdpau option "true" deprecated, please use "enabled" instead.')
|
---|
617 | elif _vdpau == 'false'
|
---|
618 | _vdpau = 'disabled'
|
---|
619 | warning('gallium-vdpau option "false" deprecated, please use "disabled" instead.')
|
---|
620 | endif
|
---|
621 | if not system_has_kms_drm
|
---|
622 | if _vdpau == 'enabled'
|
---|
623 | error('VDPAU state tracker can only be build on unix-like OSes.')
|
---|
624 | else
|
---|
625 | _vdpau = 'disabled'
|
---|
626 | endif
|
---|
627 | elif not with_platform_x11
|
---|
628 | if _vdpau == 'enabled'
|
---|
629 | error('VDPAU state tracker requires X11 support.')
|
---|
630 | else
|
---|
631 | _vdpau = 'disabled'
|
---|
632 | endif
|
---|
633 | elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or
|
---|
634 | with_gallium_nouveau)
|
---|
635 | if _vdpau == 'enabled'
|
---|
636 | error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau.')
|
---|
637 | else
|
---|
638 | _vdpau = 'disabled'
|
---|
639 | endif
|
---|
640 | endif
|
---|
641 | dep_vdpau = null_dep
|
---|
642 | with_gallium_vdpau = false
|
---|
643 | if _vdpau != 'disabled'
|
---|
644 | dep_vdpau = dependency('vdpau', version : '>= 1.1', required : _vdpau == 'enabled')
|
---|
645 | if dep_vdpau.found()
|
---|
646 | dep_vdpau = dep_vdpau.partial_dependency(compile_args : true)
|
---|
647 | with_gallium_vdpau = true
|
---|
648 | endif
|
---|
649 | endif
|
---|
650 |
|
---|
651 | if with_gallium_vdpau
|
---|
652 | pre_args += '-DHAVE_ST_VDPAU'
|
---|
653 | endif
|
---|
654 | vdpau_drivers_path = get_option('vdpau-libs-path')
|
---|
655 | if vdpau_drivers_path == ''
|
---|
656 | vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
|
---|
657 | endif
|
---|
658 |
|
---|
659 | if with_gallium_zink
|
---|
660 | dep_vulkan = dependency('vulkan')
|
---|
661 | endif
|
---|
662 |
|
---|
663 | dep_dxheaders = null_dep
|
---|
664 | if with_gallium_d3d12 or with_microsoft_clc
|
---|
665 | dep_dxheaders = dependency('DirectX-Headers', fallback : ['DirectX-Headers', 'dep_dxheaders'],
|
---|
666 | required : with_gallium_d3d12
|
---|
667 | )
|
---|
668 | endif
|
---|
669 |
|
---|
670 | if with_vulkan_overlay_layer or with_aco_tests
|
---|
671 | prog_glslang = find_program('glslangValidator')
|
---|
672 | endif
|
---|
673 |
|
---|
674 | _xvmc = get_option('gallium-xvmc')
|
---|
675 | if _xvmc == 'true'
|
---|
676 | _xvmc = 'enabled'
|
---|
677 | warning('gallium-xvmc option "true" deprecated, please use "enabled" instead.')
|
---|
678 | elif _xvmc == 'false'
|
---|
679 | _xvmc = 'disabled'
|
---|
680 | warning('gallium-xvmc option "false" deprecated, please use "disabled" instead.')
|
---|
681 | endif
|
---|
682 | if not system_has_kms_drm
|
---|
683 | if _xvmc == 'enabled'
|
---|
684 | error('XVMC state tracker can only be build on unix-like OSes.')
|
---|
685 | else
|
---|
686 | _xvmc = 'disabled'
|
---|
687 | endif
|
---|
688 | elif not with_platform_x11
|
---|
689 | if _xvmc == 'enabled'
|
---|
690 | error('XVMC state tracker requires X11 support.')
|
---|
691 | else
|
---|
692 | _xvmc = 'disabled'
|
---|
693 | endif
|
---|
694 | elif not (with_gallium_r600 or with_gallium_nouveau)
|
---|
695 | if _xvmc == 'enabled'
|
---|
696 | error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.')
|
---|
697 | else
|
---|
698 | _xvmc = 'disabled'
|
---|
699 | endif
|
---|
700 | endif
|
---|
701 | dep_xvmc = null_dep
|
---|
702 | dep_xv = null_dep
|
---|
703 | with_gallium_xvmc = false
|
---|
704 | if _xvmc != 'disabled'
|
---|
705 | dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'enabled')
|
---|
706 | dep_xv = dependency('xv', required : _xvmc == 'enabled')
|
---|
707 | with_gallium_xvmc = dep_xvmc.found() and dep_xv.found()
|
---|
708 | endif
|
---|
709 |
|
---|
710 | xvmc_drivers_path = get_option('xvmc-libs-path')
|
---|
711 | if xvmc_drivers_path == ''
|
---|
712 | xvmc_drivers_path = get_option('libdir')
|
---|
713 | endif
|
---|
714 |
|
---|
715 | _omx = get_option('gallium-omx')
|
---|
716 | if not system_has_kms_drm
|
---|
717 | if ['auto', 'disabled'].contains(_omx)
|
---|
718 | _omx = 'disabled'
|
---|
719 | else
|
---|
720 | error('OMX state tracker can only be built on unix-like OSes.')
|
---|
721 | endif
|
---|
722 | elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
|
---|
723 | if ['auto', 'disabled'].contains(_omx)
|
---|
724 | _omx = 'disabled'
|
---|
725 | else
|
---|
726 | error('OMX state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
|
---|
727 | endif
|
---|
728 | endif
|
---|
729 | with_gallium_omx = _omx
|
---|
730 | dep_omx = null_dep
|
---|
731 | dep_omx_other = []
|
---|
732 | if ['auto', 'bellagio'].contains(_omx)
|
---|
733 | dep_omx = dependency(
|
---|
734 | 'libomxil-bellagio', required : _omx == 'bellagio'
|
---|
735 | )
|
---|
736 | if dep_omx.found()
|
---|
737 | with_gallium_omx = 'bellagio'
|
---|
738 | endif
|
---|
739 | endif
|
---|
740 | if ['auto', 'tizonia'].contains(_omx)
|
---|
741 | if with_dri and with_egl
|
---|
742 | dep_omx = dependency(
|
---|
743 | 'libtizonia', version : '>= 0.10.0',
|
---|
744 | required : _omx == 'tizonia',
|
---|
745 | )
|
---|
746 | dep_omx_other = [
|
---|
747 | dependency('libtizplatform', required : _omx == 'tizonia'),
|
---|
748 | dependency('tizilheaders', required : _omx == 'tizonia'),
|
---|
749 | ]
|
---|
750 | if dep_omx.found() and dep_omx_other[0].found() and dep_omx_other[1].found()
|
---|
751 | with_gallium_omx = 'tizonia'
|
---|
752 | endif
|
---|
753 | elif _omx == 'tizonia'
|
---|
754 | error('OMX-Tizonia state tracker requires dri and egl')
|
---|
755 | endif
|
---|
756 | endif
|
---|
757 | if _omx == 'auto'
|
---|
758 | with_gallium_omx = 'disabled'
|
---|
759 | else
|
---|
760 | with_gallium_omx = _omx
|
---|
761 | endif
|
---|
762 |
|
---|
763 | pre_args += [
|
---|
764 | '-DENABLE_ST_OMX_BELLAGIO=' + (with_gallium_omx == 'bellagio' ? '1' : '0'),
|
---|
765 | '-DENABLE_ST_OMX_TIZONIA=' + (with_gallium_omx == 'tizonia' ? '1' : '0'),
|
---|
766 | ]
|
---|
767 |
|
---|
768 |
|
---|
769 | omx_drivers_path = get_option('omx-libs-path')
|
---|
770 |
|
---|
771 | if with_gallium_omx != 'disabled'
|
---|
772 | # Figure out where to put the omx driver.
|
---|
773 | # FIXME: this could all be vastly simplified by adding a 'defined_variable'
|
---|
774 | # argument to meson's get_pkgconfig_variable method.
|
---|
775 | if omx_drivers_path == ''
|
---|
776 | _omx_libdir = dep_omx.get_pkgconfig_variable('libdir')
|
---|
777 | _omx_drivers_dir = dep_omx.get_pkgconfig_variable('pluginsdir')
|
---|
778 | if _omx_libdir == get_option('libdir')
|
---|
779 | omx_drivers_path = _omx_drivers_dir
|
---|
780 | else
|
---|
781 | _omx_base_dir = []
|
---|
782 | # This will fail on windows. Does OMX run on windows?
|
---|
783 | _omx_libdir = _omx_libdir.split('/')
|
---|
784 | _omx_drivers_dir = _omx_drivers_dir.split('/')
|
---|
785 | foreach o : _omx_drivers_dir
|
---|
786 | if not _omx_libdir.contains(o)
|
---|
787 | _omx_base_dir += o
|
---|
788 | endif
|
---|
789 | endforeach
|
---|
790 | omx_drivers_path = join_paths(get_option('libdir'), _omx_base_dir)
|
---|
791 | endif
|
---|
792 | endif
|
---|
793 | endif
|
---|
794 |
|
---|
795 | _va = get_option('gallium-va')
|
---|
796 | if _va == 'true'
|
---|
797 | _va = 'enabled'
|
---|
798 | warning('gallium-va option "true" deprecated, please use "enabled" instead.')
|
---|
799 | elif _va == 'false'
|
---|
800 | _va = 'disabled'
|
---|
801 | warning('gallium-va option "false" deprecated, please use "disabled" instead.')
|
---|
802 | endif
|
---|
803 | if not system_has_kms_drm
|
---|
804 | if _va == 'enabled'
|
---|
805 | error('VA state tracker can only be built on unix-like OSes.')
|
---|
806 | else
|
---|
807 | _va = 'disabled'
|
---|
808 | endif
|
---|
809 | elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
|
---|
810 | if _va == 'enabled'
|
---|
811 | error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
|
---|
812 | else
|
---|
813 | _va = 'disabled'
|
---|
814 | endif
|
---|
815 | endif
|
---|
816 | with_gallium_va = false
|
---|
817 | dep_va = null_dep
|
---|
818 | if _va != 'disabled'
|
---|
819 | dep_va = dependency('libva', version : '>= 1.8.0', required : _va == 'enabled')
|
---|
820 | if dep_va.found()
|
---|
821 | dep_va_headers = dep_va.partial_dependency(compile_args : true)
|
---|
822 | with_gallium_va = true
|
---|
823 | if cc.has_header_symbol('va/va.h', 'VASurfaceAttribDRMFormatModifiers',
|
---|
824 | dependencies: dep_va_headers)
|
---|
825 | pre_args += '-DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS'
|
---|
826 | endif
|
---|
827 | endif
|
---|
828 | endif
|
---|
829 |
|
---|
830 | va_drivers_path = get_option('va-libs-path')
|
---|
831 | if va_drivers_path == ''
|
---|
832 | va_drivers_path = join_paths(get_option('libdir'), 'dri')
|
---|
833 | endif
|
---|
834 |
|
---|
835 | _xa = get_option('gallium-xa')
|
---|
836 | if _xa == 'true'
|
---|
837 | _xa = 'enabled'
|
---|
838 | warning('gallium-xa option "true" deprecated, please use "enabled" instead.')
|
---|
839 | elif _xa == 'false'
|
---|
840 | _xa = 'disabled'
|
---|
841 | warning('gallium-xa option "false" deprecated, please use "disabled" instead.')
|
---|
842 | endif
|
---|
843 | if not system_has_kms_drm
|
---|
844 | if _xa == 'enabled'
|
---|
845 | error('XA state tracker can only be built on unix-like OSes.')
|
---|
846 | else
|
---|
847 | _xa = 'disabled'
|
---|
848 | endif
|
---|
849 | elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915
|
---|
850 | or with_gallium_svga)
|
---|
851 | if _xa == 'enabled'
|
---|
852 | error('XA state tracker requires at least one of the following gallium drivers: nouveau, freedreno, i915, svga.')
|
---|
853 | else
|
---|
854 | _xa = 'disabled'
|
---|
855 | endif
|
---|
856 | endif
|
---|
857 | with_gallium_xa = _xa != 'disabled'
|
---|
858 |
|
---|
859 | d3d_drivers_path = get_option('d3d-drivers-path')
|
---|
860 | if d3d_drivers_path == ''
|
---|
861 | d3d_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'd3d')
|
---|
862 | endif
|
---|
863 |
|
---|
864 | with_gallium_st_nine = get_option('gallium-nine')
|
---|
865 | if with_gallium_st_nine
|
---|
866 | if not with_gallium_softpipe
|
---|
867 | error('The nine state tracker requires gallium softpipe/llvmpipe.')
|
---|
868 | elif not (with_gallium_radeonsi or with_gallium_nouveau or with_gallium_r600
|
---|
869 | or with_gallium_r300 or with_gallium_svga or with_gallium_i915
|
---|
870 | or with_gallium_iris or with_gallium_crocus or with_gallium_zink)
|
---|
871 | error('The nine state tracker requires at least one non-swrast gallium driver.')
|
---|
872 | endif
|
---|
873 | if not with_dri3
|
---|
874 | error('Using nine with wine requires dri3')
|
---|
875 | endif
|
---|
876 | endif
|
---|
877 | with_gallium_st_d3d10umd = get_option('gallium-d3d10umd')
|
---|
878 | if with_gallium_st_d3d10umd
|
---|
879 | if not with_gallium_softpipe
|
---|
880 | error('The d3d10umd state tracker requires gallium softpipe/llvmpipe.')
|
---|
881 | endif
|
---|
882 | endif
|
---|
883 | _power8 = get_option('power8')
|
---|
884 | if _power8 == 'true'
|
---|
885 | _power8 = 'enabled'
|
---|
886 | warning('power8 option "true" deprecated, please use "enabled" instead.')
|
---|
887 | elif _power8 == 'false'
|
---|
888 | _power8 = 'disabled'
|
---|
889 | warning('power8 option "false" deprecated, please use "disabled" instead.')
|
---|
890 | endif
|
---|
891 | if _power8 != 'disabled'
|
---|
892 | # on old versions of meson the cpu family would return as ppc64le on little
|
---|
893 | # endian power8, this was changed in 0.48 such that the family would always
|
---|
894 | # be ppc64 regardless of endianness, and then the machine.endian() value
|
---|
895 | # should be checked. Since we support versions < 0.48 we need to use
|
---|
896 | # startswith.
|
---|
897 | if host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
|
---|
898 | if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8')
|
---|
899 | error('Altivec is not supported with gcc version < 4.8.')
|
---|
900 | endif
|
---|
901 | if cc.compiles('''
|
---|
902 | #include <altivec.h>
|
---|
903 | int main() {
|
---|
904 | vector unsigned char r;
|
---|
905 | vector unsigned int v = vec_splat_u32 (1);
|
---|
906 | r = __builtin_vec_vgbbd ((vector unsigned char) v);
|
---|
907 | return 0;
|
---|
908 | }''',
|
---|
909 | args : '-mpower8-vector',
|
---|
910 | name : 'POWER8 intrinsics')
|
---|
911 | pre_args += ['-D_ARCH_PWR8', '-mpower8-vector']
|
---|
912 | elif get_option('power8') == 'enabled'
|
---|
913 | error('POWER8 intrinsic support required but not found.')
|
---|
914 | endif
|
---|
915 | endif
|
---|
916 | endif
|
---|
917 |
|
---|
918 | if get_option('vmware-mks-stats')
|
---|
919 | if not with_gallium_svga
|
---|
920 | error('vmware-mks-stats requires gallium VMware/svga driver.')
|
---|
921 | endif
|
---|
922 | pre_args += '-DVMX86_STATS=1'
|
---|
923 | endif
|
---|
924 |
|
---|
925 | _opencl = get_option('gallium-opencl')
|
---|
926 | if _opencl != 'disabled'
|
---|
927 | if not with_gallium
|
---|
928 | error('OpenCL Clover implementation requires at least one gallium driver.')
|
---|
929 | endif
|
---|
930 |
|
---|
931 | with_libclc = true
|
---|
932 | with_gallium_opencl = true
|
---|
933 | with_opencl_icd = _opencl == 'icd'
|
---|
934 | else
|
---|
935 | with_gallium_opencl = false
|
---|
936 | with_opencl_icd = false
|
---|
937 | endif
|
---|
938 |
|
---|
939 | dep_clc = null_dep
|
---|
940 | if with_libclc
|
---|
941 | dep_clc = dependency('libclc')
|
---|
942 | endif
|
---|
943 |
|
---|
944 | gl_pkgconfig_c_flags = []
|
---|
945 | if with_platform_x11
|
---|
946 | if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
|
---|
947 | pre_args += '-DHAVE_X11_PLATFORM'
|
---|
948 | pre_args += '-DHAVE_XCB_PLATFORM'
|
---|
949 | endif
|
---|
950 | if with_glx == 'xlib' or with_glx == 'gallium-xlib'
|
---|
951 | pre_args += '-DUSE_XSHM'
|
---|
952 | else
|
---|
953 | pre_args += '-DGLX_INDIRECT_RENDERING'
|
---|
954 | if with_glx_direct
|
---|
955 | pre_args += '-DGLX_DIRECT_RENDERING'
|
---|
956 | endif
|
---|
957 | if with_dri_platform == 'drm'
|
---|
958 | pre_args += '-DGLX_USE_DRM'
|
---|
959 | elif with_dri_platform == 'apple'
|
---|
960 | pre_args += '-DGLX_USE_APPLEGL'
|
---|
961 | elif with_dri_platform == 'windows'
|
---|
962 | pre_args += '-DGLX_USE_WINDOWSGL'
|
---|
963 | endif
|
---|
964 | endif
|
---|
965 | else
|
---|
966 | pre_args += '-DEGL_NO_X11'
|
---|
967 | gl_pkgconfig_c_flags += '-DEGL_NO_X11'
|
---|
968 | endif
|
---|
969 | if with_gbm and not with_platform_android
|
---|
970 | pre_args += '-DHAVE_DRM_PLATFORM'
|
---|
971 | endif
|
---|
972 | if with_platform_windows
|
---|
973 | pre_args += '-DHAVE_WINDOWS_PLATFORM'
|
---|
974 | endif
|
---|
975 |
|
---|
976 | with_android_stub = get_option('android-stub')
|
---|
977 | if with_android_stub and not with_platform_android
|
---|
978 | error('`-D android-stub=true` makes no sense without `-D platforms=android`')
|
---|
979 | endif
|
---|
980 |
|
---|
981 | if with_platform_android
|
---|
982 | dep_android_mapper4 = null_dep
|
---|
983 | if not with_android_stub
|
---|
984 | dep_android = [
|
---|
985 | dependency('cutils'),
|
---|
986 | dependency('hardware'),
|
---|
987 | dependency('sync'),
|
---|
988 | dependency('backtrace')
|
---|
989 | ]
|
---|
990 | if get_option('platform-sdk-version') >= 26
|
---|
991 | dep_android += dependency('nativewindow')
|
---|
992 | endif
|
---|
993 | if get_option('platform-sdk-version') >= 30
|
---|
994 | dep_android_mapper4 = dependency('android.hardware.graphics.mapper', version : '>= 4.0', required : false)
|
---|
995 | endif
|
---|
996 | endif
|
---|
997 | pre_args += [
|
---|
998 | '-DHAVE_ANDROID_PLATFORM',
|
---|
999 | '-DANDROID',
|
---|
1000 | '-DANDROID_API_LEVEL=' + get_option('platform-sdk-version').to_string()
|
---|
1001 | ]
|
---|
1002 | endif
|
---|
1003 | if with_platform_haiku
|
---|
1004 | pre_args += '-DHAVE_HAIKU_PLATFORM'
|
---|
1005 | endif
|
---|
1006 |
|
---|
1007 | prog_python = import('python').find_installation('python3')
|
---|
1008 | has_mako = run_command(
|
---|
1009 | prog_python, '-c',
|
---|
1010 | '''
|
---|
1011 | from distutils.version import StrictVersion
|
---|
1012 | import mako
|
---|
1013 | assert StrictVersion(mako.__version__) > StrictVersion("0.8.0")
|
---|
1014 | ''')
|
---|
1015 | if has_mako.returncode() != 0
|
---|
1016 | error('Python (3.x) mako module >= 0.8.0 required to build mesa.')
|
---|
1017 | endif
|
---|
1018 |
|
---|
1019 | if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
|
---|
1020 | error('When using GCC, version 4.4.6 or later is required.')
|
---|
1021 | endif
|
---|
1022 |
|
---|
1023 | # Support systems without ETIME (e.g. FreeBSD)
|
---|
1024 | if cc.get_define('ETIME', prefix : '#include <errno.h>') == ''
|
---|
1025 | pre_args += '-DETIME=ETIMEDOUT'
|
---|
1026 | endif
|
---|
1027 |
|
---|
1028 | # Define DEBUG for debug builds only (debugoptimized is not included on this one)
|
---|
1029 | if get_option('buildtype') == 'debug'
|
---|
1030 | pre_args += '-DDEBUG'
|
---|
1031 | endif
|
---|
1032 |
|
---|
1033 | with_shader_cache = false
|
---|
1034 | _shader_cache = get_option('shader-cache')
|
---|
1035 | if _shader_cache == 'true'
|
---|
1036 | _shader_cache = 'enabled'
|
---|
1037 | warning('shader_cache option "true" deprecated, please use "enabled" instead.')
|
---|
1038 | elif _shader_cache == 'false'
|
---|
1039 | _shader_cache = 'disabled'
|
---|
1040 | warning('shader_cache option "false" deprecated, please use "disabled" instead.')
|
---|
1041 | endif
|
---|
1042 | if _shader_cache != 'disabled'
|
---|
1043 | if host_machine.system() == 'windows'
|
---|
1044 | if _shader_cache == 'enabled'
|
---|
1045 | error('Shader Cache does not currently work on Windows')
|
---|
1046 | endif
|
---|
1047 | else
|
---|
1048 | pre_args += '-DENABLE_SHADER_CACHE'
|
---|
1049 | if not get_option('shader-cache-default')
|
---|
1050 | pre_args += '-DSHADER_CACHE_DISABLE_BY_DEFAULT'
|
---|
1051 | endif
|
---|
1052 | with_shader_cache = true
|
---|
1053 | endif
|
---|
1054 | endif
|
---|
1055 |
|
---|
1056 | if with_shader_cache
|
---|
1057 | shader_cache_max_size = get_option('shader-cache-max-size')
|
---|
1058 | if shader_cache_max_size != ''
|
---|
1059 | pre_args += '-DMESA_GLSL_CACHE_MAX_SIZE="@0@"'.format(shader_cache_max_size)
|
---|
1060 | endif
|
---|
1061 | endif
|
---|
1062 |
|
---|
1063 | # Check for GCC style builtins
|
---|
1064 | foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
|
---|
1065 | 'ffsll', 'popcount', 'popcountll', 'unreachable', 'types_compatible_p']
|
---|
1066 | if cc.has_function(b)
|
---|
1067 | pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
|
---|
1068 | endif
|
---|
1069 | endforeach
|
---|
1070 |
|
---|
1071 | # check for GCC __attribute__
|
---|
1072 | _attributes = [
|
---|
1073 | 'const', 'flatten', 'malloc', 'pure', 'unused', 'warn_unused_result',
|
---|
1074 | 'weak', 'format', 'packed', 'returns_nonnull', 'alias', 'noreturn',
|
---|
1075 | ]
|
---|
1076 | foreach a : cc.get_supported_function_attributes(_attributes)
|
---|
1077 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
|
---|
1078 | endforeach
|
---|
1079 | if cc.has_function_attribute('visibility:hidden')
|
---|
1080 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY'
|
---|
1081 | endif
|
---|
1082 | if cc.compiles('__uint128_t foo(void) { return 0; }',
|
---|
1083 | name : '__uint128_t')
|
---|
1084 | pre_args += '-DHAVE_UINT128'
|
---|
1085 | endif
|
---|
1086 |
|
---|
1087 | # TODO: this is very incomplete
|
---|
1088 | if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku'].contains(host_machine.system())
|
---|
1089 | pre_args += '-D_GNU_SOURCE'
|
---|
1090 | elif host_machine.system() == 'sunos'
|
---|
1091 | pre_args += '-D__EXTENSIONS__'
|
---|
1092 | elif host_machine.system() == 'windows'
|
---|
1093 | pre_args += [
|
---|
1094 | '-D_WINDOWS', '-D_WIN32_WINNT=0x0A00', '-DWINVER=0x0A00',
|
---|
1095 | '-DPIPE_SUBSYSTEM_WINDOWS_USER',
|
---|
1096 | '-D_USE_MATH_DEFINES', # XXX: scons didn't use this for mingw
|
---|
1097 | ]
|
---|
1098 | if cc.get_id() == 'msvc'
|
---|
1099 | pre_args += [
|
---|
1100 | '-DVC_EXTRALEAN',
|
---|
1101 | '-D_CRT_SECURE_NO_WARNINGS',
|
---|
1102 | '-D_CRT_SECURE_NO_DEPRECATE',
|
---|
1103 | '-D_SCL_SECURE_NO_WARNINGS',
|
---|
1104 | '-D_SCL_SECURE_NO_DEPRECATE',
|
---|
1105 | '-D_ALLOW_KEYWORD_MACROS',
|
---|
1106 | '-D_HAS_EXCEPTIONS=0', # Tell C++ STL to not use exceptions
|
---|
1107 | '-DNOMINMAX',
|
---|
1108 | ]
|
---|
1109 | else
|
---|
1110 | pre_args += ['-D__MSVCRT_VERSION__=0x0700']
|
---|
1111 | endif
|
---|
1112 | elif host_machine.system() == 'openbsd'
|
---|
1113 | pre_args += '-D_ISOC11_SOURCE'
|
---|
1114 | endif
|
---|
1115 |
|
---|
1116 | # Check for generic C arguments
|
---|
1117 | c_msvc_compat_args = []
|
---|
1118 | no_override_init_args = []
|
---|
1119 | cpp_msvc_compat_args = []
|
---|
1120 | if cc.get_id() == 'msvc'
|
---|
1121 | foreach a : ['/wd4018', # signed/unsigned mismatch
|
---|
1122 | '/wd4056', # overflow in floating-point constant arithmetic
|
---|
1123 | '/wd4244', # conversion from 'type1' to 'type2', possible loss of data
|
---|
1124 | '/wd4267', # 'var' : conversion from 'size_t' to 'type', possible loss of data
|
---|
1125 | '/wd4305', # trancation from 'type1' to 'type2'
|
---|
1126 | '/wd4351', # new behavior: elements of array 'array' will be default initialized
|
---|
1127 | '/wd4756', # overflow in constant arithmetic
|
---|
1128 | '/wd4800', # forcing value to bool 'true' or 'false' (performance warning)
|
---|
1129 | '/wd4996', # disabled deprecated POSIX name warnings
|
---|
1130 | '/wd4291', # no matching operator delete found
|
---|
1131 | '/wd4146', # unary minus operator applied to unsigned type, result still unsigned
|
---|
1132 | '/wd4200', # nonstandard extension used: zero-sized array in struct/union
|
---|
1133 | '/wd4624', # destructor was implicitly defined as deleted [from LLVM]
|
---|
1134 | '/wd4309', # 'initializing': truncation of constant value
|
---|
1135 | '/wd4838', # conversion from 'int' to 'const char' requires a narrowing conversion
|
---|
1136 | '/wd5105', # macro expansion producing 'defined' has undefined behavior (winbase.h, need Windows SDK upgrade)
|
---|
1137 | '/we4020', # Error when passing the wrong number of parameters
|
---|
1138 | '/we4024', # Error when passing different type of parameter
|
---|
1139 | '/Zc:__cplusplus', #Set __cplusplus macro to match the /std:c++<version> on the command line
|
---|
1140 | ]
|
---|
1141 | if cc.has_argument(a)
|
---|
1142 | c_args += a
|
---|
1143 | endif
|
---|
1144 | if cpp.has_argument(a)
|
---|
1145 | cpp_args += a
|
---|
1146 | endif
|
---|
1147 | endforeach
|
---|
1148 | else
|
---|
1149 | _trial = [
|
---|
1150 | '-Werror=implicit-function-declaration',
|
---|
1151 | '-Werror=missing-prototypes',
|
---|
1152 | '-Werror=return-type',
|
---|
1153 | '-Werror=empty-body',
|
---|
1154 | '-Werror=incompatible-pointer-types',
|
---|
1155 | '-Werror=int-conversion',
|
---|
1156 | '-Wimplicit-fallthrough',
|
---|
1157 | '-Wno-missing-field-initializers',
|
---|
1158 | '-Wno-format-truncation',
|
---|
1159 | '-fno-math-errno',
|
---|
1160 | '-fno-trapping-math',
|
---|
1161 | '-Qunused-arguments',
|
---|
1162 | '-fno-common',
|
---|
1163 | ]
|
---|
1164 | # MinGW chokes on format specifiers and I can't get it all working
|
---|
1165 | if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
|
---|
1166 | _trial += ['-Werror=format', '-Wformat-security']
|
---|
1167 | endif
|
---|
1168 | # FreeBSD annotated <pthread.h> but Mesa isn't ready
|
---|
1169 | if not (cc.get_id() == 'clang' and host_machine.system() == 'freebsd')
|
---|
1170 | _trial += ['-Werror=thread-safety']
|
---|
1171 | endif
|
---|
1172 | foreach a : _trial
|
---|
1173 | if cc.has_argument(a)
|
---|
1174 | c_args += a
|
---|
1175 | endif
|
---|
1176 | endforeach
|
---|
1177 |
|
---|
1178 | _trial = [
|
---|
1179 | '-Werror=return-type',
|
---|
1180 | '-Werror=empty-body',
|
---|
1181 | '-Wno-non-virtual-dtor',
|
---|
1182 | '-Wno-missing-field-initializers',
|
---|
1183 | '-Wno-format-truncation',
|
---|
1184 | '-fno-math-errno',
|
---|
1185 | '-fno-trapping-math',
|
---|
1186 | '-Qunused-arguments',
|
---|
1187 | # Some classes use custom new operator which zeroes memory, however
|
---|
1188 | # gcc does aggressive dead-store elimination which threats all writes
|
---|
1189 | # to the memory before the constructor as "dead stores".
|
---|
1190 | # For now we disable this optimization.
|
---|
1191 | '-flifetime-dse=1',
|
---|
1192 | ]
|
---|
1193 | # MinGW chokes on format specifiers and I can't get it all working
|
---|
1194 | if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
|
---|
1195 | _trial += ['-Werror=format', '-Wformat-security']
|
---|
1196 | endif
|
---|
1197 | foreach a : _trial
|
---|
1198 | if cpp.has_argument(a)
|
---|
1199 | cpp_args += a
|
---|
1200 | endif
|
---|
1201 | endforeach
|
---|
1202 |
|
---|
1203 | foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
|
---|
1204 | if cc.has_argument(a)
|
---|
1205 | no_override_init_args += a
|
---|
1206 | endif
|
---|
1207 | endforeach
|
---|
1208 |
|
---|
1209 | # Check for C and C++ arguments for MSVC compatibility. These are only used
|
---|
1210 | # in parts of the mesa code base that need to compile with MSVC, mainly
|
---|
1211 | # common code
|
---|
1212 | foreach a : ['-Werror=pointer-arith', '-Werror=gnu-empty-initializer']
|
---|
1213 | if cc.has_argument(a)
|
---|
1214 | c_msvc_compat_args += a
|
---|
1215 | endif
|
---|
1216 | if cpp.has_argument(a)
|
---|
1217 | cpp_msvc_compat_args += a
|
---|
1218 | endif
|
---|
1219 | endforeach
|
---|
1220 |
|
---|
1221 | if cc.has_argument('-Wmicrosoft-enum-value') # Clang
|
---|
1222 | c_args += '-Wno-microsoft-enum-value'
|
---|
1223 | cpp_args += '-Wno-microsoft-enum-value'
|
---|
1224 | endif
|
---|
1225 | endif
|
---|
1226 |
|
---|
1227 | # set linker arguments
|
---|
1228 | if host_machine.system() == 'windows'
|
---|
1229 | if cc.get_id() == 'msvc'
|
---|
1230 | add_project_link_arguments(
|
---|
1231 | '/fixed:no',
|
---|
1232 | '/dynamicbase',
|
---|
1233 | '/nxcompat',
|
---|
1234 | language : ['c', 'cpp'],
|
---|
1235 | )
|
---|
1236 | if get_option('buildtype') != 'debug'
|
---|
1237 | add_project_link_arguments(
|
---|
1238 | '/incremental:no',
|
---|
1239 | language : ['c', 'cpp'],
|
---|
1240 | )
|
---|
1241 | endif
|
---|
1242 | else
|
---|
1243 | add_project_link_arguments(
|
---|
1244 | cc.get_supported_link_arguments(
|
---|
1245 | '-Wl,--nxcompat',
|
---|
1246 | '-Wl,--dynamicbase',
|
---|
1247 | '-static-libgcc',
|
---|
1248 | '-static-libstdc++',
|
---|
1249 | ),
|
---|
1250 | language : ['c'],
|
---|
1251 | )
|
---|
1252 | add_project_link_arguments(
|
---|
1253 | cpp.get_supported_link_arguments(
|
---|
1254 | '-Wl,--nxcompat',
|
---|
1255 | '-Wl,--dynamicbase',
|
---|
1256 | '-static-libgcc',
|
---|
1257 | '-static-libstdc++',
|
---|
1258 | ),
|
---|
1259 | language : ['cpp'],
|
---|
1260 | )
|
---|
1261 | endif
|
---|
1262 | endif
|
---|
1263 |
|
---|
1264 | if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
|
---|
1265 | pre_args += '-DUSE_SSE41'
|
---|
1266 | with_sse41 = true
|
---|
1267 | sse41_args = ['-msse4.1']
|
---|
1268 |
|
---|
1269 | if host_machine.cpu_family() == 'x86'
|
---|
1270 | if get_option('sse2')
|
---|
1271 | # These settings make generated GCC code match MSVC and follow
|
---|
1272 | # GCC advice on https://gcc.gnu.org/wiki/FloatingPointMath#x86note
|
---|
1273 | #
|
---|
1274 | # NOTE: We need to ensure stack is realigned given that we
|
---|
1275 | # produce shared objects, and have no control over the stack
|
---|
1276 | # alignment policy of the application. Therefore we need
|
---|
1277 | # -mstackrealign or -mincoming-stack-boundary=2.
|
---|
1278 | #
|
---|
1279 | # XXX: We could have SSE without -mstackrealign if we always used
|
---|
1280 | # __attribute__((force_align_arg_pointer)), but that's not
|
---|
1281 | # always the case.
|
---|
1282 | c_args += ['-msse2', '-mfpmath=sse', '-mstackrealign']
|
---|
1283 | else
|
---|
1284 | # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
|
---|
1285 | # that's not guaranteed
|
---|
1286 | sse41_args += '-mstackrealign'
|
---|
1287 | endif
|
---|
1288 | endif
|
---|
1289 | else
|
---|
1290 | with_sse41 = false
|
---|
1291 | sse41_args = []
|
---|
1292 | endif
|
---|
1293 |
|
---|
1294 | # Check for GCC style atomics
|
---|
1295 | dep_atomic = null_dep
|
---|
1296 |
|
---|
1297 | if cc.compiles('''#include <stdint.h>
|
---|
1298 | int main() {
|
---|
1299 | struct {
|
---|
1300 | uint64_t *v;
|
---|
1301 | } x;
|
---|
1302 | return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
|
---|
1303 | (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
|
---|
1304 |
|
---|
1305 | }''',
|
---|
1306 | name : 'GCC atomic builtins')
|
---|
1307 | pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
|
---|
1308 |
|
---|
1309 | # Not all atomic calls can be turned into lock-free instructions, in which
|
---|
1310 | # GCC will make calls into the libatomic library. Check whether we need to
|
---|
1311 | # link with -latomic.
|
---|
1312 | #
|
---|
1313 | # This can happen for 64-bit atomic operations on 32-bit architectures such
|
---|
1314 | # as ARM.
|
---|
1315 | if not cc.links('''#include <stdint.h>
|
---|
1316 | int main() {
|
---|
1317 | struct {
|
---|
1318 | uint64_t *v;
|
---|
1319 | } x;
|
---|
1320 | return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
|
---|
1321 | (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
|
---|
1322 | }''',
|
---|
1323 | name : 'GCC atomic builtins required -latomic')
|
---|
1324 | dep_atomic = cc.find_library('atomic')
|
---|
1325 | endif
|
---|
1326 | endif
|
---|
1327 | if not cc.links('''#include <stdint.h>
|
---|
1328 | uint64_t v;
|
---|
1329 | int main() {
|
---|
1330 | return __sync_add_and_fetch(&v, (uint64_t)1);
|
---|
1331 | }''',
|
---|
1332 | dependencies : dep_atomic,
|
---|
1333 | name : 'GCC 64bit atomics')
|
---|
1334 | pre_args += '-DMISSING_64BIT_ATOMICS'
|
---|
1335 | endif
|
---|
1336 |
|
---|
1337 | dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows)
|
---|
1338 |
|
---|
1339 | # TODO: shared/static? Is this even worth doing?
|
---|
1340 |
|
---|
1341 | with_asm_arch = ''
|
---|
1342 | if host_machine.cpu_family() == 'x86'
|
---|
1343 | if system_has_kms_drm or host_machine.system() == 'gnu'
|
---|
1344 | with_asm_arch = 'x86'
|
---|
1345 | pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
|
---|
1346 | '-DUSE_SSE_ASM']
|
---|
1347 |
|
---|
1348 | if with_glx_read_only_text
|
---|
1349 | pre_args += ['-DGLX_X86_READONLY_TEXT']
|
---|
1350 | endif
|
---|
1351 | endif
|
---|
1352 | elif host_machine.cpu_family() == 'x86_64'
|
---|
1353 | if system_has_kms_drm
|
---|
1354 | with_asm_arch = 'x86_64'
|
---|
1355 | pre_args += ['-DUSE_X86_64_ASM']
|
---|
1356 | endif
|
---|
1357 | elif host_machine.cpu_family() == 'arm'
|
---|
1358 | if system_has_kms_drm
|
---|
1359 | with_asm_arch = 'arm'
|
---|
1360 | pre_args += ['-DUSE_ARM_ASM']
|
---|
1361 | endif
|
---|
1362 | elif host_machine.cpu_family() == 'aarch64'
|
---|
1363 | if system_has_kms_drm
|
---|
1364 | with_asm_arch = 'aarch64'
|
---|
1365 | pre_args += ['-DUSE_AARCH64_ASM']
|
---|
1366 | endif
|
---|
1367 | elif host_machine.cpu_family() == 'sparc64'
|
---|
1368 | if system_has_kms_drm
|
---|
1369 | with_asm_arch = 'sparc'
|
---|
1370 | pre_args += ['-DUSE_SPARC_ASM']
|
---|
1371 | endif
|
---|
1372 | elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
|
---|
1373 | if system_has_kms_drm
|
---|
1374 | with_asm_arch = 'ppc64le'
|
---|
1375 | pre_args += ['-DUSE_PPC64LE_ASM']
|
---|
1376 | endif
|
---|
1377 | elif host_machine.cpu_family() == 'mips64' and host_machine.endian() == 'little'
|
---|
1378 | if system_has_kms_drm
|
---|
1379 | with_asm_arch = 'mips64el'
|
---|
1380 | pre_args += ['-DUSE_MIPS64EL_ASM']
|
---|
1381 | endif
|
---|
1382 | endif
|
---|
1383 |
|
---|
1384 | # Check for standard headers and functions
|
---|
1385 | if (cc.has_header_symbol('sys/sysmacros.h', 'major') and
|
---|
1386 | cc.has_header_symbol('sys/sysmacros.h', 'minor') and
|
---|
1387 | cc.has_header_symbol('sys/sysmacros.h', 'makedev'))
|
---|
1388 | pre_args += '-DMAJOR_IN_SYSMACROS'
|
---|
1389 | endif
|
---|
1390 | if (cc.has_header_symbol('sys/mkdev.h', 'major') and
|
---|
1391 | cc.has_header_symbol('sys/mkdev.h', 'minor') and
|
---|
1392 | cc.has_header_symbol('sys/mkdev.h', 'makedev'))
|
---|
1393 | pre_args += '-DMAJOR_IN_MKDEV'
|
---|
1394 | endif
|
---|
1395 |
|
---|
1396 | if cc.check_header('sched.h')
|
---|
1397 | pre_args += '-DHAS_SCHED_H'
|
---|
1398 | if cc.has_function('sched_getaffinity')
|
---|
1399 | pre_args += '-DHAS_SCHED_GETAFFINITY'
|
---|
1400 | endif
|
---|
1401 | endif
|
---|
1402 |
|
---|
1403 | if not ['linux'].contains(host_machine.system())
|
---|
1404 | # Deprecated on Linux and requires <sys/types.h> on FreeBSD and OpenBSD
|
---|
1405 | if cc.check_header('sys/sysctl.h', prefix : '#include <sys/types.h>')
|
---|
1406 | pre_args += '-DHAVE_SYS_SYSCTL_H'
|
---|
1407 | endif
|
---|
1408 | endif
|
---|
1409 |
|
---|
1410 | foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h', 'cet.h', 'pthread_np.h']
|
---|
1411 | if cc.check_header(h)
|
---|
1412 | pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
|
---|
1413 | endif
|
---|
1414 | endforeach
|
---|
1415 |
|
---|
1416 | foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r',
|
---|
1417 | 'flock', 'strtok_r', 'getrandom', 'qsort_r', 'qsort_s']
|
---|
1418 | if cc.has_function(f)
|
---|
1419 | pre_args += '-DHAVE_@0@'.format(f.to_upper())
|
---|
1420 | endif
|
---|
1421 | endforeach
|
---|
1422 |
|
---|
1423 | if cc.has_header_symbol('errno.h', 'program_invocation_name',
|
---|
1424 | args : '-D_GNU_SOURCE')
|
---|
1425 | pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME'
|
---|
1426 | elif with_tools.contains('intel')
|
---|
1427 | error('Intel tools require the program_invocation_name variable')
|
---|
1428 | endif
|
---|
1429 |
|
---|
1430 | # MinGW provides a __builtin_posix_memalign function, but not a posix_memalign.
|
---|
1431 | # This means that this check will succeed, but then compilation will later
|
---|
1432 | # fail. MSVC doesn't have this function at all, so only check for it on
|
---|
1433 | # non-windows platforms.
|
---|
1434 | if host_machine.system() != 'windows'
|
---|
1435 | if cc.has_function('posix_memalign')
|
---|
1436 | pre_args += '-DHAVE_POSIX_MEMALIGN'
|
---|
1437 | endif
|
---|
1438 | endif
|
---|
1439 |
|
---|
1440 | if cc.has_member('struct dirent', 'd_type', prefix: '''#include <sys/types.h>
|
---|
1441 | #include <dirent.h>''')
|
---|
1442 | pre_args += '-DHAVE_DIRENT_D_TYPE'
|
---|
1443 | endif
|
---|
1444 |
|
---|
1445 | # strtod locale support
|
---|
1446 | if cc.links('''
|
---|
1447 | #define _GNU_SOURCE
|
---|
1448 | #include <stdlib.h>
|
---|
1449 | #include <locale.h>
|
---|
1450 | #ifdef HAVE_XLOCALE_H
|
---|
1451 | #include <xlocale.h>
|
---|
1452 | #endif
|
---|
1453 | int main() {
|
---|
1454 | locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
|
---|
1455 | const char *s = "1.0";
|
---|
1456 | char *end;
|
---|
1457 | double d = strtod_l(s, end, loc);
|
---|
1458 | float f = strtof_l(s, end, loc);
|
---|
1459 | freelocale(loc);
|
---|
1460 | return 0;
|
---|
1461 | }''',
|
---|
1462 | args : pre_args,
|
---|
1463 | name : 'strtod has locale support')
|
---|
1464 | pre_args += '-DHAVE_STRTOD_L'
|
---|
1465 | endif
|
---|
1466 |
|
---|
1467 | # Check for some linker flags
|
---|
1468 | ld_args_bsymbolic = []
|
---|
1469 | if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
|
---|
1470 | ld_args_bsymbolic += '-Wl,-Bsymbolic'
|
---|
1471 | endif
|
---|
1472 | ld_args_gc_sections = []
|
---|
1473 | if cc.links('static char unused() { return 5; } int main() { return 0; }',
|
---|
1474 | args : '-Wl,--gc-sections', name : 'gc-sections')
|
---|
1475 | ld_args_gc_sections += '-Wl,--gc-sections'
|
---|
1476 | endif
|
---|
1477 | with_ld_version_script = false
|
---|
1478 | if cc.links('int main() { return 0; }',
|
---|
1479 | args : '-Wl,--version-script=@0@'.format(
|
---|
1480 | join_paths(meson.source_root(), 'build-support/conftest.map')),
|
---|
1481 | name : 'version-script')
|
---|
1482 | with_ld_version_script = true
|
---|
1483 | endif
|
---|
1484 | with_ld_dynamic_list = false
|
---|
1485 | if cc.links('int main() { return 0; }',
|
---|
1486 | args : '-Wl,--dynamic-list=@0@'.format(
|
---|
1487 | join_paths(meson.source_root(), 'build-support/conftest.dyn')),
|
---|
1488 | name : 'dynamic-list')
|
---|
1489 | with_ld_dynamic_list = true
|
---|
1490 | endif
|
---|
1491 |
|
---|
1492 | ld_args_build_id = cc.get_supported_link_arguments('-Wl,--build-id=sha1')
|
---|
1493 |
|
---|
1494 | # check for dl support
|
---|
1495 | dep_dl = null_dep
|
---|
1496 | if not cc.has_function('dlopen')
|
---|
1497 | dep_dl = cc.find_library('dl', required : host_machine.system() != 'windows')
|
---|
1498 | endif
|
---|
1499 | if cc.has_function('dladdr', dependencies : dep_dl)
|
---|
1500 | # This is really only required for megadrivers
|
---|
1501 | pre_args += '-DHAVE_DLADDR'
|
---|
1502 | endif
|
---|
1503 |
|
---|
1504 | if cc.has_function('dl_iterate_phdr')
|
---|
1505 | pre_args += '-DHAVE_DL_ITERATE_PHDR'
|
---|
1506 | elif with_intel_vk
|
---|
1507 | error('Intel "Anvil" Vulkan driver requires the dl_iterate_phdr function')
|
---|
1508 | elif with_dri_i965 and with_shader_cache
|
---|
1509 | error('Intel i965 GL driver requires dl_iterate_phdr when built with shader caching.')
|
---|
1510 | endif
|
---|
1511 |
|
---|
1512 | # Determine whether or not the rt library is needed for time functions
|
---|
1513 | if host_machine.system() == 'windows' or cc.has_function('clock_gettime')
|
---|
1514 | dep_clock = null_dep
|
---|
1515 | else
|
---|
1516 | dep_clock = cc.find_library('rt')
|
---|
1517 | endif
|
---|
1518 |
|
---|
1519 | dep_zlib = dependency('zlib', version : '>= 1.2.3',
|
---|
1520 | fallback : ['zlib', 'zlib_dep'],
|
---|
1521 | required : get_option('zlib'))
|
---|
1522 | if dep_zlib.found()
|
---|
1523 | pre_args += '-DHAVE_ZLIB'
|
---|
1524 | endif
|
---|
1525 |
|
---|
1526 | _zstd = get_option('zstd')
|
---|
1527 | if _zstd == 'true'
|
---|
1528 | _zstd = 'enabled'
|
---|
1529 | warning('zstd option "true" deprecated, please use "enabled" instead.')
|
---|
1530 | elif _zstd == 'false'
|
---|
1531 | _zstd = 'disabled'
|
---|
1532 | warning('zstd option "false" deprecated, please use "disabled" instead.')
|
---|
1533 | endif
|
---|
1534 | if _zstd != 'disabled'
|
---|
1535 | dep_zstd = dependency('libzstd', required : _zstd == 'enabled')
|
---|
1536 | if dep_zstd.found()
|
---|
1537 | pre_args += '-DHAVE_ZSTD'
|
---|
1538 | endif
|
---|
1539 | else
|
---|
1540 | dep_zstd = null_dep
|
---|
1541 | endif
|
---|
1542 |
|
---|
1543 | with_compression = dep_zlib.found() or dep_zstd.found()
|
---|
1544 | if with_compression
|
---|
1545 | pre_args += '-DHAVE_COMPRESSION'
|
---|
1546 | elif with_shader_cache
|
---|
1547 | error('Shader Cache requires compression')
|
---|
1548 | endif
|
---|
1549 |
|
---|
1550 | dep_thread = dependency('threads')
|
---|
1551 | if dep_thread.found() and host_machine.system() != 'windows'
|
---|
1552 | pre_args += '-DHAVE_PTHREAD'
|
---|
1553 | if host_machine.system() != 'netbsd' and cc.has_function(
|
---|
1554 | 'pthread_setaffinity_np',
|
---|
1555 | dependencies : dep_thread,
|
---|
1556 | prefix : '#include <pthread.h>',
|
---|
1557 | args : '-D_GNU_SOURCE')
|
---|
1558 | pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
|
---|
1559 | endif
|
---|
1560 | endif
|
---|
1561 | if host_machine.system() == 'darwin'
|
---|
1562 | dep_expat = meson.get_compiler('c').find_library('expat')
|
---|
1563 | elif host_machine.system() != 'windows'
|
---|
1564 | dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'],
|
---|
1565 | required: not with_platform_android)
|
---|
1566 | else
|
---|
1567 | dep_expat = null_dep
|
---|
1568 | endif
|
---|
1569 | # this only exists on linux so either this is linux and it will be found, or
|
---|
1570 | # it's not linux and wont
|
---|
1571 | dep_m = cc.find_library('m', required : false)
|
---|
1572 |
|
---|
1573 | if host_machine.system() == 'windows'
|
---|
1574 | dep_regex = meson.get_compiler('c').find_library('regex', required : false)
|
---|
1575 | if not dep_regex.found()
|
---|
1576 | dep_regex = declare_dependency(compile_args : ['-DNO_REGEX'])
|
---|
1577 | endif
|
---|
1578 | else
|
---|
1579 | dep_regex = null_dep
|
---|
1580 | endif
|
---|
1581 |
|
---|
1582 | if with_platform_haiku
|
---|
1583 | dep_network = cc.find_library('network')
|
---|
1584 | endif
|
---|
1585 |
|
---|
1586 | # Check for libdrm. Various drivers have different libdrm version requirements,
|
---|
1587 | # but we always want to use the same version for all libdrm modules. That means
|
---|
1588 | # even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
|
---|
1589 | # bar are both on use 2.4.3 for both of them
|
---|
1590 | dep_libdrm_amdgpu = null_dep
|
---|
1591 | dep_libdrm_radeon = null_dep
|
---|
1592 | dep_libdrm_nouveau = null_dep
|
---|
1593 | dep_libdrm_intel = null_dep
|
---|
1594 |
|
---|
1595 | _drm_amdgpu_ver = '2.4.107'
|
---|
1596 | _drm_radeon_ver = '2.4.71'
|
---|
1597 | _drm_nouveau_ver = '2.4.102'
|
---|
1598 | _drm_intel_ver = '2.4.75'
|
---|
1599 | _drm_ver = '2.4.81'
|
---|
1600 |
|
---|
1601 | _libdrm_checks = [
|
---|
1602 | ['intel', with_dri_i915 or with_gallium_i915],
|
---|
1603 | ['amdgpu', (with_amd_vk and not with_platform_windows) or with_gallium_radeonsi],
|
---|
1604 | ['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
|
---|
1605 | with_gallium_r300 or with_gallium_r600)],
|
---|
1606 | ['nouveau', (with_gallium_nouveau or with_dri_nouveau)],
|
---|
1607 | ]
|
---|
1608 |
|
---|
1609 | # VC4 only needs core libdrm support of this version, not a libdrm_vc4
|
---|
1610 | # library.
|
---|
1611 | if with_gallium_vc4
|
---|
1612 | _drm_ver = '2.4.89'
|
---|
1613 | endif
|
---|
1614 |
|
---|
1615 | # etnaviv only needs core libdrm
|
---|
1616 | if with_gallium_etnaviv
|
---|
1617 | _drm_ver = '2.4.89'
|
---|
1618 | endif
|
---|
1619 |
|
---|
1620 | # Loop over the enables versions and get the highest libdrm requirement for all
|
---|
1621 | # active drivers.
|
---|
1622 | _drm_blame = ''
|
---|
1623 | foreach d : _libdrm_checks
|
---|
1624 | ver = get_variable('_drm_@0@_ver'.format(d[0]))
|
---|
1625 | if d[1] and ver.version_compare('>' + _drm_ver)
|
---|
1626 | _drm_ver = ver
|
---|
1627 | _drm_blame = d[0]
|
---|
1628 | endif
|
---|
1629 | endforeach
|
---|
1630 | if _drm_blame != ''
|
---|
1631 | message('libdrm @0@ needed because @1@ has the highest requirement'.format(_drm_ver, _drm_blame))
|
---|
1632 | endif
|
---|
1633 |
|
---|
1634 | # Then get each libdrm module
|
---|
1635 | foreach d : _libdrm_checks
|
---|
1636 | if d[1]
|
---|
1637 | set_variable(
|
---|
1638 | 'dep_libdrm_' + d[0],
|
---|
1639 | dependency('libdrm_' + d[0], version : '>=' + _drm_ver)
|
---|
1640 | )
|
---|
1641 | endif
|
---|
1642 | endforeach
|
---|
1643 |
|
---|
1644 | with_gallium_drisw_kms = false
|
---|
1645 | dep_libdrm = dependency(
|
---|
1646 | 'libdrm', version : '>=' + _drm_ver,
|
---|
1647 | # GNU/Hurd includes egl_dri2, without drm.
|
---|
1648 | required : (with_dri2 and host_machine.system() != 'gnu') or with_dri3
|
---|
1649 | )
|
---|
1650 | if dep_libdrm.found()
|
---|
1651 | pre_args += '-DHAVE_LIBDRM'
|
---|
1652 | if with_dri_platform == 'drm' and with_dri
|
---|
1653 | with_gallium_drisw_kms = true
|
---|
1654 | endif
|
---|
1655 | endif
|
---|
1656 |
|
---|
1657 | llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine']
|
---|
1658 | llvm_optional_modules = ['coroutines']
|
---|
1659 | if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
|
---|
1660 | llvm_modules += ['amdgpu', 'native', 'bitreader', 'ipo']
|
---|
1661 | if with_gallium_r600
|
---|
1662 | llvm_modules += 'asmparser'
|
---|
1663 | endif
|
---|
1664 | endif
|
---|
1665 | if with_gallium_opencl
|
---|
1666 | llvm_modules += [
|
---|
1667 | 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
|
---|
1668 | 'lto', 'option', 'objcarcopts', 'profiledata'
|
---|
1669 | ]
|
---|
1670 | llvm_optional_modules += ['frontendopenmp']
|
---|
1671 | endif
|
---|
1672 | if with_clc
|
---|
1673 | llvm_modules += ['coverage', 'target', 'linker', 'irreader', 'option', 'libdriver', 'lto']
|
---|
1674 | endif
|
---|
1675 | if with_tests or with_gallium_softpipe
|
---|
1676 | llvm_modules += 'native'
|
---|
1677 | endif
|
---|
1678 |
|
---|
1679 | if with_amd_vk or with_gallium_radeonsi
|
---|
1680 | _llvm_version = '>= 11.0.0'
|
---|
1681 | elif with_clc
|
---|
1682 | _llvm_version = '>= 10.0.0'
|
---|
1683 | elif with_gallium_opencl
|
---|
1684 | _llvm_version = '>= 8.0.0'
|
---|
1685 | elif with_gallium_swr
|
---|
1686 | _llvm_version = '>= 6.0.0'
|
---|
1687 | else
|
---|
1688 | _llvm_version = '>= 3.9.0'
|
---|
1689 | endif
|
---|
1690 |
|
---|
1691 | _shared_llvm = get_option('shared-llvm')
|
---|
1692 | if _shared_llvm == 'true'
|
---|
1693 | _shared_llvm = 'enabled'
|
---|
1694 | warning('shared_llvm option "true" deprecated, please use "enabled" instead.')
|
---|
1695 | elif _shared_llvm == 'false'
|
---|
1696 | _shared_llvm = 'disabled'
|
---|
1697 | warning('shared_llvm option "false" deprecated, please use "disabled" instead.')
|
---|
1698 | endif
|
---|
1699 | if _shared_llvm == 'auto'
|
---|
1700 | _shared_llvm = (host_machine.system() != 'windows')
|
---|
1701 | else
|
---|
1702 | _shared_llvm = (_shared_llvm == 'enabled')
|
---|
1703 | endif
|
---|
1704 | _llvm = get_option('llvm')
|
---|
1705 | if _llvm == 'true'
|
---|
1706 | _llvm = 'enabled'
|
---|
1707 | warning('llvm option "true" deprecated, please use "enabled" instead.')
|
---|
1708 | elif _llvm == 'false'
|
---|
1709 | _llvm = 'disabled'
|
---|
1710 | warning('llvm option "false" deprecated, please use "disabled" instead.')
|
---|
1711 | endif
|
---|
1712 |
|
---|
1713 | # the cmake method can only link statically, so don't attempt to use it if we
|
---|
1714 | # want to link dynamically. Before 0.54.0 meson will try cmake even when shared
|
---|
1715 | # linking is requested, so we need to force the config-tool method to be used
|
---|
1716 | # in that case, but in 0.54.0 meson won't try the cmake method if shared
|
---|
1717 | # linking is requested.
|
---|
1718 | _llvm_method = 'auto'
|
---|
1719 | if meson.version().version_compare('< 0.54.0') and _shared_llvm
|
---|
1720 | _llvm_method = 'config-tool'
|
---|
1721 | endif
|
---|
1722 |
|
---|
1723 | dep_llvm = null_dep
|
---|
1724 | with_llvm = false
|
---|
1725 | draw_with_llvm = get_option('draw-use-llvm')
|
---|
1726 | if _llvm != 'disabled'
|
---|
1727 | dep_llvm = dependency(
|
---|
1728 | 'llvm',
|
---|
1729 | version : _llvm_version,
|
---|
1730 | modules : llvm_modules,
|
---|
1731 | optional_modules : llvm_optional_modules,
|
---|
1732 | required : (
|
---|
1733 | with_amd_vk or with_gallium_radeonsi or with_gallium_swr or
|
---|
1734 | with_gallium_opencl or with_clc or _llvm == 'enabled'
|
---|
1735 | ),
|
---|
1736 | static : not _shared_llvm,
|
---|
1737 | method : _llvm_method,
|
---|
1738 | fallback : ['llvm', 'dep_llvm'],
|
---|
1739 | include_type : 'system',
|
---|
1740 | )
|
---|
1741 | with_llvm = dep_llvm.found()
|
---|
1742 | endif
|
---|
1743 | if with_llvm
|
---|
1744 | pre_args += '-DLLVM_AVAILABLE'
|
---|
1745 | pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
|
---|
1746 | pre_args += '-DLLVM_IS_SHARED=@0@'.format(_shared_llvm.to_int())
|
---|
1747 |
|
---|
1748 | if draw_with_llvm
|
---|
1749 | pre_args += '-DDRAW_LLVM_AVAILABLE'
|
---|
1750 | elif with_swrast_vk
|
---|
1751 | error('Lavapipe requires LLVM draw support.')
|
---|
1752 | elif with_gallium_swr
|
---|
1753 | error('SWR requires LLVM draw support.')
|
---|
1754 | endif
|
---|
1755 |
|
---|
1756 | # LLVM can be built without rtti, turning off rtti changes the ABI of C++
|
---|
1757 | # programs, so we need to build all C++ code in mesa without rtti as well to
|
---|
1758 | # ensure that linking works.
|
---|
1759 | #
|
---|
1760 | # In meson 0.51.0 we can use cmake to find LLVM in addittion to meson's
|
---|
1761 | # builtin llvm-config based finder. A new generic variable getter method
|
---|
1762 | # has also been added, so we'll use that if we can, to cover the cmake case.
|
---|
1763 | if dep_llvm.type_name() == 'internal'
|
---|
1764 | _rtti = subproject('llvm').get_variable('has_rtti', true)
|
---|
1765 | else
|
---|
1766 | # The CMake finder will return 'ON', the llvm-config will return 'YES'
|
---|
1767 | _rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
|
---|
1768 | endif
|
---|
1769 | if not _rtti
|
---|
1770 | if with_gallium_opencl
|
---|
1771 | error('The Clover OpenCL state tracker requires rtti, you need to turn off clover or use an LLVM built with LLVM_ENABLE_RTTI.')
|
---|
1772 | endif
|
---|
1773 | if cc.get_id() == 'msvc'
|
---|
1774 | cpp_args += '/GR-'
|
---|
1775 | else
|
---|
1776 | cpp_args += '-fno-rtti'
|
---|
1777 | endif
|
---|
1778 | endif
|
---|
1779 |
|
---|
1780 | if cc.get_id() == 'msvc'
|
---|
1781 | # Suppress "/DELAYLOAD:ole32.dll/shell32.dll ignored" warnings that LLVM adds
|
---|
1782 | add_project_link_arguments(
|
---|
1783 | '/ignore:4199',
|
---|
1784 | language : ['c', 'cpp'],
|
---|
1785 | )
|
---|
1786 | endif
|
---|
1787 | elif with_amd_vk and with_aco_tests
|
---|
1788 | error('ACO tests require LLVM, but LLVM is disabled.')
|
---|
1789 | elif with_gallium_radeonsi or with_gallium_swr or with_swrast_vk
|
---|
1790 | error('The following drivers require LLVM: RadeonSI, SWR, Lavapipe. One of these is enabled, but LLVM is disabled.')
|
---|
1791 | elif with_gallium_opencl
|
---|
1792 | error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
|
---|
1793 | elif with_clc
|
---|
1794 | error('The CLC compiler requires LLVM, but LLVM is disabled.')
|
---|
1795 | else
|
---|
1796 | draw_with_llvm = false
|
---|
1797 | endif
|
---|
1798 |
|
---|
1799 | with_opencl_spirv = (_opencl != 'disabled' and get_option('opencl-spirv')) or with_clc
|
---|
1800 | if with_opencl_spirv
|
---|
1801 | chosen_llvm_version_array = dep_llvm.version().split('.')
|
---|
1802 | chosen_llvm_version_major = chosen_llvm_version_array[0].to_int()
|
---|
1803 | chosen_llvm_version_minor = chosen_llvm_version_array[1].to_int()
|
---|
1804 |
|
---|
1805 | # Require an SPIRV-LLVM-Translator version compatible with the chosen LLVM
|
---|
1806 | # one.
|
---|
1807 | _llvmspirvlib_version = [
|
---|
1808 | # This first version check is still needed as maybe LLVM 8.0 was picked but
|
---|
1809 | # we do not want to accept SPIRV-LLVM-Translator 8.0.0.1 as that version does
|
---|
1810 | # not have the required API and those are only available starting from
|
---|
1811 | # 8.0.1.3.
|
---|
1812 | '>= 8.0.1.3',
|
---|
1813 | '>= @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor),
|
---|
1814 | '< @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor + 1) ]
|
---|
1815 |
|
---|
1816 | dep_spirv_tools = dependency('SPIRV-Tools', required : true, version : '>= 2018.0')
|
---|
1817 | # LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
|
---|
1818 | dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : true, version : _llvmspirvlib_version)
|
---|
1819 | else
|
---|
1820 | dep_spirv_tools = null_dep
|
---|
1821 | dep_llvmspirvlib = null_dep
|
---|
1822 | endif
|
---|
1823 |
|
---|
1824 | dep_clang = null_dep
|
---|
1825 | if with_clc
|
---|
1826 | llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
|
---|
1827 |
|
---|
1828 | clang_modules = [
|
---|
1829 | 'clangBasic', 'clangAST', 'clangCodeGen', 'clangLex',
|
---|
1830 | 'clangDriver', 'clangFrontend', 'clangFrontendTool',
|
---|
1831 | 'clangHandleCXX', 'clangHandleLLVM', 'clangSerialization',
|
---|
1832 | 'clangSema', 'clangParse', 'clangEdit', 'clangAnalysis'
|
---|
1833 | ]
|
---|
1834 |
|
---|
1835 | dep_clang = []
|
---|
1836 | foreach m : clang_modules
|
---|
1837 | dep_clang += cpp.find_library(m, dirs : llvm_libdir, required : true)
|
---|
1838 | endforeach
|
---|
1839 | endif
|
---|
1840 |
|
---|
1841 | # Be explicit about only using this lib on Windows, to avoid picking
|
---|
1842 | # up random libs with the generic name 'libversion'
|
---|
1843 | dep_version = null_dep
|
---|
1844 | if with_opencl_spirv and host_machine.system() == 'windows'
|
---|
1845 | dep_version = cpp.find_library('version')
|
---|
1846 | endif
|
---|
1847 |
|
---|
1848 | with_opencl_native = _opencl != 'disabled' and get_option('opencl-native')
|
---|
1849 |
|
---|
1850 | if (with_amd_vk or with_gallium_radeonsi or
|
---|
1851 | (with_gallium_opencl and with_opencl_native) or
|
---|
1852 | (with_gallium_r600 and with_llvm))
|
---|
1853 | if with_platform_windows
|
---|
1854 | dep_elf = dependency('libelf', required : false, fallback : ['libelf', 'libelf_dep'])
|
---|
1855 | else
|
---|
1856 | dep_elf = dependency('libelf', required : false)
|
---|
1857 | endif
|
---|
1858 | if not dep_elf.found()
|
---|
1859 | dep_elf = cc.find_library('elf')
|
---|
1860 | endif
|
---|
1861 | else
|
---|
1862 | dep_elf = null_dep
|
---|
1863 | endif
|
---|
1864 |
|
---|
1865 | dep_glvnd = null_dep
|
---|
1866 | if with_glvnd
|
---|
1867 | dep_glvnd = dependency('libglvnd', version : '>= 1.3.2')
|
---|
1868 | pre_args += '-DUSE_LIBGLVND=1'
|
---|
1869 | endif
|
---|
1870 |
|
---|
1871 | _valgrind = get_option('valgrind')
|
---|
1872 | if _valgrind == 'true'
|
---|
1873 | _valgrind = 'enabled'
|
---|
1874 | warning('valgrind option "true" deprecated, please use "enabled" instead.')
|
---|
1875 | elif _valgrind == 'false'
|
---|
1876 | _valgrind = 'disabled'
|
---|
1877 | warning('valgrind option "false" deprecated, please use "disabled" instead.')
|
---|
1878 | endif
|
---|
1879 | if _valgrind != 'disabled'
|
---|
1880 | dep_valgrind = dependency('valgrind', required : _valgrind == 'enabled')
|
---|
1881 | if dep_valgrind.found()
|
---|
1882 | pre_args += '-DHAVE_VALGRIND'
|
---|
1883 | endif
|
---|
1884 | else
|
---|
1885 | dep_valgrind = null_dep
|
---|
1886 | endif
|
---|
1887 |
|
---|
1888 | # AddressSanitizer's leak reports need all the symbols to be present at exit to
|
---|
1889 | # decode well, which runs afoul of our dlopen()/dlclose()ing of the DRI drivers.
|
---|
1890 | # Set a flag so we can skip the dlclose for asan builds.
|
---|
1891 | if ['address', 'address,undefined'].contains(get_option('b_sanitize'))
|
---|
1892 | asan_c_args = ['-DBUILT_WITH_ASAN=1']
|
---|
1893 | else
|
---|
1894 | asan_c_args = ['-DBUILT_WITH_ASAN=0']
|
---|
1895 | endif
|
---|
1896 |
|
---|
1897 | yacc_is_bison = true
|
---|
1898 |
|
---|
1899 | if build_machine.system() == 'windows'
|
---|
1900 | # Prefer the winflexbison versions, they're much easier to install and have
|
---|
1901 | # better windows support.
|
---|
1902 |
|
---|
1903 | prog_flex = find_program('win_flex', required : false)
|
---|
1904 | if prog_flex.found()
|
---|
1905 | # windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
|
---|
1906 | # _fileno functions)
|
---|
1907 | prog_flex = [prog_flex, '--wincompat']
|
---|
1908 | if get_option('c_std') == 'c99'
|
---|
1909 | prog_flex += '-D__STDC_VERSION__=199901'
|
---|
1910 | endif
|
---|
1911 | else
|
---|
1912 | prog_flex = [find_program('flex', 'lex', required : with_any_opengl)]
|
---|
1913 | endif
|
---|
1914 | # Force flex to use const keyword in prototypes, as relies on __cplusplus or
|
---|
1915 | # __STDC__ macro to determine whether it's safe to use const keyword, but
|
---|
1916 | # MSVC only defines __STDC_VERSION__ for C11/C17.
|
---|
1917 | prog_flex += '-DYY_USE_CONST='
|
---|
1918 |
|
---|
1919 | prog_flex_cpp = prog_flex
|
---|
1920 | if get_option('c_std') != 'c99'
|
---|
1921 | # Convince win_flex to use <inttypes.h> for C++ files
|
---|
1922 | prog_flex_cpp += '-D__STDC_VERSION__=199901'
|
---|
1923 | endif
|
---|
1924 |
|
---|
1925 | prog_bison = find_program('win_bison', required : false)
|
---|
1926 | if not prog_bison.found()
|
---|
1927 | prog_bison = find_program('bison', 'yacc', required : with_any_opengl)
|
---|
1928 | endif
|
---|
1929 | else
|
---|
1930 | prog_bison = find_program('bison', required : false)
|
---|
1931 |
|
---|
1932 | if not prog_bison.found()
|
---|
1933 | prog_bison = find_program('byacc', required : with_any_opengl)
|
---|
1934 | yacc_is_bison = false
|
---|
1935 | endif
|
---|
1936 |
|
---|
1937 | # Disable deprecated keyword warnings, since we have to use them for
|
---|
1938 | # old-bison compat. See discussion in
|
---|
1939 | # https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2161
|
---|
1940 | if find_program('bison', required : false, version : '> 2.3').found()
|
---|
1941 | prog_bison = [prog_bison, '-Wno-deprecated']
|
---|
1942 | endif
|
---|
1943 |
|
---|
1944 | prog_flex = find_program('flex', required : with_any_opengl)
|
---|
1945 | prog_flex_cpp = prog_flex
|
---|
1946 | endif
|
---|
1947 |
|
---|
1948 | dep_selinux = null_dep
|
---|
1949 | if get_option('selinux')
|
---|
1950 | if get_option('execmem') != true
|
---|
1951 | warning('execmem option is disabled, selinux will not be able to use execmem.')
|
---|
1952 | endif
|
---|
1953 | dep_selinux = dependency('libselinux')
|
---|
1954 | pre_args += '-DMESA_SELINUX'
|
---|
1955 | endif
|
---|
1956 |
|
---|
1957 | if get_option('execmem')
|
---|
1958 | pre_args += '-DMESA_EXECMEM'
|
---|
1959 | endif
|
---|
1960 |
|
---|
1961 | _libunwind = get_option('libunwind')
|
---|
1962 | if _libunwind == 'true'
|
---|
1963 | _libunwind = 'enabled'
|
---|
1964 | warning('libunwind option "true" deprecated, please use "enabled" instead.')
|
---|
1965 | elif _libunwind == 'false'
|
---|
1966 | _libunwind = 'disabled'
|
---|
1967 | warning('libunwind option "false" deprecated, please use "disabled" instead.')
|
---|
1968 | endif
|
---|
1969 | if _libunwind != 'disabled' and not with_platform_android
|
---|
1970 | if host_machine.system() == 'darwin'
|
---|
1971 | dep_unwind = meson.get_compiler('c').find_library('System')
|
---|
1972 | else
|
---|
1973 | dep_unwind = dependency('libunwind', required : _libunwind == 'enabled')
|
---|
1974 | endif
|
---|
1975 | if dep_unwind.found()
|
---|
1976 | pre_args += '-DHAVE_LIBUNWIND'
|
---|
1977 | endif
|
---|
1978 | else
|
---|
1979 | dep_unwind = null_dep
|
---|
1980 | endif
|
---|
1981 |
|
---|
1982 | if with_osmesa
|
---|
1983 | if not with_gallium_softpipe
|
---|
1984 | error('OSMesa gallium requires gallium softpipe or llvmpipe.')
|
---|
1985 | endif
|
---|
1986 | if host_machine.system() == 'windows'
|
---|
1987 | osmesa_lib_name = 'osmesa'
|
---|
1988 | else
|
---|
1989 | osmesa_lib_name = 'OSMesa'
|
---|
1990 | endif
|
---|
1991 | osmesa_bits = get_option('osmesa-bits')
|
---|
1992 | if osmesa_bits != '8'
|
---|
1993 | if with_dri or with_glx != 'disabled'
|
---|
1994 | error('OSMesa bits must be 8 if building glx or dri based drivers')
|
---|
1995 | endif
|
---|
1996 | osmesa_lib_name = osmesa_lib_name + osmesa_bits
|
---|
1997 | pre_args += [
|
---|
1998 | '-DCHAN_BITS=@0@'.format(osmesa_bits), '-DDEFAULT_SOFTWARE_DEPTH_BITS=31'
|
---|
1999 | ]
|
---|
2000 | endif
|
---|
2001 | endif
|
---|
2002 |
|
---|
2003 | # TODO: symbol mangling
|
---|
2004 |
|
---|
2005 | if with_platform_wayland
|
---|
2006 | dep_wl_scanner = dependency('wayland-scanner', native: true)
|
---|
2007 | prog_wl_scanner = find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
|
---|
2008 | if dep_wl_scanner.version().version_compare('>= 1.15')
|
---|
2009 | wl_scanner_arg = 'private-code'
|
---|
2010 | else
|
---|
2011 | wl_scanner_arg = 'code'
|
---|
2012 | endif
|
---|
2013 | dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
|
---|
2014 | dep_wayland_client = dependency('wayland-client', version : '>=1.18')
|
---|
2015 | dep_wayland_server = dependency('wayland-server', version : '>=1.18')
|
---|
2016 | if with_egl
|
---|
2017 | dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3')
|
---|
2018 | dep_wayland_egl_headers = dep_wayland_egl.partial_dependency(compile_args : true)
|
---|
2019 | endif
|
---|
2020 | wayland_dmabuf_xml = join_paths(
|
---|
2021 | dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
|
---|
2022 | 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
|
---|
2023 | )
|
---|
2024 | pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
|
---|
2025 | endif
|
---|
2026 |
|
---|
2027 | dep_x11 = null_dep
|
---|
2028 | dep_xext = null_dep
|
---|
2029 | dep_xfixes = null_dep
|
---|
2030 | dep_x11_xcb = null_dep
|
---|
2031 | dep_xcb = null_dep
|
---|
2032 | dep_xcb_glx = null_dep
|
---|
2033 | dep_xcb_dri2 = null_dep
|
---|
2034 | dep_xcb_dri3 = null_dep
|
---|
2035 | dep_dri2proto = null_dep
|
---|
2036 | dep_glproto = null_dep
|
---|
2037 | dep_xxf86vm = null_dep
|
---|
2038 | dep_xcb_dri3 = null_dep
|
---|
2039 | dep_xcb_present = null_dep
|
---|
2040 | dep_xcb_sync = null_dep
|
---|
2041 | dep_xcb_xfixes = null_dep
|
---|
2042 | dep_xshmfence = null_dep
|
---|
2043 | dep_xcb_xrandr = null_dep
|
---|
2044 | dep_xcb_shm = null_dep
|
---|
2045 | dep_xlib_xrandr = null_dep
|
---|
2046 | dep_openmp = null_dep
|
---|
2047 |
|
---|
2048 | # Even if we find OpenMP, Gitlab CI fails to link with gcc/i386 and clang/anyarch.
|
---|
2049 | if host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc'
|
---|
2050 | dep_openmp = dependency('openmp', required : false)
|
---|
2051 | if dep_openmp.found()
|
---|
2052 | pre_args += ['-DHAVE_OPENMP']
|
---|
2053 | endif
|
---|
2054 | endif
|
---|
2055 |
|
---|
2056 | if with_platform_x11
|
---|
2057 | if with_glx == 'xlib' or with_glx == 'gallium-xlib'
|
---|
2058 | dep_x11 = dependency('x11')
|
---|
2059 | dep_xext = dependency('xext')
|
---|
2060 | dep_xcb = dependency('xcb')
|
---|
2061 | elif with_glx == 'dri'
|
---|
2062 | dep_x11 = dependency('x11')
|
---|
2063 | dep_xext = dependency('xext')
|
---|
2064 | dep_xfixes = dependency('xfixes', version : '>= 2.0')
|
---|
2065 | dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
|
---|
2066 | dep_xcb_shm = dependency('xcb-shm')
|
---|
2067 | endif
|
---|
2068 | if (with_any_vk or with_glx == 'dri' or with_egl or
|
---|
2069 | (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
|
---|
2070 | with_gallium_omx != 'disabled'))
|
---|
2071 | dep_xcb = dependency('xcb')
|
---|
2072 | dep_x11_xcb = dependency('x11-xcb')
|
---|
2073 | if with_dri_platform == 'drm' and not dep_libdrm.found()
|
---|
2074 | error('libdrm required for gallium video statetrackers when using x11')
|
---|
2075 | endif
|
---|
2076 | endif
|
---|
2077 | if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
|
---|
2078 | dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
|
---|
2079 |
|
---|
2080 | if with_dri3
|
---|
2081 | pre_args += '-DHAVE_DRI3'
|
---|
2082 | dep_xcb_dri3 = dependency('xcb-dri3')
|
---|
2083 | dep_xcb_present = dependency('xcb-present')
|
---|
2084 | # until xcb-dri3 has been around long enough to make a hard-dependency:
|
---|
2085 | if (dep_xcb_dri3.version().version_compare('>= 1.13') and
|
---|
2086 | dep_xcb_present.version().version_compare('>= 1.13'))
|
---|
2087 | pre_args += '-DHAVE_DRI3_MODIFIERS'
|
---|
2088 | endif
|
---|
2089 | dep_xcb_shm = dependency('xcb-shm')
|
---|
2090 | dep_xcb_sync = dependency('xcb-sync')
|
---|
2091 | dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
|
---|
2092 | endif
|
---|
2093 | endif
|
---|
2094 | if with_glx == 'dri' or with_glx == 'gallium-xlib'
|
---|
2095 | dep_glproto = dependency('glproto', version : '>= 1.4.14')
|
---|
2096 | endif
|
---|
2097 | if with_glx == 'dri'
|
---|
2098 | if with_dri_platform == 'drm'
|
---|
2099 | dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
|
---|
2100 | if with_glx_direct
|
---|
2101 | dep_xxf86vm = dependency('xxf86vm')
|
---|
2102 | endif
|
---|
2103 | endif
|
---|
2104 | endif
|
---|
2105 | if (with_egl or
|
---|
2106 | with_dri3 or (
|
---|
2107 | with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
|
---|
2108 | with_gallium_omx != 'disabled'))
|
---|
2109 | dep_xcb_xfixes = dependency('xcb-xfixes')
|
---|
2110 | endif
|
---|
2111 | if with_xlib_lease or with_any_vk
|
---|
2112 | dep_xcb_xrandr = dependency('xcb-randr')
|
---|
2113 | endif
|
---|
2114 | if with_xlib_lease
|
---|
2115 | dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
|
---|
2116 | endif
|
---|
2117 | endif
|
---|
2118 |
|
---|
2119 | if get_option('gallium-extra-hud')
|
---|
2120 | pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
|
---|
2121 | endif
|
---|
2122 |
|
---|
2123 | _sensors = get_option('lmsensors')
|
---|
2124 | if _sensors == 'true'
|
---|
2125 | _sensors = 'enabled'
|
---|
2126 | warning('lmsensors option "true" deprecated, please use "enabled" instead.')
|
---|
2127 | elif _sensors == 'false'
|
---|
2128 | _sensors = 'disabled'
|
---|
2129 | warning('lmsensors option "false" deprecated, please use "disabled" instead.')
|
---|
2130 | endif
|
---|
2131 | if _sensors != 'disabled'
|
---|
2132 | dep_lmsensors = cc.find_library('sensors', required : _sensors == 'enabled')
|
---|
2133 | if dep_lmsensors.found()
|
---|
2134 | pre_args += '-DHAVE_LIBSENSORS=1'
|
---|
2135 | endif
|
---|
2136 | else
|
---|
2137 | dep_lmsensors = null_dep
|
---|
2138 | endif
|
---|
2139 |
|
---|
2140 | _shader_replacement = get_option('custom-shader-replacement')
|
---|
2141 | if _shader_replacement == ''
|
---|
2142 | else
|
---|
2143 | pre_args += '-DCUSTOM_SHADER_REPLACEMENT'
|
---|
2144 | endif
|
---|
2145 |
|
---|
2146 | with_perfetto = get_option('perfetto')
|
---|
2147 | with_datasources = get_option('datasources')
|
---|
2148 | with_any_datasource = with_datasources.length() != 0
|
---|
2149 | if with_perfetto
|
---|
2150 | dep_perfetto = dependency('perfetto', fallback: ['perfetto', 'dep_perfetto'])
|
---|
2151 | pre_args += '-DHAVE_PERFETTO'
|
---|
2152 | endif
|
---|
2153 |
|
---|
2154 | # If the compiler supports it, put function and data symbols in their
|
---|
2155 | # own sections and GC the sections after linking. This lets drivers
|
---|
2156 | # drop shared code unused by that specific driver (particularly
|
---|
2157 | # relevant for Vulkan drivers).
|
---|
2158 | if cc.has_link_argument('-Wl,--gc-sections')
|
---|
2159 | foreach a: ['-ffunction-sections', '-fdata-sections']
|
---|
2160 | if cc.has_argument(a)
|
---|
2161 | add_project_arguments(a, language : ['c', 'cpp'])
|
---|
2162 | endif
|
---|
2163 | endforeach
|
---|
2164 | endif
|
---|
2165 |
|
---|
2166 | foreach a : pre_args
|
---|
2167 | add_project_arguments(a, language : ['c', 'cpp'])
|
---|
2168 | endforeach
|
---|
2169 | foreach a : c_args
|
---|
2170 | add_project_arguments(a, language : ['c'])
|
---|
2171 | endforeach
|
---|
2172 | foreach a : cpp_args
|
---|
2173 | add_project_arguments(a, language : ['cpp'])
|
---|
2174 | endforeach
|
---|
2175 |
|
---|
2176 | gl_priv_reqs = []
|
---|
2177 |
|
---|
2178 | if with_glx == 'xlib' or with_glx == 'gallium-xlib'
|
---|
2179 | gl_priv_reqs += ['x11', 'xext', 'xcb']
|
---|
2180 | elif with_glx == 'dri'
|
---|
2181 | gl_priv_reqs += [
|
---|
2182 | 'x11', 'xext', 'xfixes', 'x11-xcb', 'xcb',
|
---|
2183 | 'xcb-glx >= 1.8.1']
|
---|
2184 | if with_dri_platform == 'drm'
|
---|
2185 | gl_priv_reqs += 'xcb-dri2 >= 1.8'
|
---|
2186 | if with_glx_direct
|
---|
2187 | gl_priv_reqs += 'xxf86vm'
|
---|
2188 | endif
|
---|
2189 | endif
|
---|
2190 | endif
|
---|
2191 | if dep_libdrm.found()
|
---|
2192 | gl_priv_reqs += 'libdrm >= 2.4.75'
|
---|
2193 | endif
|
---|
2194 |
|
---|
2195 | gl_priv_libs = []
|
---|
2196 | if dep_thread.found()
|
---|
2197 | gl_priv_libs += ['-lpthread', '-pthread']
|
---|
2198 | endif
|
---|
2199 | if dep_m.found()
|
---|
2200 | gl_priv_libs += '-lm'
|
---|
2201 | endif
|
---|
2202 | if dep_dl.found()
|
---|
2203 | gl_priv_libs += '-ldl'
|
---|
2204 | endif
|
---|
2205 |
|
---|
2206 | # FIXME: autotools lists this as incomplete
|
---|
2207 | gbm_priv_libs = []
|
---|
2208 | if dep_dl.found()
|
---|
2209 | gbm_priv_libs += '-ldl'
|
---|
2210 | endif
|
---|
2211 |
|
---|
2212 | pkg = import('pkgconfig')
|
---|
2213 |
|
---|
2214 | if host_machine.system() == 'windows'
|
---|
2215 | prog_dumpbin = find_program('dumpbin', required : false)
|
---|
2216 | with_symbols_check = prog_dumpbin.found() and with_tests
|
---|
2217 | if with_symbols_check
|
---|
2218 | symbols_check_args = ['--dumpbin', prog_dumpbin.path()]
|
---|
2219 | endif
|
---|
2220 | else
|
---|
2221 | prog_nm = find_program('nm')
|
---|
2222 | with_symbols_check = with_tests
|
---|
2223 | symbols_check_args = ['--nm', prog_nm.path()]
|
---|
2224 | endif
|
---|
2225 |
|
---|
2226 | # This quirk needs to be applied to sources with functions defined in assembly
|
---|
2227 | # as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391
|
---|
2228 | gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
|
---|
2229 |
|
---|
2230 | subdir('include')
|
---|
2231 | subdir('bin')
|
---|
2232 | subdir('src')
|
---|
2233 |
|
---|
2234 | # Meson 0.49 and earlier seems to have a bug that fails to evaluate the string-
|
---|
2235 | # formatting below unless the first argument is passed as a variable. This has
|
---|
2236 | # been fixed in Meson 0.50 and beyond, but we need to keep it like this for now
|
---|
2237 | # for backwards compatibility.
|
---|
2238 | _with_opengl_string = with_opengl ? 'yes' : 'no'
|
---|
2239 |
|
---|
2240 | lines = ['',
|
---|
2241 | 'prefix: ' + get_option('prefix'),
|
---|
2242 | 'libdir: ' + get_option('libdir'),
|
---|
2243 | 'includedir: ' + get_option('includedir'),
|
---|
2244 | '',
|
---|
2245 | 'OpenGL: @0@ (ES1: @1@ ES2: @2@)'.format(_with_opengl_string,
|
---|
2246 | with_gles1 ? 'yes' : 'no',
|
---|
2247 | with_gles2 ? 'yes' : 'no'),
|
---|
2248 | ]
|
---|
2249 |
|
---|
2250 | if with_osmesa
|
---|
2251 | lines += ''
|
---|
2252 | lines += 'OSMesa: lib' + osmesa_lib_name
|
---|
2253 | else
|
---|
2254 | lines += 'OSMesa: no'
|
---|
2255 | endif
|
---|
2256 |
|
---|
2257 | if with_dri
|
---|
2258 | lines += ''
|
---|
2259 | lines += 'DRI platform: ' + with_dri_platform
|
---|
2260 | if dri_drivers.length() != 0 and dri_drivers != ['']
|
---|
2261 | lines += 'DRI drivers: ' + ' '.join(dri_drivers)
|
---|
2262 | else
|
---|
2263 | lines += 'DRI drivers: no'
|
---|
2264 | endif
|
---|
2265 | lines += 'DRI driver dir: ' + dri_drivers_path
|
---|
2266 | endif
|
---|
2267 |
|
---|
2268 | if with_glx != 'disabled'
|
---|
2269 | lines += ''
|
---|
2270 | if with_glx == 'dri'
|
---|
2271 | lines += 'GLX: DRI-based'
|
---|
2272 | elif with_glx == 'xlib'
|
---|
2273 | lines += 'GLX: Xlib-based'
|
---|
2274 | elif with_glx == 'gallium-xlib'
|
---|
2275 | lines += 'GLX: Xlib-based (Gallium)'
|
---|
2276 | else
|
---|
2277 | lines += 'GLX: ' + with_glx
|
---|
2278 | endif
|
---|
2279 | endif
|
---|
2280 |
|
---|
2281 | lines += ''
|
---|
2282 | lines += 'EGL: ' + (with_egl ? 'yes' : 'no')
|
---|
2283 | if with_egl
|
---|
2284 | egl_drivers = []
|
---|
2285 | if with_dri
|
---|
2286 | egl_drivers += 'builtin:egl_dri2'
|
---|
2287 | endif
|
---|
2288 | if with_dri3
|
---|
2289 | egl_drivers += 'builtin:egl_dri3'
|
---|
2290 | endif
|
---|
2291 | if with_platform_windows
|
---|
2292 | egl_drivers += 'builtin:wgl'
|
---|
2293 | endif
|
---|
2294 | lines += 'EGL drivers: ' + ' '.join(egl_drivers)
|
---|
2295 | endif
|
---|
2296 | if with_egl or with_any_vk
|
---|
2297 | lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms)
|
---|
2298 | endif
|
---|
2299 | lines += 'GBM: ' + (with_gbm ? 'yes' : 'no')
|
---|
2300 | if with_gbm
|
---|
2301 | lines += 'GBM backends path: ' + gbm_backends_path
|
---|
2302 | endif
|
---|
2303 |
|
---|
2304 | lines += ''
|
---|
2305 | if with_any_vk
|
---|
2306 | lines += 'Vulkan drivers: ' + ' '.join(_vulkan_drivers)
|
---|
2307 | lines += 'Vulkan ICD dir: ' + with_vulkan_icd_dir
|
---|
2308 | if with_any_vulkan_layers
|
---|
2309 | lines += 'Vulkan layers: ' + ' '.join(get_option('vulkan-layers'))
|
---|
2310 | endif
|
---|
2311 | else
|
---|
2312 | lines += 'Vulkan drivers: no'
|
---|
2313 | endif
|
---|
2314 |
|
---|
2315 | lines += ''
|
---|
2316 | if with_llvm
|
---|
2317 | lines += 'llvm: yes'
|
---|
2318 | lines += 'llvm-version: ' + dep_llvm.version()
|
---|
2319 | else
|
---|
2320 | lines += 'llvm: no'
|
---|
2321 | endif
|
---|
2322 |
|
---|
2323 | lines += ''
|
---|
2324 | if with_gallium
|
---|
2325 | lines += 'Gallium drivers: ' + ' '.join(gallium_drivers)
|
---|
2326 | gallium_st = ['mesa']
|
---|
2327 | if with_gallium_xa
|
---|
2328 | gallium_st += 'xa'
|
---|
2329 | endif
|
---|
2330 | if with_gallium_xvmc
|
---|
2331 | gallium_st += 'xvmc'
|
---|
2332 | endif
|
---|
2333 | if with_gallium_vdpau
|
---|
2334 | gallium_st += 'vdpau'
|
---|
2335 | endif
|
---|
2336 | if with_gallium_omx != 'disabled'
|
---|
2337 | gallium_st += 'omx' + with_gallium_omx
|
---|
2338 | endif
|
---|
2339 | if with_gallium_va
|
---|
2340 | gallium_st += 'va'
|
---|
2341 | endif
|
---|
2342 | if with_gallium_st_nine
|
---|
2343 | gallium_st += 'nine'
|
---|
2344 | endif
|
---|
2345 | if with_gallium_opencl
|
---|
2346 | gallium_st += 'clover'
|
---|
2347 | endif
|
---|
2348 | lines += 'Gallium st: ' + ' '.join(gallium_st)
|
---|
2349 | else
|
---|
2350 | lines += 'Gallium: no'
|
---|
2351 | endif
|
---|
2352 |
|
---|
2353 | lines += 'HUD lmsensors: ' + (dep_lmsensors.found() ? 'yes' : 'no')
|
---|
2354 |
|
---|
2355 | lines += ''
|
---|
2356 | lines += 'Shared-glapi: ' + (with_shared_glapi ? 'yes' : 'no')
|
---|
2357 |
|
---|
2358 | lines += ''
|
---|
2359 | lines += 'Perfetto: ' + (with_perfetto ? 'yes' : 'no')
|
---|
2360 | if with_any_datasource
|
---|
2361 | lines += 'Perfetto ds: ' + ' '.join(with_datasources)
|
---|
2362 | endif
|
---|
2363 |
|
---|
2364 |
|
---|
2365 | indent = ' '
|
---|
2366 | summary = indent + ('\n' + indent).join(lines)
|
---|
2367 | message('Configuration summary:\n@0@\n'.format(summary))
|
---|