It is much easier to not try to parse options into complicated
structures until we actually collected all options: machine files,
command line, project()'s default_options, environment.
- Log the message before raising the exception.
- Add a reason when the dependency is not found because the subproject
failed to configure, because it was not obvious in the case the
subproject failed to configure earlier while looking for an optional
dependency.
- Avoid double message when the subproject has overriden the dependency
and we provided the fallback variable as well.
wraps from subprojects are now merged into the list of wraps from main
project, so they can be used to download dependencies of dependencies
instead of having to promote wraps manually. If multiple projects
provides the same wrap file, the first one to be configured wins.
This also fix usage of sub-subproject that don't have wrap files. We can
now configure B when its source tree is at
`subprojects/A/subprojects/B/`. This has the implication that we cannot
assume that subproject "foo" is at `self.subproject_dir / 'foo'` any
more.
dirname is confusing because the name of a subproject does not always
match its directory name, the wrap file can define another directory.
For example foo.wrap will often extract the subproject into foo-1.2
directory, in that case the subproject name is 'foo' and the subproject
directory is 'foo-1.2'.
You could always specify a list of tests to run by passing the names as
arguments to `meson test`. If there were multiple tests with that name (in the
same project or different subprojects), all of them would be run. Now you can:
1. Run all tests with the specified name from a specific subproject: `meson test subprojname:testname`
1. Run all tests defined in a specific subproject: `meson test subprojectname:`
Also forbid ':' in test names. We already forbid this elsewhere, so
should not be a big deal.
Sometimes, distros want to configure a project so that it does not
use any bundled library. In this case, meson.build might want
to do something like this, where slirp is a combo option
with values auto/system/internal:
slirp = dependency('', required: false)
if get_option('slirp') != 'internal'
slirp = dependency('slirp',
required: get_option('slirp') == 'system')
endif
if not slirp.found()
slirp = subproject('libslirp', ...) .variable('...')
endif
and we cannot use "fallback" because the "system" value should never
look for a subproject.
This worked until 0.54.x, but in 0.55.x this breaks because of the
automatic subproject search. Note that the desired effect here is
backwards compared to the policy of doing an automatic search on
"required: true"; we only want to do the search if "required" is false!
It would be possible to look for the dependency with `required: false`
and issue the error manually, but it's ugly and it may produce an error
message that looks "different" from Meson's.
Instead, with this change it is possible to achieve this effect in an
even simpler way:
slirp = dependency('slirp',
required: get_option('slirp') != 'auto',
allow_fallback: get_option('slirp') == 'system' ? false : ['slirp', 'libslirp_dep'])
The patch also adds support for "allow_fallback: true", which is
simple and enables automatic fallback to a wrap even for non-required
dependencies.
Force_fallback is not an interpreter keyword argument, and there
is no reason to handle it as one since it is not used anywhere
else (and in fact is explicitly ignored by get_dep_identifier).
Use a Python keyword argument instead, which makes the code
simpler.
Automatic fallback to subprojects is complicated and should be
pointed out outside the "fallback" keyword argument. It is also
surprising that fallback to a subproject will not happen if
override_dependency has already been used with the request
dependency. Document all this.
Just saying "it failed" is accurate, but not useful to helping someone
figure out why it failed. Giving them the stdout and stderr (like we
might with compilers) should help people resolve the issue.
Fixes: #7173
Currently if you change the `choices` field in the meson_options.txt
file, no update will be done until `meson setup --wipe` is called. Now
if the choices change then the options will be properly merged.
If the currently select value is still valid it is guaranteed to be
kept, if it is now invalid the new default value will be used and a
warning will be printed.
Fixes#7386
`pathlib.Path.glob()` also returns directories that match source
filenames (i.e. a directory named `test.h/`), but `clang-format` and
`clang-tidy` fail when handed a directory. We manually skip calling
`clang-format` and `clang-tidy` on those directories.
This is required to make the various keys in the [user options] section
work the same as they do in the meson_options.txt file, where we don't
have any rules about case sensitivity.
There is some risk here. Someone may be relying on this lower by default
behavior, and this could break their machine files.
Fixes#7731
Projects that specify b_pie=true clutter build logs with the warning:
clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
No option is needed to produce PIE binaries because ld64 is making PIE
executables on 10.7 and above by default, as documented in ld(1).
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>