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