Rather than group dependencies in complex groups, use a flatter
structure with split dependencies to avoid checking for the same
dependencies twice.
v2: - Fix building vulkan drivers without gallium or dri drivers
v3: - Drop TODO comment that is done
- Fix typo in commit message
Signed-off-by: Dylan Baker
---
meson.build| 196 ++---
src/loader/meson.build | 5 +-
src/vulkan/wsi/meson.build | 10 ++-
3 files changed, 108 insertions(+), 103 deletions(-)
diff --git a/meson.build b/meson.build
index 240c868675b..fecb5dbac81 100644
--- a/meson.build
+++ b/meson.build
@@ -116,27 +116,6 @@ endif
# TODO: other OSes
with_dri_platform = 'drm'
-# TODO: conditionalize libdrm requirement
-dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
-pre_args += '-DHAVE_LIBDRM'
-
-with_dri2 = with_dri_platform == 'drm' and dep_libdrm.found()
-with_dri3 = get_option('dri3')
-if with_dri3 == 'auto'
- if host_machine.system() == 'linux' and with_dri2
-with_dri3 = true
- else
-with_dri3 = false
- endif
-elif with_dri3 == 'yes'
- if not with_dri2
-error('dri3 support requires libdrm')
- endif
- with_dri3 = true
-else
- with_dri3 = false
-endif
-
# TODO: there are more platforms required for non-vulkan drivers
with_platform_wayland = false
with_platform_x11 = false
@@ -211,17 +190,69 @@ if _vulkan_drivers != ''
if not (with_platform_x11 or with_platform_wayland)
error('Vulkan requires at least one platform (x11, wayland)')
endif
- if with_platform_x11 and not with_dri3
-error('Vulkan drivers require dri3 for X11 support')
- endif
endif
+with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
+with_dri3 = get_option('dri3')
+if with_dri3 == 'auto'
+ if host_machine.system() == 'linux' and with_dri2
+with_dri3 = true
+ else
+with_dri3 = false
+ endif
+elif with_dri3 == 'yes'
+ with_dri3 = true
+else
+ with_dri3 = false
+endif
+
+if with_any_vk and (with_platform_x11 and not with_dri3)
+ error('Vulkan drivers require dri3 for X11 support')
+endif
if with_dri or with_gallium
if with_glx == 'disabled' # TODO: or egl
error('building dri or gallium drivers require at least one window system')
endif
endif
+with_gallium_xvmc = false
+with_gallium_vdpau = false
+with_gallium_omx = false # this is bellagio
+with_gallium_va = false
+with_gallium_media = false
+dep_va = []
+_drivers = get_option('gallium-media')
+if _drivers != ''
+ _split = _drivers.split(',')
+ with_gallium_xvmc = _split.contains('xvmc')
+ with_gallium_vdpau = _split.contains('vdpau')
+ with_gallium_omx = _split.contains('omx')
+ with_gallium_va = _split.contains('va')
+ with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or
+with_gallium_omx or with_gallium_va)
+endif
+
+if with_platform_x11
+ if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
+pre_args += '-DHAVE_X11_PLATFORM'
+ endif
+ if with_glx == 'xlib'
+# TODO
+error('TODO')
+ elif with_glx == 'gallium-xlib'
+# TODO
+error('TODO')
+ else
+pre_args += '-DGLX_INDIRECT_RENDERING'
+if with_glx_direct
+ pre_args += '-DGLX_DIRECT_RENDERING'
+endif
+if with_dri_platform == 'drm'
+ pre_args += '-DGLX_USE_DRM'
+endif
+ endif
+endif
+
prog_python2 = find_program('python2')
has_mako = run_command(prog_python2, '-c', 'import mako')
if has_mako.returncode() != 0
@@ -491,10 +522,18 @@ else
dep_clock = cc.find_library('rt')
endif
+dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
+required : with_dri2 or with_dri3)
+if dep_libdrm.found()
+ pre_args += '-DHAVE_LIBDRM'
+endif
+
# TODO: some of these may be conditional
dep_zlib = dependency('zlib', version : '>= 1.2.3')
dep_thread = dependency('threads')
-pre_args += '-DHAVE_PTHREAD'
+if dep_thread.found() and host_machine.system() == 'linux'
+ pre_args += '-DHAVE_PTHREAD'
+endif
dep_elf = dependency('libelf', required : false)
if not dep_elf.found()
dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover,
r600, radeonsi
@@ -503,18 +542,14 @@ dep_expat = dependency('expat')
# this only exists on linux so either this is linux and it will be found, or
# its not linux and and wont
dep_m = cc.find_library('m', required : false)
-
-dep_libdrm_amdgpu = []
-if with_amd_vk
- dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82')
-endif
+dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82',
required : with_amd_vk)
llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
if with_amd_vk
llvm_modules += ['amdgpu', 'bitreader', 'ipo']
endif
dep_llvm = dependency(
- 'llvm', version : '>= 3.9.0', required : false, modules : llvm_modules,
+ 'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules,
)
if with_llvm
if dep_llvm.found()
@@ -589,63 +624,47 @@ else
dep_wayland_server = []