Commit Graph

236 Commits

Author SHA1 Message Date
Dylan Baker 6d173f9678 mesonlib: make OptionOverrideProxy a true MutableMapping
So that we can actually use it anyplace that an OptionDictType could be
used. I've also done a bit optimizing/simplifying of the implementation.
This is needed for cuda, as it returns an OptionOverrideProxy where we
ask for an OptionDicType
2020-10-01 15:05:00 -07:00
Dylan Baker 79d1ecd5bc compilers/compilers: Fully type annotate 2020-09-24 12:14:13 -07:00
Dylan Baker f342efd080 pylint: turn on bad-indentation error
and fix all of the bad indentation
2020-09-22 17:57:03 -07:00
Xavier Claessens 9d338200da external-project: New module to build configure/make projects
This adds an experimental meson module to build projects with other
build systems.

Closes: #4316
2020-09-13 13:54:47 -04:00
Xavier Claessens 552432e507 git: Use Popen_safe to avoid encoding issues 2020-09-10 11:39:30 -04:00
Xavier Claessens 276c3fcb5a Move verbose_git() and quiet_git() to mesonlib 2020-09-10 11:39:30 -04:00
Xavier Claessens 8a9baab4d3 mesonlib: Move MesonException declaration to the top 2020-09-10 11:39:30 -04:00
Daniel Mensinger 4253bf6281
typing: Fix code review 2020-09-08 20:15:59 +02:00
Daniel Mensinger e681235e5f
typing: fix code review 2020-09-08 20:15:58 +02:00
Daniel Mensinger 62f7642a61
typing: fix dependencies for new follow_imports 2020-09-08 20:15:58 +02:00
Daniel Mensinger bb09ca9ad5
typing: fully annotate mesonlib.py 2020-09-08 20:15:56 +02:00
Christoph Reiter 0710ad18d9 Be stricter when detecting Windows/Cygwin
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
2020-08-30 23:37:46 +03:00
Jussi Pakkanen 3a25efc056
Merge pull request #7581 from peterh/aix
Add AIX support
2020-08-25 23:58:17 +03:00
Paolo Bonzini 372f420778 File: precompute hash
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.
2020-08-18 08:11:25 +02:00
Peter Harris 45a12d28b9 aix: fix cpu family detection
Like the BSDs, AIX does not return anything useful in platform.machine().
2020-08-12 19:56:01 -04:00
Elad Lahav 1ddd2b4cbe Use uname -p to detect x86_64 on QNX. 2020-08-08 15:43:57 -07:00
Dylan Baker 5358765806 mesonlib: Add repr() methods to PerMachine classes
Which is super helpful in debuggers
2020-08-01 22:00:06 -07:00
Eric Dodd 71d68a940b Updated to resolve issue identifying SGI CPUs on IRIX systems 2020-06-10 22:16:14 +03:00
Joshua Gawley 6d2255ffec
mesonlib.py: refactored detect_vcs() to use pathlib.Path (#7230) 2020-06-04 00:48:01 +03:00
Dylan Baker e35584e9ff interpreter: Add always set default value for version and set it ASAP
Ideally we wouldn't need to have the default dict here and could just
rely on it being set as soon as project is called. There is a corner
case exercised by test case common/35 run program, which is that if a
FeatureNew or FeatureDeprecated is called to generate the meson version
it will be unset, to work around this I've changed the type from a dict
to a default dict with '' as the default value.

A better fix would probably be to store all of the
FeatureNew/FeatureDeprecated checks until the end, then evaluate them,
but for now this results in no loss of functionality, only more
functionality, even if it isn't prefect.
2020-05-14 12:15:03 -07:00
Daniel Mensinger 57e55b1a9d boost: Try finding libraries with the matching arch (fixes #7110) 2020-05-14 02:16:35 +03:00
Pino Toscano a441836773 Recognize Hurd as platform/OS 2020-04-10 11:29:35 -07:00
dabrain34 97a72a1c53
cmake: support cmake config file syntax (#6917)
* cmake: enhance support of cmake config file syntax

Enhance the cmakedefine support by accepting 2 or 3 tokens
in the conf line as mesondefine supports strictly 2 tokens

* fixup! cmake: enhance support of cmake config file syntax

* fixup! fixup! cmake: enhance support of cmake config file syntax
2020-04-10 11:14:54 -07:00
ClausKlein 00104b1081 Remove my notes from sources
changes acording review comments
2020-03-19 19:11:10 +02:00
ClausKlein f72c990bfd Use os.path.normpath() for include paths
This make relative pathes shorter an too give a chance to
de-duplicate -isystem flags just like -I flags.

Fix common test case 203 for OSX build host too
2020-03-19 19:11:10 +02: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 e3beaf87a5 mesonlib: use mlog instead of print 2020-03-05 09:31:29 -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
Dylan Baker a7407b8782 mesonlib: Fix File.__eq__ to return NotImplemented
The implementation assumes another File, but doesn't properly guard
that. Let's do that guarding.
2020-03-04 12:30:44 -08:00
Dylan Baker f79ac4cefa mesonlib: Use textwrap.dedent
This is mostly just to help folding editors like vim, which get confused
by the non-indented code. It also helps readability, IMHO.
2020-03-04 12:29:12 -08:00
Daniel Mensinger d67888bf9b
types: Remove redundant __init__() -> None annotation 2020-03-02 10:52:59 +01:00
Jon Turney fa928e803b
Remove unused MesonException.get_msg_with_context()
After that, the only remaining user of get_error_location_string() is mlog,
so move that there.
2020-02-28 11:54:03 +00:00
Nirbheek Chauhan 97274621a5 Popen_safe: Always re-setup the console colors 2020-02-16 00:26:08 +05:30
Nirbheek Chauhan c05b725122 Split console colourization into a separate function
Use it instead of making a direct call to mlog._windows_ansi().
2020-02-16 00:26:08 +05:30
Nirbheek Chauhan 11253a1c3a mesonlib: Set stdin to DEVNULL for all programs run by us
Otherwise there's a high likelihood that some program run by us will
mess up the console settings and break ANSI colors. F.ex., running
`uname` in the Visual Studio 2019 x86 developer prompt using
`run_command()` does this.
2020-02-16 00:26:08 +05:30
Michael Hirsch, Ph.D c2e6565029
add meson.get_native_property for native files
This allows Meson native-file [properties] to be used.
This avoids the need to call meson from a script file or have a
long command line invocation of `meson setup`

The method meson.get_native_property('prop', 'fallback') is added.
The native file can contain properties like

```
[properties]
myprop1 = 'foo'
mydir2 = 'lib/custom'
```

Then from within `meson.build`

```meson
x1 = meson.get_native_property('myprop1')

thedir = meson.get_native_property('mydir2', 'libs')
```

fallback values are optional
2020-02-05 13:23:55 -05:00
Nirbheek Chauhan 712b2f08c7 Move git helper out into mesonlib for reuse
Reuse the git helper for `meson wrap` and `meson subprojects` so we
don't need to maintain the same git-colors-on-windows workarounds in
multiple places.
2020-01-22 17:29:38 -05:00
Daniel Mensinger cb262ab481 types: Fix/ignore flake8 B014/F811 2020-01-08 15:28:17 +01:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Michael Hirsch, Ph.D 98fd4e5557 cmake: add project language to cmakelists.txt
cmake: get language from Meson project if not specified as depedency(..., langugage: ...)

deps: add threads method:cmake

dependency('threads', method: 'cmake') is useful for cmake unit tests
or those who just want to find threads using cmake.

cmake: project(... Fortran) generally also requires C language
2019-12-09 11:15:58 -05:00
Daniel Mensinger 40837894e8 lgtm: ignore Iterator does not return self from __iter__ method 2019-12-05 11:08:12 -05:00
Xavier Claessens b33830f99e Revert "Have set() and set_quoted() of configuration object work with newlines."
This reverts commit 6ed36e97ae.
2019-11-28 14:32:56 -05:00
Michael Hirsch, Ph.D 8313e8fd54 dep: MPI make work for intel-cl and improve robustness
optimize intelMPI variables

mpi: extract version from non-OpenMPI wrapper
2019-11-25 13:08:01 +02:00
Jehan 6ed36e97ae Have set() and set_quoted() of configuration object work with newlines.
* Have set() and set_quoted() of configuration object work with newlines.

set_quoted() makes the value into a double-quoted string, so let's
assume C-style string, in particular with newlines as "\n".

Also take care of remaining newlines in dump_conf_header(). C or nasm
macros expect single-line values so if the value was multi-line, we
would end up with broken syntax. Appending a backslash at each end of
line make them concat into a single line in both C and nasm format
(note: multi-line macros in nasm are actually possible apparently but
use another format not outputted by current meson code). Also note that
the replacement is done at the end only when dumping the conf as a
header because we cannot assume anything about the format when replacing
variables from an input file (in this case, it should be the dev
responsibility).

* Add unit tests for multiline set() and set_quoted().
2019-11-19 21:05:54 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Aleksey Gurtovoy f56ef583d3 dependency('cuda') 2019-11-05 22:17:44 +02:00
Michael Hirsch, Ph.D 765a5e9835
ducking 'None' for missing module
This handles the Windows-specific case, the next commit handles the general issue
2019-10-22 23:38:32 -04:00
Zbigniew Jędrzejewski-Szmek 3a6920ebdc Add helper to print warnings once
The helper is general, although in this patch it is only used for
warnings. No functional change intended.
2019-09-25 14:52:07 +02:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00