On Thu, Mar 29, 2018 at 09:31:13AM -0700, Dylan Baker wrote:
> In the old days (0.42.x), when mesa's meson system was written the
> recommendation for handling conditional dependencies was to define them
> as empty lists. When meson would evaluate the dependencies of a target
> it would recursively flatten all of the arguments, and empty lists would
> be removed. There are some problems with this, among them that lists and
> dependencies have different methods (namely .found()), so the
> recommendation changed to use `declare_dependency()` for such cases.
> This has the advantage of providing a .found() method, so there is no
> need to do things like `dep_foo != [] and dep_foo.found()`.

What about using dependency('', required: false) instead?

http://mesonbuild.com/Reference-manual.html#dependency

    If dependency_name is '', the dependency is always not found. So
    with required: false, this always returns a dependency object for
    which the found() method returns false, and which can be passed
    like any other dependency to the dependencies: keyword argument of
    a build_target. This can be used to implement a dependency which
    is sometimes not required e.g. in some branches of a conditional.

Maybe even having a variable named notfound (or optional, or something
similar) with such dependency, and assign it to the other variables.

From reading the docs for declare_dependency() it doesn't really
guarantee that found() would be false, while the approach above is
documented as what we want.


Thanks,
Caio
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to