Currently it does nothing, as the field is read too late, and additional
languages have already been considered. As such if the language
requested is closer to C (for example you want C but have a C++ source
with only extern C functions) then link_langauge is ignored.
Fixes#6453
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.
Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
Adjust the handling of a name_prefix: [] kwarg to be the same as
name_suffix: [] kwarg, i.e. identically to the case where it's omitted,
so BuildTarget.prefix doesn't get set (so the default is used).
Also clarify the error reported when a non-empty list is used.
Similar to meson.override_find_program() but overrides the result of the
dependency() function.
Also ensure that dependency() always returns the same result when
looking for the same dependency, this fixes cases where parts of the
project could be using a system library and other parts use the library
provided by a subproject.
This makes the typing annotations basically impossible to get right, but
if we only have one key then it's easy. Fortunately python provides
comprehensions, so we don't even need the ability to pass multiple keys,
we can just [extract_as_list(kwargs, c) for c in ('a', 'b', 'c')] and
get the same result.
listify shouldn't be unholdering, it's a function to turn scalar values
into lists, or flatten lists. Having a separate function is clearer,
easier to understand, and can be run recursively if necessary.
This gives consistent reporting of this error for all platforms.
Also, reporting this error when constructing the BuildTarget, rather
than discovering the problem during backend generation means that the
error is reported against with a location.
declare_dependencies
This allows dependencies declared in subprojects to set variables, and
for those variables to be accessed via the get_variable method, just
like those from pkg-config and cmake. This makes it easier to use
projects from subprojects in a polymorphic manner, lowering the
distinction between a subproject and an external dependency every
further.
There are three problems:
1) Dunders like `__lt__` and `__gt__` don't return bool, they return
either a bool or the NotImplemented singleton to signal that they don't
know how to be compared.
2) The don't take type object, the take `typing.Any`
3) They need to return NotImplemented if the comparison is not
implemented, this allows python to try the inverse dunder from the
other object. If that object returns NotImplemented as well a
TypeError is raised.
t.pic won't be defined. We can only hope it has been built with -fPIC.
Linker will complain otherwise any way.
t.extract_all_objects_recurse() won't be defined. We could support this
case by extracting the archive somewhere and pick object files.
Some things, like `method[...](...)` or `x: ... = ...` python 3.5
doesn't support, so I made a comment instead with the intention that it
can someday be made into a real annotation.
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.
As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.