On Friday, 2018-05-11 08:48:34 -0700, Dylan Baker wrote:
> Quoting Eric Engestrom (2018-05-11 07:12:27)
> > Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
> > Signed-off-by: Eric Engestrom <eric.engest...@intel.com>
> > ---
> >  meson.build | 73 +++++++++++++++++++++++------------------------------
> >  1 file changed, 32 insertions(+), 41 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index afebfd2c65fdb22dae29..6b069ae5dfc52adba1b7 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -123,23 +123,6 @@ with_dri = (with_dri_i915 or with_dri_i965 or
> >             with_dri_r100 or with_dri_r200 or
> >             with_dri_nouveau or with_dri_swrast)
> >  
> > -with_gallium = false
> > -with_gallium_pl111 = false
> > -with_gallium_radeonsi = false
> > -with_gallium_r300 = false
> > -with_gallium_r600 = false
> > -with_gallium_nouveau = false
> > -with_gallium_freedreno = false
> > -with_gallium_softpipe = false
> > -with_gallium_vc4 = false
> > -with_gallium_vc5 = false
> > -with_gallium_etnaviv = false
> > -with_gallium_imx = false
> > -with_gallium_tegra = false
> > -with_gallium_i915 = false
> > -with_gallium_svga = false
> > -with_gallium_virgl = false
> > -with_gallium_swr = false
> >  _drivers = get_option('gallium-drivers')
> >  if _drivers.contains('auto')
> >    if system_has_kms_drm
> > @@ -162,30 +145,38 @@ if _drivers.contains('auto')
> >      error('Unknown OS. Please pass -Dgallium-drivers to set driver 
> > options. Patches gladly accepted to fix this.')
> >    endif
> >  endif
> > -if _drivers != ['']
> > -  with_gallium_pl111 = _drivers.contains('pl111')
> > -  with_gallium_radeonsi = _drivers.contains('radeonsi')
> > -  with_gallium_r300 = _drivers.contains('r300')
> > -  with_gallium_r600 = _drivers.contains('r600')
> > -  with_gallium_nouveau = _drivers.contains('nouveau')
> > -  with_gallium_freedreno = _drivers.contains('freedreno')
> > -  with_gallium_softpipe = _drivers.contains('swrast')
> > -  with_gallium_vc4 = _drivers.contains('vc4')
> > -  with_gallium_vc5 = _drivers.contains('vc5')
> > -  with_gallium_etnaviv = _drivers.contains('etnaviv')
> > -  with_gallium_imx = _drivers.contains('imx')
> > -  with_gallium_tegra = _drivers.contains('tegra')
> > -  with_gallium_i915 = _drivers.contains('i915')
> > -  with_gallium_svga = _drivers.contains('svga')
> > -  with_gallium_virgl = _drivers.contains('virgl')
> > -  with_gallium_swr = _drivers.contains('swr')
> > -  with_gallium = true
> > -  if system_has_kms_drm
> > -    _glx = get_option('glx')
> > -    _egl = get_option('egl')
> > -    if _glx == 'dri' or _egl == 'true' or (_glx == 'disabled' and _egl != 
> > 'false')
> > -      with_dri = true
> > -    endif
> > +
> > +with_gallium_pl111 = _drivers.contains('pl111')
> > +with_gallium_radeonsi = _drivers.contains('radeonsi')
> > +with_gallium_r300 = _drivers.contains('r300')
> > +with_gallium_r600 = _drivers.contains('r600')
> > +with_gallium_nouveau = _drivers.contains('nouveau')
> > +with_gallium_freedreno = _drivers.contains('freedreno')
> > +with_gallium_softpipe = _drivers.contains('swrast')
> > +with_gallium_vc4 = _drivers.contains('vc4')
> > +with_gallium_vc5 = _drivers.contains('vc5')
> > +with_gallium_etnaviv = _drivers.contains('etnaviv')
> > +with_gallium_imx = _drivers.contains('imx')
> > +with_gallium_tegra = _drivers.contains('tegra')
> > +with_gallium_i915 = _drivers.contains('i915')
> > +with_gallium_svga = _drivers.contains('svga')
> > +with_gallium_virgl = _drivers.contains('virgl')
> > +with_gallium_swr = _drivers.contains('swr')
> > +
> > +with_gallium = (with_gallium_pl111 or with_gallium_radeonsi or
> > +                with_gallium_r300 or with_gallium_r600 or
> > +                with_gallium_nouveau or with_gallium_freedreno or
> > +                with_gallium_softpipe or with_gallium_vc4 or
> > +                with_gallium_vc5 or with_gallium_etnaviv or
> > +                with_gallium_imx or with_gallium_tegra or
> > +                with_gallium_i915 or with_gallium_svga or
> > +                with_gallium_virgl or with_gallium_swr)
> 
> This could be simplified to this, right?
>     with_gallium = _drivers != ['']

No, because `gallium-drivers=[]` would match as `with_gallium` :/
I suppose I could just add both cases to the check though?

What I don't like about it is that there could be unhandled cases there,
but now that we're using array options, at least 'random/typo'd string'
is no longer an issue; I guess we can assume that any name allowed in
meson_options.txt is gonna be handled in meson.build as well.

Should I do that in v2?  `!=[] && !=['']` ?
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to