From d32144602c1dfd507f07774ce906dc25d2697da0 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 14 May 2018 16:40:47 +0100 Subject: [PATCH] meson: remove "empty array"/"array of an empty string" confusion Until Meson 0.47, setting `-D arrayoption=` was not the same as setting `-D arrayoption=[]`; the latter cleared the array, while the former filled it with an empty string option. Since Meson 0.47 [1], the former maps to the latter, so empty items can only be set by explicitly giving an array containing an empty string, ie. `-D arrayoption="['']"`; however note that this is *not* what we want in any of the current Mesa code anyway. This makes the code handling array options a bit more complicated, and a lot more error-prone, so let's get rid of the confusion by removing the empty-string option. [1] https://github.com/mesonbuild/meson/commit/f3a8f9c34d95d862fb4d12869a7b31cea592561f Signed-off-by: Eric Engestrom Reviewed-by: Dylan Baker Part-of: --- meson.build | 20 +++++++------------- meson_options.txt | 8 ++++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/meson.build b/meson.build index 8d89bf9781ef6..1932410fcf7d3 100644 --- a/meson.build +++ b/meson.build @@ -181,7 +181,7 @@ with_dri_r200 = dri_drivers.contains('r200') with_dri_nouveau = dri_drivers.contains('nouveau') with_dri_swrast = dri_drivers.contains('swrast') -with_dri = dri_drivers.length() != 0 and dri_drivers != [''] +with_dri = dri_drivers.length() != 0 gallium_drivers = get_option('gallium-drivers') if gallium_drivers.contains('auto') @@ -228,7 +228,7 @@ with_gallium_swr = gallium_drivers.contains('swr') with_gallium_lima = gallium_drivers.contains('lima') with_gallium_zink = gallium_drivers.contains('zink') -with_gallium = gallium_drivers.length() != 0 and gallium_drivers != [''] +with_gallium = gallium_drivers.length() != 0 if with_gallium and system_has_kms_drm _glx = get_option('glx') @@ -261,7 +261,7 @@ endif with_intel_vk = _vulkan_drivers.contains('intel') with_amd_vk = _vulkan_drivers.contains('amd') with_freedreno_vk = _vulkan_drivers.contains('freedreno') -with_any_vk = _vulkan_drivers.length() != 0 and _vulkan_drivers != [''] +with_any_vk = _vulkan_drivers.length() != 0 if with_dri_swrast and (with_gallium_softpipe or with_gallium_swr) error('Only one swrast provider can be built') @@ -314,13 +314,7 @@ with_platform_haiku = _platforms.contains('haiku') with_platform_surfaceless = _platforms.contains('surfaceless') with_platform_windows = _platforms.contains('windows') -with_platforms = false -if _platforms.length() != 0 and _platforms != [''] - # sanity check that list contains no empty strings - if _platforms.contains('') - error('Invalid argument list given to -Dplatforms, please fix.') - endif - with_platforms = true +if _platforms.length() != 0 egl_native_platform = _platforms[0] endif @@ -399,14 +393,14 @@ endif if _egl == 'auto' with_egl = ( not ['darwin', 'windows'].contains(host_machine.system()) and - with_dri and with_shared_glapi and with_platforms + with_dri and with_shared_glapi and _platforms.length() != 0 ) elif _egl == 'enabled' if not with_dri error('EGL requires dri') elif not with_shared_glapi error('EGL requires shared-glapi') - elif not with_platforms + elif _platforms.length() == 0 error('No platforms specified, consider -Dplatforms=drm,x11,surfaceless at least') elif not ['disabled', 'dri'].contains(with_glx) error('EGL requires dri, but a GLX is being built without dri') @@ -1898,7 +1892,7 @@ if with_egl lines += 'EGL drivers: ' + ' '.join(egl_drivers) endif lines += 'GBM: ' + (with_gbm ? 'yes' : 'no') -if with_platforms +if _platforms.length() != 0 lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms) endif diff --git a/meson_options.txt b/meson_options.txt index 464b99286ee44..913dd49744970 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -23,7 +23,7 @@ option( type : 'array', value : ['auto'], choices : [ - '', 'auto', 'x11', 'wayland', 'drm', 'surfaceless', 'haiku', 'android', + 'auto', 'x11', 'wayland', 'drm', 'surfaceless', 'haiku', 'android', 'windows', ], description : 'window systems to support. If this is set to `auto`, all platforms applicable will be enabled.' @@ -39,7 +39,7 @@ option( 'dri-drivers', type : 'array', value : ['auto'], - choices : ['', 'auto', 'i915', 'i965', 'r100', 'r200', 'nouveau', 'swrast'], + choices : ['auto', 'i915', 'i965', 'r100', 'r200', 'nouveau', 'swrast'], description : 'List of dri drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built' ) option( @@ -59,7 +59,7 @@ option( type : 'array', value : ['auto'], choices : [ - '', 'auto', 'kmsro', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno', + 'auto', 'kmsro', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno', 'swrast', 'v3d', 'vc4', 'etnaviv', 'tegra', 'i915', 'svga', 'virgl', 'swr', 'panfrost', 'iris', 'lima', 'zink' ], @@ -159,7 +159,7 @@ option( 'vulkan-drivers', type : 'array', value : ['auto'], - choices : ['', 'auto', 'amd', 'freedreno', 'intel'], + choices : ['auto', 'amd', 'freedreno', 'intel'], description : 'List of vulkan drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built' ) option(