Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 1 | # Copyright © 2017 Intel Corporation |
| 2 | |
| 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | # of this software and associated documentation files (the "Software"), to deal |
| 5 | # in the Software without restriction, including without limitation the rights |
| 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | # copies of the Software, and to permit persons to whom the Software is |
| 8 | # furnished to do so, subject to the following conditions: |
| 9 | |
| 10 | # The above copyright notice and this permission notice shall be included in |
| 11 | # all copies or substantial portions of the Software. |
| 12 | |
| 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 | # SOFTWARE. |
| 20 | |
| 21 | project('mesa', ['c', 'cpp'], version : '17.3.0-devel', license : 'MIT', |
Dylan Baker | 052c0d5 | 2017-09-30 20:04:09 -0700 | [diff] [blame] | 22 | default_options : ['c_std=c99', 'cpp_std=c++11']) |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 23 | |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 24 | # Arguments for the preprocessor, put these in a separate array from the C and |
| 25 | # C++ (cpp in meson terminology) arguments since they need to be added to the |
| 26 | # default arguments for both C and C++. |
| 27 | pre_args = [ |
| 28 | '-D__STDC_CONSTANT_MACROS', |
| 29 | '-D__STDC_FORMAT_MACROS', |
| 30 | '-D__STDC_LIMIT_MACROS', |
| 31 | '-DVERSION="@0@"'.format(meson.project_version()), |
| 32 | '-DPACKAGE_VERSION=VERSION', |
| 33 | '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"', |
Dylan Baker | 601bd72 | 2017-10-09 14:22:07 -0700 | [diff] [blame] | 34 | '-D_GNU_SOURCE', |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 35 | ] |
| 36 | |
Dylan Baker | e915b8d | 2017-09-28 14:02:51 -0700 | [diff] [blame] | 37 | with_vulkan_icd_dir = get_option('vulkan-icd-dir') |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 38 | with_tests = get_option('build-tests') |
| 39 | with_valgrind = get_option('valgrind') |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 40 | with_asm = get_option('asm') |
Dylan Baker | 02cf3a8 | 2017-10-12 09:47:30 -0700 | [diff] [blame] | 41 | with_llvm = get_option('llvm') |
Dylan Baker | 3b209e9 | 2017-10-10 15:25:07 -0700 | [diff] [blame] | 42 | if get_option('texture-float') |
| 43 | pre_args += '-DTEXTURE_FLOAT_ENABLED' |
| 44 | message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.') |
| 45 | endif |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 46 | |
| 47 | # XXX: yeah, do these |
| 48 | with_appledri = false |
| 49 | with_windowsdri = false |
| 50 | |
Dylan Baker | db97884 | 2017-09-28 13:59:04 -0700 | [diff] [blame] | 51 | dri_drivers_path = get_option('dri-drivers-path') |
| 52 | if dri_drivers_path == '' |
| 53 | dri_drivers_path = join_paths(get_option('libdir'), 'dri') |
| 54 | endif |
| 55 | |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 56 | with_gles1 = get_option('gles1') |
| 57 | with_gles2 = get_option('gles2') |
| 58 | with_opengl = get_option('opengl') |
| 59 | with_any_opengl = with_opengl or with_gles1 or with_gles2 |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 60 | # Only build shared_glapi if at least one OpenGL API is enabled |
| 61 | with_shared_glapi = get_option('shared-glapi') and with_any_opengl |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 62 | |
| 63 | # TODO: these will need options, but at the moment they just control header |
| 64 | # installs |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 65 | with_osmesa = false |
| 66 | |
| 67 | # shared-glapi is required if at least two OpenGL APIs are being built |
| 68 | if not with_shared_glapi |
| 69 | if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl) |
| 70 | or (with_gles2 and with_opengl)) |
| 71 | error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x') |
| 72 | endif |
| 73 | endif |
| 74 | |
| 75 | # We require OpenGL for OpenGL ES |
| 76 | if (with_gles1 or with_gles2) and not with_opengl |
| 77 | error('building OpenGL ES without OpenGL is not supported.') |
| 78 | endif |
| 79 | |
| 80 | with_dri = false |
Ville Syrjälä | 2289964 | 2017-10-10 01:15:42 +0300 | [diff] [blame] | 81 | with_dri_i915 = false |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 82 | with_dri_i965 = false |
Dylan Baker | c2cd580 | 2017-10-03 17:06:22 -0700 | [diff] [blame] | 83 | with_dri_swrast = false |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 84 | _drivers = get_option('dri-drivers') |
| 85 | if _drivers != '' |
| 86 | _split = _drivers.split(',') |
Ville Syrjälä | 2289964 | 2017-10-10 01:15:42 +0300 | [diff] [blame] | 87 | with_dri_i915 = _split.contains('i915') |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 88 | with_dri_i965 = _split.contains('i965') |
Dylan Baker | c2cd580 | 2017-10-03 17:06:22 -0700 | [diff] [blame] | 89 | with_dri_swrast = _split.contains('swrast') |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 90 | with_dri = true |
| 91 | endif |
| 92 | |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 93 | with_gallium = false |
Eric Anholt | 1918c9b | 2017-10-12 18:39:08 -0700 | [diff] [blame] | 94 | with_gallium_pl111 = false |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 95 | with_gallium_radeonsi = false |
Dylan Baker | 813b4b0 | 2017-10-09 14:59:35 -0700 | [diff] [blame] | 96 | with_gallium_nouveau = false |
Dylan Baker | f3d03a2 | 2017-10-10 11:57:50 -0700 | [diff] [blame] | 97 | with_gallium_softpipe = false |
Eric Anholt | 1ae8018 | 2017-10-12 13:53:12 -0700 | [diff] [blame] | 98 | with_gallium_vc4 = false |
Eric Anholt | 4f3e380 | 2017-10-12 18:40:16 -0700 | [diff] [blame] | 99 | with_gallium_vc5 = false |
Dylan Baker | 51558a1 | 2017-10-20 15:45:22 -0700 | [diff] [blame] | 100 | with_gallium_etnaviv = false |
Dylan Baker | d4567ef | 2017-10-20 15:57:15 -0700 | [diff] [blame] | 101 | with_gallium_imx = false |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 102 | _drivers = get_option('gallium-drivers') |
| 103 | if _drivers != '' |
| 104 | _split = _drivers.split(',') |
Dylan Baker | fbf39fd | 2017-10-17 14:44:15 -0700 | [diff] [blame] | 105 | with_gallium_pl111 = _split.contains('pl111') |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 106 | with_gallium_radeonsi = _split.contains('radeonsi') |
Dylan Baker | 813b4b0 | 2017-10-09 14:59:35 -0700 | [diff] [blame] | 107 | with_gallium_nouveau = _split.contains('nouveau') |
Dylan Baker | de24d61 | 2017-10-10 14:27:19 -0700 | [diff] [blame] | 108 | with_gallium_softpipe = _split.contains('swrast') |
Eric Anholt | 1ae8018 | 2017-10-12 13:53:12 -0700 | [diff] [blame] | 109 | with_gallium_vc4 = _split.contains('vc4') |
Eric Anholt | 4f3e380 | 2017-10-12 18:40:16 -0700 | [diff] [blame] | 110 | with_gallium_vc5 = _split.contains('vc5') |
Dylan Baker | 51558a1 | 2017-10-20 15:45:22 -0700 | [diff] [blame] | 111 | with_gallium_etnaviv = _split.contains('etnaviv') |
Dylan Baker | d4567ef | 2017-10-20 15:57:15 -0700 | [diff] [blame] | 112 | with_gallium_imx = _split.contains('imx') |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 113 | with_gallium = true |
| 114 | with_dri = true |
Ville Syrjälä | 2289964 | 2017-10-10 01:15:42 +0300 | [diff] [blame] | 115 | endif |
| 116 | |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 117 | if not (with_dri or with_gallium) |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 118 | with_gles1 = false |
| 119 | with_gles2 = false |
| 120 | with_opengl = false |
| 121 | with_any_opengl = false |
| 122 | with_shared_glapi = false |
| 123 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 124 | |
Dylan Baker | de24d61 | 2017-10-10 14:27:19 -0700 | [diff] [blame] | 125 | if with_dri_swrast and with_gallium_softpipe |
| 126 | error('Only one swrast provider can be built') |
| 127 | endif |
Dylan Baker | d4567ef | 2017-10-20 15:57:15 -0700 | [diff] [blame] | 128 | if with_gallium_imx and not with_gallium_etnaviv |
| 129 | error('IMX driver requires etnaviv driver') |
| 130 | endif |
Dylan Baker | de24d61 | 2017-10-10 14:27:19 -0700 | [diff] [blame] | 131 | |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 132 | dep_libdrm_intel = [] |
| 133 | if with_dri_i915 |
| 134 | dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75') |
| 135 | endif |
| 136 | |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 137 | # TODO: other OSes |
| 138 | with_dri_platform = 'drm' |
| 139 | |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 140 | # TODO: android platform |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 141 | with_platform_wayland = false |
| 142 | with_platform_x11 = false |
Dylan Baker | b1b6539 | 2017-09-28 22:25:02 -0700 | [diff] [blame] | 143 | with_platform_drm = false |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 144 | with_platform_surfaceless = false |
| 145 | egl_native_platform = '' |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 146 | _platforms = get_option('platforms') |
| 147 | if _platforms != '' |
| 148 | _split = _platforms.split(',') |
| 149 | with_platform_x11 = _split.contains('x11') |
| 150 | with_platform_wayland = _split.contains('wayland') |
Dylan Baker | b1b6539 | 2017-09-28 22:25:02 -0700 | [diff] [blame] | 151 | with_platform_drm = _split.contains('drm') |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 152 | with_platform_surfaceless = _split.contains('surfaceless') |
| 153 | egl_native_platform = _split[0] |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 154 | endif |
| 155 | |
Dylan Baker | 816bf7d1 | 2017-09-28 15:53:53 -0700 | [diff] [blame] | 156 | with_gbm = get_option('gbm') |
| 157 | if with_gbm == 'auto' and with_dri # TODO: or gallium |
| 158 | with_gbm = host_machine.system() == 'linux' |
| 159 | elif with_gbm == 'yes' |
| 160 | if not ['linux', 'bsd'].contains(host_machine.system()) |
| 161 | error('GBM only supports unix-like platforms') |
| 162 | endif |
| 163 | with_gbm = true |
| 164 | else |
| 165 | with_gbm = false |
| 166 | endif |
| 167 | |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 168 | _egl = get_option('egl') |
| 169 | if _egl == 'auto' |
| 170 | with_egl = with_dri and with_shared_glapi and egl_native_platform != '' |
| 171 | elif _egl == 'yes' |
| 172 | if not with_dri |
| 173 | error('EGL requires dri') |
| 174 | elif not with_shared_glapi |
| 175 | error('EGL requires shared-glapi') |
| 176 | elif egl_native_platform == '' |
| 177 | error('No platforms specified, consider -Dplatforms=drm,x11 at least') |
| 178 | endif |
| 179 | with_egl = true |
| 180 | else |
| 181 | with_egl = false |
| 182 | endif |
| 183 | |
| 184 | # TODO: or virgl |
| 185 | if with_egl and with_gallium_radeonsi and not (with_platform_drm or with_platform_surfaceless) |
| 186 | error('RadeonSI requires drm or surfaceless platform when using EGL') |
| 187 | endif |
| 188 | |
Dylan Baker | 8e61187 | 2017-10-11 12:49:31 -0700 | [diff] [blame] | 189 | pre_args += '-DGLX_USE_TLS' |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 190 | with_glx = get_option('glx') |
| 191 | if with_glx != 'disabled' |
Dylan Baker | 8d3b121 | 2017-10-18 15:47:11 -0700 | [diff] [blame] | 192 | if not (with_platform_x11 and with_any_opengl) |
| 193 | if with_glx == 'auto' |
| 194 | with_glx = 'disabled' |
| 195 | else |
| 196 | error('Cannot build GLX support without X11 platform support and at least one OpenGL API') |
| 197 | endif |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 198 | elif with_glx == 'gallium-xlib' |
| 199 | if not with_gallium |
| 200 | error('Gallium-xlib based GLX requires at least one gallium driver') |
| 201 | elif with_dri |
| 202 | error('gallium-xlib conflicts with any dri driver') |
| 203 | endif |
| 204 | elif with_glx == 'dri' and not with_dri |
| 205 | error('dri based GLX requires at least one DRI driver') |
| 206 | elif with_glx == 'auto' |
| 207 | if with_dri |
| 208 | with_glx = 'dri' |
| 209 | elif with_gallium |
| 210 | with_glx = 'gallium-xlib' |
| 211 | elif with_platform_x11 and with_any_opengl |
| 212 | with_glx = 'xlib' |
| 213 | else |
| 214 | with_glx = 'disabled' |
| 215 | endif |
| 216 | endif |
| 217 | endif |
| 218 | |
| 219 | with_glvnd = get_option('glvnd') |
| 220 | if with_glvnd and with_glx != 'dri' |
| 221 | message('glvnd requires dri based glx') |
| 222 | endif |
| 223 | |
| 224 | # TODO: toggle for this |
| 225 | with_glx_direct = true |
| 226 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 227 | if with_vulkan_icd_dir == '' |
| 228 | with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d') |
| 229 | endif |
| 230 | |
| 231 | with_intel_vk = false |
| 232 | with_amd_vk = false |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 233 | with_any_vk = false |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 234 | _vulkan_drivers = get_option('vulkan-drivers') |
| 235 | if _vulkan_drivers != '' |
| 236 | _split = _vulkan_drivers.split(',') |
| 237 | with_intel_vk = _split.contains('intel') |
| 238 | with_amd_vk = _split.contains('amd') |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 239 | with_any_vk = with_amd_vk or with_intel_vk |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 240 | if not (with_platform_x11 or with_platform_wayland) |
| 241 | error('Vulkan requires at least one platform (x11, wayland)') |
| 242 | endif |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 243 | endif |
| 244 | |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 245 | with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm' |
| 246 | with_dri3 = get_option('dri3') |
| 247 | if with_dri3 == 'auto' |
| 248 | if host_machine.system() == 'linux' and with_dri2 |
| 249 | with_dri3 = true |
| 250 | else |
| 251 | with_dri3 = false |
| 252 | endif |
| 253 | elif with_dri3 == 'yes' |
| 254 | with_dri3 = true |
| 255 | else |
| 256 | with_dri3 = false |
| 257 | endif |
| 258 | |
| 259 | if with_any_vk and (with_platform_x11 and not with_dri3) |
| 260 | error('Vulkan drivers require dri3 for X11 support') |
| 261 | endif |
Dylan Baker | af9d276 | 2017-09-28 21:03:07 -0700 | [diff] [blame] | 262 | if with_dri or with_gallium |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 263 | if with_glx == 'disabled' and not with_egl |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 264 | error('building dri or gallium drivers require at least one window system') |
| 265 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 266 | endif |
| 267 | |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 268 | with_gallium_xvmc = false |
| 269 | with_gallium_vdpau = false |
| 270 | with_gallium_omx = false # this is bellagio |
| 271 | with_gallium_va = false |
| 272 | with_gallium_media = false |
| 273 | dep_va = [] |
| 274 | _drivers = get_option('gallium-media') |
| 275 | if _drivers != '' |
| 276 | _split = _drivers.split(',') |
| 277 | with_gallium_xvmc = _split.contains('xvmc') |
| 278 | with_gallium_vdpau = _split.contains('vdpau') |
| 279 | with_gallium_omx = _split.contains('omx') |
| 280 | with_gallium_va = _split.contains('va') |
| 281 | with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or |
| 282 | with_gallium_omx or with_gallium_va) |
| 283 | endif |
| 284 | |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 285 | gl_pkgconfig_c_flags = [] |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 286 | if with_platform_x11 |
| 287 | if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm') |
| 288 | pre_args += '-DHAVE_X11_PLATFORM' |
| 289 | endif |
| 290 | if with_glx == 'xlib' |
| 291 | # TODO |
| 292 | error('TODO') |
| 293 | elif with_glx == 'gallium-xlib' |
| 294 | # TODO |
| 295 | error('TODO') |
| 296 | else |
| 297 | pre_args += '-DGLX_INDIRECT_RENDERING' |
| 298 | if with_glx_direct |
| 299 | pre_args += '-DGLX_DIRECT_RENDERING' |
| 300 | endif |
| 301 | if with_dri_platform == 'drm' |
| 302 | pre_args += '-DGLX_USE_DRM' |
| 303 | endif |
| 304 | endif |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 305 | else |
| 306 | pre_args += '-DMESA_EGL_NO_X11_HEADERS' |
| 307 | gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS' |
| 308 | endif |
| 309 | if with_platform_drm |
| 310 | if with_egl and not with_gbm |
| 311 | error('EGL drm platform requires gbm') |
| 312 | endif |
| 313 | pre_args += '-DHAVE_DRM_PLATFORM' |
| 314 | endif |
| 315 | if with_platform_surfaceless |
| 316 | pre_args += '-DHAVE_SURFACELESS_PLATFORM' |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 317 | endif |
| 318 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 319 | prog_python2 = find_program('python2') |
Dylan Baker | 9342a7d | 2017-09-28 10:48:30 -0700 | [diff] [blame] | 320 | has_mako = run_command(prog_python2, '-c', 'import mako') |
| 321 | if has_mako.returncode() != 0 |
| 322 | error('Python (2.x) mako module required to build mesa.') |
| 323 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 324 | |
| 325 | cc = meson.get_compiler('c') |
| 326 | if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6') |
Eric Engestrom | 1262e82 | 2017-09-29 15:25:18 +0100 | [diff] [blame] | 327 | error('When using GCC, version 4.4.6 or later is required.') |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 328 | endif |
| 329 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 330 | # Define DEBUG for debug and debugoptimized builds |
| 331 | if get_option('buildtype').startswith('debug') |
| 332 | pre_args += '-DDEBUG' |
| 333 | endif |
| 334 | |
Dylan Baker | 673dda8 | 2017-09-20 11:53:29 -0700 | [diff] [blame] | 335 | if get_option('shader-cache') |
| 336 | pre_args += '-DENABLE_SHADER_CACHE' |
| 337 | elif with_amd_vk |
| 338 | error('Radv requires shader cache support') |
| 339 | endif |
| 340 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 341 | # Check for GCC style builtins |
| 342 | foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs', |
| 343 | 'ffsll', 'popcount', 'popcountll', 'unreachable'] |
| 344 | if cc.has_function(b) |
| 345 | pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper()) |
| 346 | endif |
| 347 | endforeach |
| 348 | |
Dylan Baker | 673dda8 | 2017-09-20 11:53:29 -0700 | [diff] [blame] | 349 | # check for GCC __attribute__ |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 350 | foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused', |
| 351 | 'warn_unused_result', 'weak',] |
| 352 | if cc.compiles('int foo(void) __attribute__((@0@));'.format(a), |
| 353 | name : '__attribute__((@0@))'.format(a)) |
| 354 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper()) |
| 355 | endif |
| 356 | endforeach |
| 357 | if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));', |
| 358 | name : '__attribute__((format(...)))') |
| 359 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT' |
| 360 | endif |
| 361 | if cc.compiles('struct __attribute__((packed)) foo { int bar; };', |
| 362 | name : '__attribute__((packed))') |
| 363 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED' |
| 364 | endif |
| 365 | if cc.compiles('int *foo(void) __attribute__((returns_nonnull));', |
| 366 | name : '__attribute__((returns_nonnull))') |
| 367 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL' |
| 368 | endif |
| 369 | if cc.compiles('''int foo_def(void) __attribute__((visibility("default"))); |
| 370 | int foo_hid(void) __attribute__((visibility("hidden"))); |
| 371 | int foo_int(void) __attribute__((visibility("internal"))); |
| 372 | int foo_pro(void) __attribute__((visibility("protected")));''', |
| 373 | name : '__attribute__((visibility(...)))') |
| 374 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY' |
| 375 | endif |
| 376 | if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));', |
| 377 | name : '__attribute__((alias(...)))') |
| 378 | pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS' |
| 379 | endif |
| 380 | |
| 381 | # TODO: this is very incomplete |
| 382 | if host_machine.system() == 'linux' |
| 383 | pre_args += '-D_GNU_SOURCE' |
| 384 | endif |
| 385 | |
| 386 | # Check for generic C arguments |
| 387 | c_args = [] |
| 388 | foreach a : ['-Wall', '-Werror=implicit-function-declaration', |
| 389 | '-Werror=missing-prototypes', '-fno-math-errno', |
| 390 | '-fno-trapping-math', '-Qunused-arguments'] |
| 391 | if cc.has_argument(a) |
| 392 | c_args += a |
| 393 | endif |
| 394 | endforeach |
| 395 | c_vis_args = [] |
| 396 | if cc.has_argument('-fvisibility=hidden') |
| 397 | c_vis_args += '-fvisibility=hidden' |
| 398 | endif |
| 399 | |
| 400 | # Check for generic C++ arguments |
| 401 | cpp = meson.get_compiler('cpp') |
| 402 | cpp_args = [] |
| 403 | foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math', |
| 404 | '-Qunused-arguments', '-Wno-non-virtual-dtor'] |
| 405 | if cpp.has_argument(a) |
| 406 | cpp_args += a |
| 407 | endif |
| 408 | endforeach |
| 409 | cpp_vis_args = [] |
| 410 | if cpp.has_argument('-fvisibility=hidden') |
| 411 | cpp_vis_args += '-fvisibility=hidden' |
| 412 | endif |
| 413 | |
| 414 | # Check for C and C++ arguments for MSVC2013 compatibility. These are only used |
| 415 | # in parts of the mesa code base that need to compile with old versions of |
| 416 | # MSVC, mainly common code |
| 417 | c_msvc_compat_args = [] |
| 418 | cpp_msvc_compat_args = [] |
| 419 | foreach a : ['-Werror=pointer-arith', '-Werror=vla'] |
| 420 | if cc.has_argument(a) |
| 421 | c_msvc_compat_args += a |
| 422 | endif |
| 423 | if cpp.has_argument(a) |
| 424 | cpp_msvc_compat_args += a |
| 425 | endif |
| 426 | endforeach |
| 427 | |
| 428 | no_override_init_args = [] |
| 429 | foreach a : ['-Wno-override-init', '-Wno-initializer-overrides'] |
| 430 | if cc.has_argument(a) |
| 431 | no_override_init_args += a |
| 432 | endif |
| 433 | endforeach |
| 434 | |
| 435 | # TODO: SSE41 (which is only required for core mesa) |
| 436 | |
| 437 | # Check for GCC style atomics |
| 438 | if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }', |
| 439 | name : 'GCC atomic builtins') |
| 440 | pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' |
| 441 | endif |
| 442 | if not cc.links('''#include <stdint.h> |
| 443 | uint64_t v; |
| 444 | int main() { |
| 445 | return __sync_add_and_fetch(&v, (uint64_t)1); |
| 446 | }''', |
| 447 | name : 'GCC 64bit atomics') |
| 448 | pre_args += '-DMISSING_64_BIT_ATOMICS' |
| 449 | endif |
| 450 | |
| 451 | # TODO: endian |
| 452 | # TODO: powr8 |
| 453 | # TODO: shared/static? Is this even worth doing? |
| 454 | |
| 455 | # I don't think that I need to set any of the debug stuff, I think meson |
| 456 | # handles that for us |
| 457 | |
| 458 | # TODO: ldflags |
| 459 | |
| 460 | # TODO: texture-float (gallium/mesa only) |
| 461 | |
| 462 | # TODO: cross-compiling. I don't think this is relavent to meson |
| 463 | |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 464 | # FIXME: enable asm when cross compiler |
| 465 | # This is doable (autotools does it), but it's not of immediate concern |
| 466 | if meson.is_cross_build() |
| 467 | message('Cross compiling, disabling asm') |
| 468 | with_asm = false |
| 469 | endif |
| 470 | |
| 471 | with_asm_arch = '' |
| 472 | if with_asm |
| 473 | # TODO: SPARC and PPC |
| 474 | if host_machine.cpu_family() == 'x86' |
| 475 | if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd? |
| 476 | with_asm_arch = 'x86' |
| 477 | pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM', |
| 478 | '-DUSE_SSE_ASM'] |
| 479 | endif |
| 480 | elif host_machine.cpu_family() == 'x86_64' |
| 481 | if host_machine.system() == 'linux' |
| 482 | with_asm_arch = 'x86_64' |
| 483 | pre_args += ['-DUSE_X86_64_ASM'] |
| 484 | endif |
| 485 | elif host_machine.cpu_family() == 'arm' |
| 486 | if host_machine.system() == 'linux' |
| 487 | with_asm_arch = 'arm' |
| 488 | pre_args += ['-DUSE_ARM_ASM'] |
| 489 | endif |
| 490 | elif host_machine.cpu_family() == 'aarch64' |
| 491 | if host_machine.system() == 'linux' |
| 492 | with_asm_arch = 'aarch64' |
| 493 | pre_args += ['-DUSE_AARCH64_ASM'] |
| 494 | endif |
| 495 | endif |
| 496 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 497 | |
| 498 | # Check for standard headers and functions |
| 499 | if cc.has_header_symbol('sys/sysmacros.h', 'major') |
| 500 | pre_args += '-DMAJOR_IN_SYSMACROS' |
| 501 | elif cc.has_header_symbol('sys/mkdev.h', 'major') |
| 502 | pre_args += '-DMAJOR_IN_MKDEV' |
| 503 | endif |
| 504 | |
| 505 | foreach h : ['xlocale.h', 'sys/sysctl.h'] |
| 506 | if cc.has_header(h) |
| 507 | pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) |
| 508 | endif |
| 509 | endforeach |
| 510 | |
| 511 | foreach f : ['strtof', 'mkostemp', 'posix_memalign'] |
| 512 | if cc.has_function(f) |
| 513 | pre_args += '-DHAVE_@0@'.format(f.to_upper()) |
| 514 | endif |
| 515 | endforeach |
| 516 | |
| 517 | # strtod locale support |
| 518 | if cc.links(''' |
| 519 | #define _GNU_SOURCE |
| 520 | #include <stdlib.h> |
| 521 | #include <locale.h> |
| 522 | #ifdef HAVE_XLOCALE_H |
| 523 | #include <xlocale.h> |
| 524 | #endif |
| 525 | int main() { |
| 526 | locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL); |
| 527 | const char *s = "1.0"; |
| 528 | char *end; |
| 529 | double d = strtod_l(s, end, loc); |
| 530 | float f = strtod_l(s, end, loc); |
| 531 | freelocale(loc); |
| 532 | return 0; |
| 533 | }''', |
| 534 | extra_args : pre_args, |
| 535 | name : 'strtod has locale support') |
| 536 | pre_args += '-DHAVE_STRTOD_L' |
| 537 | endif |
| 538 | |
| 539 | # Check for some linker flags |
| 540 | ld_args_bsymbolic = [] |
Dylan Baker | e21e0a6 | 2017-09-30 13:15:52 -0700 | [diff] [blame] | 541 | if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic') |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 542 | ld_args_bsymbolic += '-Wl,-Bsymbolic' |
| 543 | endif |
| 544 | ld_args_gc_sections = [] |
| 545 | if cc.links('static char unused() { return 5; } int main() { return 0; }', |
Dylan Baker | e21e0a6 | 2017-09-30 13:15:52 -0700 | [diff] [blame] | 546 | args : '-Wl,--gc-sections', name : 'gc-sections') |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 547 | ld_args_gc_sections += '-Wl,--gc-sections' |
| 548 | endif |
Dylan Baker | e21e0a6 | 2017-09-30 13:15:52 -0700 | [diff] [blame] | 549 | with_ld_version_script = false |
| 550 | if cc.links('int main() { return 0; }', |
| 551 | args : '-Wl,--version-script=@0@'.format( |
| 552 | join_paths(meson.source_root(), 'build-support/conftest.map')), |
| 553 | name : 'version-script') |
| 554 | with_ld_version_script = true |
| 555 | endif |
| 556 | with_ld_dynamic_list = false |
| 557 | if cc.links('int main() { return 0; }', |
| 558 | args : '-Wl,--dynamic-list=@0@'.format( |
| 559 | join_paths(meson.source_root(), 'build-support/conftest.dyn')), |
| 560 | name : 'dynamic-list') |
| 561 | with_ld_dynamic_list = true |
| 562 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 563 | |
| 564 | # check for dl support |
| 565 | if cc.has_function('dlopen') |
| 566 | dep_dl = [] |
| 567 | else |
| 568 | dep_dl = cc.find_library('dl') |
| 569 | endif |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 570 | if cc.has_function('dladdr', dependencies : dep_dl) |
| 571 | # This is really only required for megadrivers |
| 572 | pre_args += '-DHAVE_DLADDR' |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 573 | endif |
| 574 | |
| 575 | if cc.has_function('dl_iterate_phdr') |
| 576 | pre_args += '-DHAVE_DL_ITERATE_PHDR' |
| 577 | else |
| 578 | # TODO: this is required for vulkan |
| 579 | endif |
| 580 | |
| 581 | # Determine whether or not the rt library is needed for time functions |
| 582 | if cc.has_function('clock_gettime') |
| 583 | dep_clock = [] |
| 584 | else |
| 585 | dep_clock = cc.find_library('rt') |
| 586 | endif |
| 587 | |
Dylan Baker | 66c94b9 | 2017-09-30 13:48:34 -0700 | [diff] [blame] | 588 | with_gallium_drisw_kms = false |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 589 | dep_libdrm = dependency('libdrm', version : '>= 2.4.75', |
| 590 | required : with_dri2 or with_dri3) |
| 591 | if dep_libdrm.found() |
| 592 | pre_args += '-DHAVE_LIBDRM' |
Dylan Baker | 66c94b9 | 2017-09-30 13:48:34 -0700 | [diff] [blame] | 593 | if with_dri_platform == 'drm' and with_dri |
| 594 | with_gallium_drisw_kms = true |
| 595 | endif |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 596 | endif |
| 597 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 598 | # TODO: some of these may be conditional |
| 599 | dep_zlib = dependency('zlib', version : '>= 1.2.3') |
| 600 | dep_thread = dependency('threads') |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 601 | if dep_thread.found() and host_machine.system() == 'linux' |
| 602 | pre_args += '-DHAVE_PTHREAD' |
| 603 | endif |
Dylan Baker | cc4f587 | 2017-09-27 11:30:21 -0700 | [diff] [blame] | 604 | dep_elf = dependency('libelf', required : false) |
Dylan Baker | b154b44 | 2017-09-30 14:04:28 -0700 | [diff] [blame] | 605 | if not dep_elf.found() and (with_amd_vk or with_gallium_radeonsi) # TODO: clover, r600 |
| 606 | dep_elf = cc.find_library('elf') |
Dylan Baker | cc4f587 | 2017-09-27 11:30:21 -0700 | [diff] [blame] | 607 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 608 | dep_expat = dependency('expat') |
| 609 | # this only exists on linux so either this is linux and it will be found, or |
| 610 | # its not linux and and wont |
| 611 | dep_m = cc.find_library('m', required : false) |
Dylan Baker | 66f97f6 | 2017-09-30 09:03:51 -0700 | [diff] [blame] | 612 | |
| 613 | dep_libdrm_amdgpu = [] |
| 614 | dep_libdrm_radeon = [] |
Dylan Baker | 813b4b0 | 2017-10-09 14:59:35 -0700 | [diff] [blame] | 615 | dep_libdrm_nouveau = [] |
Dylan Baker | 51558a1 | 2017-10-20 15:45:22 -0700 | [diff] [blame] | 616 | dep_libdrm_etnaviv = [] |
Dylan Baker | 66f97f6 | 2017-09-30 09:03:51 -0700 | [diff] [blame] | 617 | if with_amd_vk or with_gallium_radeonsi |
Dylan Baker | 8792a9e | 2017-10-20 16:28:32 -0700 | [diff] [blame] | 618 | dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.85') |
Dylan Baker | 66f97f6 | 2017-09-30 09:03:51 -0700 | [diff] [blame] | 619 | endif |
| 620 | if with_gallium_radeonsi # older radeon too |
| 621 | dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71') |
| 622 | endif |
Dylan Baker | 813b4b0 | 2017-10-09 14:59:35 -0700 | [diff] [blame] | 623 | if with_gallium_nouveau |
| 624 | dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66') |
| 625 | endif |
Dylan Baker | 51558a1 | 2017-10-20 15:45:22 -0700 | [diff] [blame] | 626 | if with_gallium_etnaviv |
| 627 | dep_libdrm_etnaviv = dependency('libdrm_etnaviv', version : '>= 2.4.82') |
| 628 | endif |
Dylan Baker | 673dda8 | 2017-09-20 11:53:29 -0700 | [diff] [blame] | 629 | |
| 630 | llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit'] |
| 631 | if with_amd_vk |
| 632 | llvm_modules += ['amdgpu', 'bitreader', 'ipo'] |
| 633 | endif |
| 634 | dep_llvm = dependency( |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 635 | 'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules, |
Dylan Baker | 673dda8 | 2017-09-20 11:53:29 -0700 | [diff] [blame] | 636 | ) |
Dylan Baker | 02cf3a8 | 2017-10-12 09:47:30 -0700 | [diff] [blame] | 637 | if with_llvm |
| 638 | if dep_llvm.found() |
| 639 | _llvm_version = dep_llvm.version().split('.') |
| 640 | # Development versions of LLVM have an 'svn' suffix, we don't want that for |
| 641 | # our version checks. |
| 642 | _llvm_patch = _llvm_version[2] |
| 643 | if _llvm_patch.endswith('svn') |
| 644 | _llvm_patch = _llvm_patch.split('s')[0] |
| 645 | endif |
| 646 | pre_args += [ |
| 647 | '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch), |
| 648 | '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch), |
| 649 | ] |
| 650 | else |
Dylan Baker | 6a9ad20 | 2017-10-10 14:56:39 -0700 | [diff] [blame] | 651 | if with_gallium_softpipe |
| 652 | error('Cannot find LLVM to build LLVMPipe. If you wanted softpipe pass -Dllvm=false to meson') |
| 653 | elif with_amd_vk or with_gallium_radeonsi # etc |
Dylan Baker | 66f97f6 | 2017-09-30 09:03:51 -0700 | [diff] [blame] | 654 | error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM was not found.') |
Dylan Baker | 02cf3a8 | 2017-10-12 09:47:30 -0700 | [diff] [blame] | 655 | endif |
Dylan Baker | 673dda8 | 2017-09-20 11:53:29 -0700 | [diff] [blame] | 656 | endif |
Dylan Baker | 66f97f6 | 2017-09-30 09:03:51 -0700 | [diff] [blame] | 657 | elif with_amd_vk or with_gallium_radeonsi |
| 658 | error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM is disabled.') |
Dylan Baker | 673dda8 | 2017-09-20 11:53:29 -0700 | [diff] [blame] | 659 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 660 | |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 661 | dep_glvnd = [] |
| 662 | if with_glvnd |
| 663 | dep_glvnd = dependency('libglvnd', version : '>= 0.2.0') |
| 664 | pre_args += '-DUSE_LIBGLVND=1' |
| 665 | endif |
| 666 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 667 | # TODO: make this conditional |
| 668 | dep_valgrind = dependency('valgrind', required : false) |
| 669 | if dep_valgrind.found() and with_valgrind |
| 670 | pre_args += '-DHAVE_VALGRIND' |
| 671 | endif |
| 672 | |
| 673 | # pthread stubs. Lets not and say we didn't |
| 674 | |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 675 | prog_bison = find_program('bison', required : with_any_opengl) |
| 676 | prog_flex = find_program('flex', required : with_any_opengl) |
| 677 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 678 | # TODO: selinux |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 679 | dep_selinux = [] |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 680 | |
| 681 | # TODO: llvm-prefix and llvm-shared-libs |
| 682 | |
Dylan Baker | b1b6539 | 2017-09-28 22:25:02 -0700 | [diff] [blame] | 683 | dep_unwind = dependency('libunwind', required : false) |
| 684 | if dep_unwind.found() |
| 685 | pre_args += '-DHAVE_LIBUNWIND' |
| 686 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 687 | |
| 688 | # TODO: flags for opengl, gles, dri |
| 689 | |
| 690 | # TODO: gallium-hud |
| 691 | |
| 692 | # TODO: glx provider |
| 693 | |
| 694 | # TODO: osmesa provider |
| 695 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 696 | # TODO: symbol mangling |
| 697 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 698 | if with_platform_wayland |
| 699 | prog_wl_scanner = find_program('wayland-scanner') |
| 700 | dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8') |
| 701 | dep_wayland_client = dependency('wayland-client', version : '>=1.11') |
| 702 | dep_wayland_server = dependency('wayland-server', version : '>=1.11') |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 703 | wayland_dmabuf_xml = join_paths( |
| 704 | dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable', |
| 705 | 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml' |
| 706 | ) |
| 707 | pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED'] |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 708 | else |
| 709 | prog_wl_scanner = [] |
| 710 | dep_wl_protocols = [] |
| 711 | dep_wayland_client = [] |
| 712 | dep_wayland_server = [] |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 713 | wayland_dmabuf_xml = '' |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 714 | endif |
| 715 | |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 716 | dep_x11 = [] |
| 717 | dep_xext = [] |
| 718 | dep_xdamage = [] |
| 719 | dep_xfixes = [] |
| 720 | dep_x11_xcb = [] |
| 721 | dep_xcb_glx = [] |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 722 | dep_xcb_dri2 = [] |
| 723 | dep_xcb_dri3 = [] |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 724 | dep_dri2proto = [] |
| 725 | dep_glproto = [] |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 726 | dep_xf86vm = [] |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 727 | dep_xcb_dri3 = [] |
| 728 | dep_xcb_present = [] |
| 729 | dep_xcb_sync = [] |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 730 | dep_xcb_xfixes = [] |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 731 | dep_xshmfence = [] |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 732 | if with_platform_x11 |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 733 | if with_glx == 'dri' and with_dri_platform == 'drm' |
| 734 | dep_x11 = dependency('x11') |
| 735 | dep_xext = dependency('xext') |
| 736 | dep_xdamage = dependency('xdamage', version : '>= 1.1') |
| 737 | dep_xfixes = dependency('xfixes') |
| 738 | dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1') |
Nicholas Miell | 3012885 | 2017-10-17 18:04:16 -0700 | [diff] [blame] | 739 | dep_xf86vm = dependency('xxf86vm', required : false) |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 740 | endif |
| 741 | if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm') |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 742 | dep_xcb = dependency('xcb') |
| 743 | dep_x11_xcb = dependency('x11-xcb') |
| 744 | dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8') |
| 745 | |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 746 | if with_dri3 |
| 747 | pre_args += '-DHAVE_DRI3' |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 748 | dep_xcb_dri3 = dependency('xcb-dri3') |
| 749 | dep_xcb_present = dependency('xcb-present') |
| 750 | dep_xcb_sync = dependency('xcb-sync') |
| 751 | dep_xshmfence = dependency('xshmfence', version : '>= 1.1') |
Dylan Baker | a47c525 | 2017-09-22 12:55:00 -0700 | [diff] [blame] | 752 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 753 | endif |
Dylan Baker | 50c28df | 2017-09-29 17:53:01 -0700 | [diff] [blame] | 754 | if with_glx != 'disabled' |
| 755 | dep_dri2proto = dependency('dri2proto', version : '>= 2.8') |
| 756 | dep_glproto = dependency('glproto', version : '>= 1.4.14') |
| 757 | endif |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 758 | if with_egl |
| 759 | dep_xcb_xfixes = dependency('xcb-xfixes') |
| 760 | endif |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 761 | endif |
| 762 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 763 | # TODO: osmesa |
| 764 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 765 | # TODO: vallium G3DVL |
| 766 | |
| 767 | # TODO: nine |
| 768 | |
| 769 | # TODO: clover |
| 770 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 771 | # TODO: gallium tests |
| 772 | |
| 773 | # TODO: various libdirs |
| 774 | |
| 775 | # TODO: swr |
| 776 | |
| 777 | # TODO: gallium driver dirs |
| 778 | |
| 779 | # FIXME: this is a workaround for #2326 |
| 780 | prog_touch = find_program('touch') |
| 781 | dummy_cpp = custom_target( |
| 782 | 'dummy_cpp', |
| 783 | output : 'dummy.cpp', |
| 784 | command : [prog_touch, '@OUTPUT@'], |
| 785 | ) |
| 786 | |
| 787 | foreach a : pre_args |
| 788 | add_project_arguments(a, language : ['c', 'cpp']) |
| 789 | endforeach |
| 790 | foreach a : c_args |
| 791 | add_project_arguments(a, language : ['c']) |
| 792 | endforeach |
| 793 | foreach a : cpp_args |
| 794 | add_project_arguments(a, language : ['cpp']) |
| 795 | endforeach |
| 796 | |
| 797 | inc_include = include_directories('include') |
| 798 | |
Dylan Baker | 108d257 | 2017-10-18 12:20:43 -0700 | [diff] [blame] | 799 | gl_priv_reqs = [ |
| 800 | 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb', |
| 801 | 'xcb-glx >= 1.8.1', 'libdrm >= 2.4.75', |
| 802 | ] |
| 803 | if dep_xf86vm != [] and dep_xf86vm.found() |
| 804 | gl_priv_reqs += 'xf86vm' |
| 805 | endif |
| 806 | if with_dri_platform == 'drm' |
| 807 | gl_priv_reqs += 'xcb-dri2 >= 1.8' |
| 808 | endif |
| 809 | |
| 810 | gl_priv_libs = [] |
| 811 | if dep_thread.found() |
| 812 | gl_priv_libs += ['-lpthread', '-pthread'] |
| 813 | endif |
| 814 | if dep_m.found() |
| 815 | gl_priv_libs += '-lm' |
| 816 | endif |
| 817 | if dep_dl.found() |
| 818 | gl_priv_libs += '-ldl' |
| 819 | endif |
| 820 | |
Dylan Baker | 3218056 | 2017-09-20 20:11:32 -0700 | [diff] [blame] | 821 | pkg = import('pkgconfig') |
| 822 | |
Dylan Baker | d199225 | 2017-09-14 17:57:17 -0700 | [diff] [blame] | 823 | subdir('include') |
| 824 | subdir('src') |