meson: turn glvnd option into a feature

Makes for nicer code, and allows the next commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26367>
This commit is contained in:
Eric Engestrom
2023-11-20 15:08:26 +00:00
committed by Marge Bot
parent 3a4a16e9e8
commit 4f25b84b24
4 changed files with 18 additions and 19 deletions

View File

@@ -543,20 +543,18 @@ if with_glx != 'disabled'
endif
endif
dep_glvnd = null_dep
with_glvnd = get_option('glvnd')
_glvnd = get_option('glvnd') \
.require(not with_platform_windows,
error_message: 'glvnd cannot be used on Windows') \
.require(with_glx != 'xlib',
error_message: 'Cannot build glvnd support for GLX that is not DRI based.') \
.require(with_glx != 'disabled' or with_egl,
error_message: 'glvnd requires DRI based GLX and/or EGL') \
.require(get_option('egl-lib-suffix') == '',
error_message: '''EGL lib suffix can't be used with libglvnd''')
dep_glvnd = dependency('libglvnd', version : '>= 1.3.2', required : _glvnd)
with_glvnd = dep_glvnd.found()
if with_glvnd
if with_platform_windows
error('glvnd cannot be used on Windows')
elif with_glx == 'xlib'
error('Cannot build glvnd support for GLX that is not DRI based.')
elif with_glx == 'disabled' and not with_egl
error('glvnd requires DRI based GLX and/or EGL')
endif
if get_option('egl-lib-suffix') != ''
error('''EGL lib suffix can't be used with libglvnd''')
endif
dep_glvnd = dependency('libglvnd', version : '>= 1.3.2')
pre_args += '-DUSE_LIBGLVND=1'
endif
glvnd_vendor_name = get_option('glvnd-vendor-name')