We accept a list of known kwargs of required types, but also arbitrary
kwargs understood by the hotdoc program (sometimes via extensions). Now
that we can partially type-check kwargs, do so here.
Some functions cannot be fully type checked, because our API allows
fully arbitrary kwargs and treats them as data to pass through to the
underlying feature. For example, hotdoc command line arguments.
This change allows us to type check some kwargs with known types and
possibly required status, and make their values consistent(ly defaultable),
while preserving the optional nature of the additional kwargs.
If those files are not yet known to be typed, skip them. This makes it
possible to trivially check a shortlist of files that were just changed
and see if they regress our mypy coverage. Ideal for use in a git
pre-commit hook.
Since vs backend only support the C compiler, everything else are custom
targets. Convert CompileTarget into a Generator to reuse existing code.
This will be useful in the future to support transpilers, and
assemblers.
This introduce a new type of BuildTarget: CompileTarget. From ninja
backend POV it is the same thing as any other build target, except that
it skips the final link step. It could be used in the future for
transpilers too.
When using both_libraries(), or library() with default_library=both, we
remove all sources from args and kwargs when building the static
library, and replace them by the objects from the shared library. But
sources could also come from any InternalDependency, in which case we
currently build them twice (not efficient) and link both objects into
the static library.
It also means that when we needlessly build those source for the static
library, it miss order dependency on generated headers that we removed
from args/kwargs, which can cause build errors in the case the source
from static lib is compiled before the header in shared lib gets
generated.
This happened in GLib:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917.
cc.compiles(), and other compiler checks that use cc.compiles() under
the hood, do not use link args at all when doing the compile check, so
messages like this:
```
Checking if "have zlib" with dependency -lz compiles: YES
```
is very misleading. The compiler check command-line for that is:
```
cc [...]/testfile.c -o [...]/output.obj -c -D_FILE_OFFSET_BITS=64 -O0
```
Note the lack of linker args.
If we update e.g. glib.wrap from wrap-git with directory=glib to
wrap-file with directory=glib-2.70 we could still have the glib
directory that is not referenced by any .wrap file any more. We should
still ignore that directory otherwise it overrides the glib.wrap we
parsed.
When _subproject_impl() is called the wrap file could not have been
downloaded form wrapdb yet, it is done when fetching the subproject.
Delay getting the variable name to when we actually need it, at that
point we are sure the wrap file has been downloaded.
Download wrap file from wrapdb automatically when it is not found
locally but we have it in wrapdb.json.
This makes for example `dependency('glib-2.0')` work out of the box
simply by running `meson wrap update-db`, even if the project does not
provide any wraps.
First, check if the env program exists. If it does, it is faster than
doing it via a python script `basically-env.py` that maybe imports all
of mesonbuild.* as a side effect of project structure.
We do not, however, use env for setting up PATH additions, since env can
override an environment variable but not extend it. So in that case we
still need to wrap the command via python.
By default, all run_targets (at least) are wrapped and now wrap via the
`env` program as they export e.g.
MESONINTROSPECT='/usr/bin/meson introspect'
https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0`
to pass `-O0` to the compiler. This change is reasonable by itself
but unfortunately, it breaks `buildtype=plain`, which promises
that “no extra build flags are used”.
`buildtype=plain` is important for distros like NixOS,
which manage compiler flags for optimization and hardening
themselves.
Let’s introduce a new optimization level that does nothing
and set it as the default for `buildtype=plain`.
- this fixes#10792
- Qt6EntryPoint(d) replaces qtmain(d) from Qt 4 & 5
- uses the same mechanism: `main: true`
- uses a special mixin class for pkg-config and config-tool dependency calculation
This catches some optimization problems, mostly in the use of `all()`
and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5
for x in f)` reduces the performance because the entire concrete list
must first be created, then iterated over, while in the second f is
iterated and checked element by element.