This is the common Python convention for private methods
so lets not expose these to build files as they are
implementation details and their behavior is undefined.
We should only silently return from a dependency() call if the error is
transient (old version, wrap failed to download etc), not if the
subproject invocation or dependency name are incorrect.
For instance, if you use a dependency(..., fallback : ...) call in
a meson.build not in the root directory, we would always ignore the
call instead of erroring out due to invalid usage.
We should consider categorising our exceptions in this manner elsewhere
too.
If first checking for a dependency as not-required, and then later
checking for the same dependency again as required, we would not
error out saying the dependency is missing, but just silently
re-use the cached dependency object from the first check and then
likely fail at build time if the dependency is not actually there.
With test case.
Fixes#964.
Seems better to do this since the behaviour is compiler-specific. Would
be easier to extend this later too in case we want to do more
compiler-specific things.
The error message is misleading (talks about external dependencies), and
doesn't tell you what you need to do (use the output of
declare_dependency, dependency, or find_library). At the same time
rename add_external_deps to add_deps since it adds internal deps too.
Plus many more error message improvements all over the place.
Not only does extract_all_objects() now work properly again,
extract_objects() also works if you specify a subset of sources all of
which have been compiled into a single unified object.
So, for instance, this allows you to extract all the objects
corresponding to the C sources compiled into a target consisting of
C and C++ sources.
If a fallback dependency is not found just return None. The
caller can then raise the exception it already has if
required=True, or just continue on if required=False.
In the case the main project set a subproject for a dependency another
subprojects uses, that other subproject should rather use the first
subproject rather that using native dependency.
For example in gst-all we set all GStreamer modules as subprojects
and, gst-plugins-base is set after gstreamer core, and
we want gst-plugins-base to always use GStreamer core from the subproject
and not the possibly avalaible native one.
And remove the InternalDependencyHolder class.
In some cases we need to know the type of dependency we are
dealing with. For example in GStreamer if the dependency
is not an internal one, then we need to get some env var
from pkg-config to know where to find some plugins necessary
to run some tests.
Reuse the standard evaluate_codeblock() parsing since it does proper
error handling, and also handles, for instance, lists in string
arguments (flatten), etc. properly.
We need to declare more variables in advance now, but that should be ok.
It is extremely common to need to know within a given dependency if
a given header, symbol, member, function, etc exists that cannot be
determined from the version number alone.
Without passing dependency objects to the various compiler/linker
checks and with many libraries headers/libraries being located in
their own subdirs of the standard prefix, the check for the library
would not find the header/function/symbol/etc.
This commit allows passing dependency objects to the compiler checks so
that the test program can be compiled/linked/run with the necessary
compilation and/or linking flags for that library.
It's a terrible user experience to force people building 32-bit
applications on 64-bit Windows to use a cross-info file when every other
tool treats it as a 'native' compilation -- it satisfies all the
requirements for a native compile.
This commit also fixes the platform detection on Windows which would
cause the 'native cpu' to be detected as 32-bit if you installed 32-bit
Python on 64-bit Windows, or if you were building with a 32-bit
toolchain on 64-bit Windows.
Doesn't support MinGW yet -- the next commits will add that since the
changes required for that are more involved.
Add support for passing a description to configuration data
setter methods via a 'description' kwarg. The description
string will be used when meson generates the entire configure
file without a template, autoconf-style.
Having support for the '%' operator makes it easier to implement
even/odd version checks, like:
enable_debug = get_option('enable-debug')
if enable_debug == 'auto'
if minor_version % 2 == 0
enable_debug = 'minimum'
else
enable_debug = 'yes'
endif
endif
which would be impossible without resorting to less obvious long-hand
forms like:
a - (b * (a / b))
* Add a new compiler object method: has_members
Identical to 'cc.has_member', except that this takes multiple members
and all of them must exist else it returns false.
This is useful when you want to verify that a structure has all of
a given set of fields. Individually checking each member is horrifying.
* Fix typo in exceptions for has_member(s)
D allows programmers to define their tests alongside the actual code in
a unittest scope[1].
When compiled with a special flag, the compiler will build a binary
containing the tests instead of the actual application.
This is a strightforward and easy way to run tests and works well with
Mesons test() command.
Since using just one flag name to enable unittest mode would be too
boring, compiler developers invented multiple ones.
Adding this helper method makes it easy for people writing Meson build
descriptions for D projects to enable unittestmode.
[1]: https://dlang.org/spec/unittest.html