From 4f25b84b2460524d375424a81b42faa4d99c8e60 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 20 Nov 2023 15:08:26 +0000 Subject: [PATCH] meson: turn `glvnd` option into a feature Makes for nicer code, and allows the next commit. Part-of: --- .gitlab-ci/build/gitlab-ci.yml | 6 +++--- docs/drivers/svga3d.rst | 2 +- meson.build | 24 +++++++++++------------- meson_options.txt | 5 +++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml index 2050f63d141b6..bf2c14c4c5842 100644 --- a/.gitlab-ci/build/gitlab-ci.yml +++ b/.gitlab-ci/build/gitlab-ci.yml @@ -265,7 +265,7 @@ alpine-build-testing: -D glx=disabled -D gbm=enabled -D egl=enabled - -D glvnd=false + -D glvnd=disabled -D platforms=wayland LLVM_VERSION: "16" GALLIUM_DRIVERS: "crocus,etnaviv,freedreno,iris,kmsro,lima,nouveau,panfrost,r300,r600,radeonsi,svga,swrast,tegra,v3d,vc4,virgl,zink" @@ -305,7 +305,7 @@ fedora-release: -D glx=dri -D gbm=enabled -D egl=enabled - -D glvnd=true + -D glvnd=enabled -D platforms=x11,wayland EXTRA_OPTION: > -D b_lto=true @@ -540,7 +540,7 @@ debian-clang: -D glx=dri -D gbm=enabled -D egl=enabled - -D glvnd=true + -D glvnd=enabled -D platforms=x11,wayland GALLIUM_ST: > -D dri3=enabled diff --git a/docs/drivers/svga3d.rst b/docs/drivers/svga3d.rst index 605802844ef84..14c278ab6ed64 100644 --- a/docs/drivers/svga3d.rst +++ b/docs/drivers/svga3d.rst @@ -122,7 +122,7 @@ Building the Code :: cd $TOP/mesa - meson builddir -Dvulkan-drivers= -Dgallium-drivers=svga -Ddri-drivers= -Dglvnd=true -Dglvnd-vendor-name=mesa + meson builddir -Dvulkan-drivers= -Dgallium-drivers=svga -Ddri-drivers= -Dglvnd=enabled -Dglvnd-vendor-name=mesa meson compile -C builddir sudo meson install -C builddir diff --git a/meson.build b/meson.build index 8d928f5cddc54..7d70033d835f7 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/meson_options.txt b/meson_options.txt index caa6004e95650..8a7636ce64b37 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -361,8 +361,9 @@ option( option( 'glvnd', - type : 'boolean', - value : false, + type : 'feature', + value : 'disabled', + deprecated: {'true': 'enabled', 'false': 'disabled'}, description : 'Enable GLVND support.' )