There was both a straight up bug in the type signature (the return type
is List[Callable[[], Dependency]] not List[Type[Dependency]]), and in
the way the arguments are assembled. Typing is pretty limited in it's
ability to express decorators, so the best mypy can do is check the
return types (I think). I've done what the docs suggest and it's stopped
complaining.
extra_paths only matter for the host machine if using an exe_wrapper.
However, because CustomTarget.for_machine is always MachineChoice.HOST,
they were computed unnecessarily in as_meson_exe_cmdline.
Defer computation of extra_paths until after we have found out if the
custom target executable is really for the host or the build machine,
so that we can use exe_for_machine; for_machine then becomes unused
and can be removed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This matches `meson test`, and there's really no other meaning that
could be attributed to this, since you would call `meson` to get the
version, not the `compile` sub-command.
The -Doption=value style argument works for all builtin options,
and compiler options passed to meson. And some universal options,
have additional ways to be passed. However, base options (and compiler
options) do not have exactly the same ways of passing as universal
options.
This change adds a few pieces of information, which might get lost,
if the manual is not read serially.
[skip ci]
This removes the check for "mingw" for platform.system(). The only case I know
where "mingw" is return is if using a msys Python under a msys2 mingw environment.
This combination is not really supported by meson and will result in weird errors,
so remove the check.
The second change is checking sys.platform for cygwin instead of platform.system().
The former is document to return "cygwin", while the latter is not and just
returns uname().
While under Cygwin it uname() always starts with "cygwin" it's not hardcoded in MSYS2
and starts with the environment name. Using sys.platform is safer here.
Fixes#7552
This type happened in https://github.com/mesonbuild/meson/pull/7432
and wasn't noticed because I didn't add a test for it. Rectified now.
If we don't specify the CRT, MSVC will pick /MT by default (!?) and
link to `libcmt.lib`. This actually *breaks* UWP because `libcmt.lib`
is not available by default when building for UWP.
Was noticed here: https://github.com/cisco/libsrtp/pull/505
This is useful for automatically generated docs (doxygen, hotdoc)
with a lot of generated files that may differ with different
versions of the generator.
A common pattern in Qt5 applications is to embed translations in the
executable using the qresource system. In this case, the list of
translation files is already available in the .qrc file and there's no
good reason to duplicate this info in meson.build.
Let compile_translations optionally take a qrc input, in which case it
will go straight to generating the relevant translations and
rcc-generated .cpp, and directly return the thing users actually care
about -- the .cpp for linking.
It's not enough to detect that the linker is ld64: gcc, icc, and vanilla
clang all use ld64 on macoOS. Instead we have to detect the class of the
compiler, and determine if it's an Apple Compiler or a vanilla one.
There are a couple new users of Meson that might be worth mentioning.
502 commits later, Libvirt and QEMU have both switched!
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
- Exceptions raised during subproject setup were ignored.
- Allow c_stdlib in native file, was already half supported.
- Eliminate usage of subproject variable name by overriding
'<lang>_stdlib' dependency name.
Look for group-able flags with a single regex match, since we are already using
regexes for .so files. Also weed out flags other than -isystem very quickly
with a single startswith call.
On a QEMU build, the time spent in to_native goes from 2.279s to 1.322s.
The lambda in NinjaBuildElement.write is quite expensive, totalling 0.3s
just to do a couple function calls. Since it is used just once, simply
inline it.
On a QEMU build, the total time spent in write from this series goes from
5.321s to 3.238s, though part of it can be attributed to previous patches.
Optimize the regular expression so that the variable expansion part
always ends up in group 1, and the trailer after the variable is discarded
in the same match. Do not use re.sub to remove braces, and do not bother
building the expanded command, just adjust the estimated length on the fly.
functools.reduce is extremely slow, so I am keeping ' '.join(chunk).
On a QEMU build the time spend in the function goes from 1.072s to 0.757s.
extract_objects is repeatedly looking up files in self.sources, which is a list.
Convert it to a set beforehand so that the lookup is O(1).
On a QEMU build, the time spent in extract_objects goes from 3.292s to 0.431s.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Most files are going to be looked up into a set or dictionary. Precompute
the hash so that we only need to do so once and we can also use it to
quickly weed out unequal objects.
On a QEMU build, the time spent in __eq__ and __hash goes respectively
from 3.110s to 2.162s and from 0.648s to 0.299s. Even larger gains are
obtained by the next patch.
Use regular expressions to quickly weed out strings that require quoting
On a QEMU build the time spent in ninja_quote goes from 1.978s to 1.281s,
with str.replace being kicked completely out of the profile.
pre_flush_set and post_flush_set are almost always empty, so we can use
extend() instead of a for...in loop to add the previous elements of
self._container.
We can also skip the conversion from deque to list since pre_flush is
always appended on the right side.
On a QEMU build the time spent in flush_pre_post goes from 1.4 to 0.5
seconds.
The linker always args, as the name implies, should always be included. For
example, the AIX get_allow_undefined_link_args are a syntax error unless
the AIX get_linker_always_args are also used.