Commit Graph

379 Commits

Author SHA1 Message Date
John Ericson 278c294aa4 Compiler options per lang
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`.
2020-04-20 23:23:15 +03:00
Jon Turney 27d498de6d
Fix handling of library(name_prefix: [])
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.
2020-04-11 19:57:38 +01:00
alanNz 7460292810 -Add xc16 and c2000 C,Cpp toolchain support 2020-03-21 00:47:24 +02:00
Jussi Pakkanen aff7fc89c3 Generators can depend on custom targets as well as build targets. 2020-03-19 22:03:14 +02:00
Jussi Pakkanen 5c51d4521a
Merge pull request #6532 from jon-turney/languages-native-kwarg
Add add_languages(native:)
2020-03-09 01:20:57 +02:00
Jussi Pakkanen 44ff3e6c7d
Merge pull request #6736 from dcbaker/mesonlib-type-annotations
Mesonlib type annotations
2020-03-08 14:49:23 +02:00
Xavier Claessens 8edc6d655d Improve logged messages for overriden dependencies 2020-03-06 15:26:02 -05:00
Xavier Claessens 2fdedc4d0f Add meson.override_dependency()
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.
2020-03-06 15:25:46 -05:00
Dylan Baker 06b1a317d2 Make use of unholder
We have a lot of cases of code like:
```python
if hasattr(var, 'held_object'):
    var = var.held_object`
```

replace that with the unholder function.
2020-03-05 09:58:52 -08:00
Dylan Baker 581d69a8d3 remove ability to pass multiple keys to extract_as_list
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.
2020-03-05 09:58:52 -08:00
Dylan Baker a8293dd59c mesonlib: Replace unholder argument to listify
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.
2020-03-05 09:31:29 -08:00
Dylan Baker 1a82880730 mesonbuild/mesonlib: Add type annotations 2020-03-05 09:31:29 -08:00
Michael Brockus 98ddd52ced
Cherry-picking - (rm python2 % add python3 .format) (#6725) 2020-03-03 21:45:43 +02:00
ur4t 9787de59d4 Fixed linker detecting on windows. Added comments about linker detecting for further debugging and refactoring. 2020-02-29 00:43:00 +02:00
Jon Turney 1464ac6ed5
Improve error reported when language has no compiler
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.
2020-02-12 13:33:07 +00:00
Xavier Claessens 15eb0014ac interpreter: Iterate custom target outputs 2020-02-04 21:28:32 +02:00
Jussi Pakkanen a51c9af921
Merge pull request #6423 from dcbaker/declare-dependency-variables
Add ability to set and query arbitrary variables on declare_dependency objects
2020-01-27 18:29:22 +02:00
Nirbheek Chauhan d8e738f04f typing: Fix compatibility with Python 3.5.2
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes https://github.com/mesonbuild/meson/issues/6427
2020-01-24 02:53:34 +05:30
Dylan Baker cd895be99a dependencies: Add ability to set arbitrary variables on
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.
2020-01-09 11:02:17 -08:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker e88b3c8022 build: Fix type signature of rich comparison dunders
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.
2019-12-05 22:15:40 +02:00
Daniel Mensinger ae018a3c68 lgtm: fix Incomplete ordering 2019-12-05 11:08:12 -05:00
Daniel Mensinger 268d59516f lgtm: fix Mismatch between signature and use of an overridden method
by renaming process_kwargs to process_kwargs_base for the base
target class.
2019-12-05 00:22:10 +02:00
Daniel Mensinger e0001fbe0a lgtm: fix format string numbering 2019-12-05 00:22:10 +02:00
taz-007 eed05c9045 improve error message when old version detected
Be more explicit about the --wipe command requiring to be executed from the source dir.
2019-11-30 21:55:51 +02:00
Xavier Claessens 7dd302773d Fix link_whole with a custom target
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.
2019-11-25 20:34:37 -05:00
Jussi Pakkanen 35e809fc5e Store run target names in build.
This way we can easily check that we only provide builtin targets such
as clang-format if the user has not provided their own.
2019-11-10 23:45:42 +02:00
Jakub Adam 1bf1782476 Fix *.pdb files missing in meson introspect --installed output
On Windows, make sure the introspect command lists all Program database
(PDB) files containing debugging information that Meson will install.
2019-10-09 15:50:20 +02:00
Daniel Mensinger 73d52266b5
Use include_type instead of is_system 2019-10-03 10:06:04 +02:00
Daniel Mensinger a7c4682be1
Also add support for declare_dependency objects 2019-10-03 10:06:04 +02:00
Daniel Mensinger f508b4cf80
use getters for dependency access 2019-10-03 10:06:03 +02:00
Xavier Claessens dd5a0df3ec Recursively include all objects from uninstalled static libraries 2019-10-01 13:06:45 -04:00
Xavier Claessens a3153747b9 Do not promote to link_whole when an internal library links to another 2019-10-01 13:06:45 -04:00
Xavier Claessens 19fc692b25 pkgconfig: Include dependencies of uninstalled static libraries 2019-10-01 13:06:45 -04:00
Xavier Claessens dc5ad1fad9 pkgconfig: Do not include uninstalled static libraries 2019-10-01 13:06:45 -04:00
Xavier Claessens 484b721369 Fix link_with of a static library with an uninstalled static library 2019-10-01 13:06:45 -04:00
Xavier Claessens f396c71c52 Fix link_whole of static libraries 2019-10-01 13:06:45 -04:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00
Jussi Pakkanen 1ea3ddc6ad
Merge pull request #5681 from dcbaker/dynamic-linker-split
split dynamic linker representations from compilers
2019-08-20 23:14:05 +03:00
Rachel Mant f431cff809 Make .extract_objects() work correctly as an input to custom_target 2019-08-17 21:12:56 +03:00
Dylan Baker 06dcbd50ee compilers: Dispatch to dynamic linker class
Most of the cuda code is from Olexa Bilaniuk.
Most of the PGI code is from Michael Hirsc
2019-08-14 13:13:23 -07:00
Jussi Pakkanen f41bdae368 Add basic Webassembly support via Emscripten. 2019-08-05 19:31:32 +03:00
Marc-André Lureau 341d245e68 Accept vs_module_defs for modules
Like shared libraries, modules may have vs_module_defs.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-07-17 19:19:56 +03:00
Xavier Claessens 12d4031f52 Add alias_target() function 2019-07-10 15:01:18 -04:00
Cody Schafer 11248eb203 sanitycheckc: avoid linking sanitycheckc when cross compiling 2019-06-27 20:36:09 +03:00
Roman Shpuntov 3b17344b11 tvOS: added support AppleTVOS 2019-06-13 21:31:03 +03:00
John Ericson 3b54f38c84 Add some type annotations
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.
2019-06-09 13:13:27 -04:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
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.
2019-06-09 13:13:25 -04:00
John Ericson 32e827dcdc Use `env.machines.*` to avoid some `is_cross`
This is a small example of the `is_cross` removal the that abstraction
enables.
2019-06-09 13:13:20 -04:00
Jussi Pakkanen 79d530e325 Generators can have extra target dependencies. Closes #4131. 2019-05-20 23:38:13 +03:00