Commit Graph

966 Commits

Author SHA1 Message Date
Michael Hirsch, Ph.D 5b4ebb5641 quality / test: Fortran type hinting
enhance fortran args tests
2020-04-05 13:43:53 +03:00
Daniel Mensinger 570adf0900
interpreter: Fix Disabler support for modules 2020-04-02 10:57:48 +02:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
Jussi Pakkanen 9e5c881b06 Add property to disable compiler sanity checks during cross compilation. 2020-03-22 23:07:53 +02:00
Jussi Pakkanen 84e216fd64
Merge pull request #6636 from jon-turney/machine-detection-problems
Redetect machines when languages change
2020-03-20 20:35:59 +02:00
Daniel Mensinger 673ca982f1 cmake: Add find_package COMPONETS support 2020-03-19 22:52:03 +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 823c83b269 dependency: Verify fallback variable consistency
This change made `5 dependency versions` unit test fail because now once
a subproject has been configured, the fallback variable is checked to be
consistent. So it has to use new subproject because 'somesub' was
already configured by previous tests.
2020-03-06 15:26:02 -05:00
Xavier Claessens 8edc6d655d Improve logged messages for overriden dependencies 2020-03-06 15:26:02 -05:00
Xavier Claessens 141401c11d Allow override_dependency() with a not-found dep 2020-03-06 15:26:02 -05:00
Xavier Claessens 943e9368f7 Simplify dependency() fallback
Now that subprojects can override the dependency name, there is no need
to provide a variable name for the fallback any more.
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 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
Stéphane Cerveau a46f0a6202 interpreter: add 'name' method to BuildTargetHolder
As any child of BuildTargetHolder might need the name of the object,
provides a method to get object name.
This is useful in gst-build to display the plugin name and not
the filename.
2020-03-04 13:49:01 -05:00
Daniel Mensinger ab988198c7
review: Initial fixup 2020-03-02 10:47:20 +01:00
Daniel Mensinger 5a89a6f804
types: (partially) annotate interpreterbase.py
This commit annotates most of interpreterbase.py. However,
there are stil the @wraps missing, since I am unsure what
the types are supposed to be here.
2020-03-02 10:42:43 +01:00
Daniel Mensinger c48b0dea27
types: Annotate ast/interpreter.py 2020-03-02 10:34:55 +01:00
Jussi Pakkanen 200738a3e6
Merge pull request #6692 from xclaesse/summary-warnings
Summary improvements
2020-03-01 19:30:10 +02:00
Jon Turney 2cf2c80112
Redetect machines after every change to languages
Currently, detect_machine_info() is called:

- from Environment.__init__(), before we have any compiler available

- from Interpreter.__init__() with the list of languages provided to
project() (determined via the initial parse_project())

This is not sufficent in the case where no languages are specified to
project() and are later added with add_languages().

We cannot correctly detect that the host machine should be treated as
x86 (on x86_64 hardware) until we have a compiler we are told to use.

Redetect machines after project(), and after every add_languages().
2020-02-29 19:52:12 +00:00
Jon Turney 346b5c4be7
Store filename in node location
Warnings have a location node object (with subdir and lineno
attributes), which is passed as a location: kwarg to mlog.warning() and
formatted in _log_error().

Re-purpose the subdir attribute (path relative to the source root dir,
with an implied filename of 'meson.build'), which is stored into the
node by parser(), to contain a pathname.

(Properly I should rename 'subdir' -> 'file' everywhere, but that's a
lot of churn just to see if this works)

Notes:
The warning location node may also have a colno attribute, which is
currently ignored by _log_error().

We can't currently issue warnings with locations in meson_options.txt
because the filename isn't part of the location (as it's assumed to be
'meson.build).
2020-02-28 11:54:04 +00:00
Jon Turney 534a974da7
Adjust all the other places MesonException file attribute is set
A MesonException has file, lineno and colno attributes, which get
formatted as a location in mlog.exception().

The file attribute got changed from a path relative to the root source
directory to a pathname (absolute or relative to cwd) in one place in
commit b8fbbf59.  Adjust all the other places the file attribute is set
to match.

Also:
Setting MesonException.file seems to be missing in the case where Parser
returned a non-CodeBlockNode object.  Fortunately, that looks like it's
unreachable, but add it just in case.
2020-02-28 11:54:04 +00:00
Xavier Claessens 8101b0ddab summary: Add more info in Subprojects section
This adds a warnings counter for subprojects that passed. This is to
encourage developpers to check warnings in the logs and hopefully fix
them. Otherwise they could be hidden in hundreds lines of logs.

This also print the error message for subprojects that did not pass. The
error message is often enough to fix the issue (e.g. missing
dependency) and it's easier than searching in the logs why a subproject
failed.
2020-02-26 14:24:12 -05:00
Xavier Claessens c175e97a88 summary: Add list_sep keyword argument
This allows having lists on a single line instead of having each value
aligned on a new line.
2020-02-26 14:24:12 -05:00
Gerion Entrup b1304f7290 version parsing: match only when version starts with a number
This leads to better version parsing. An concrete example use case is
llc. When invoking llc with "--version", the output is
```
LLVM (http://llvm.org/):
  LLVM version 9.0.1
  ...
```
The old version parsing recognizes the dot in the first line as version.

This commit also tries to adapt the two regexes to each other.

Reported-by: Björn Fiedler <fiedler@sra.uni-hannover.de>
2020-02-17 01:10:40 +05:30
Jon Turney c5a32c2afe
Refine behaviour of add_languages() when native: is missing
This improves the common case of a simple meson.build which doesn't
contain any 'native: true' targets to not require a native compiler when
cross-compiling, without needing any changes in the meson.build.

v2:
Do it the right way around!
2020-02-12 13:33:00 +00:00
Nirbheek Chauhan 1e4eeccb0f configure_file: Also copy timestamps to avoid useless rebuilds
If we always copy files over without timestamps, we're forcing
a (probably unnecessary) rebuild. Also include a test for this.
2020-02-11 10:00:40 -05:00
Jon Turney 7a159ff1e1
Add add_languages(native:)
v2:
Retain not using logical-and, to avoid short-circuiting side-effects
of add_languages()
2020-02-09 16:01:34 +00:00
Xavier Claessens 3ba0073df6 Make 'default_library' per-subproject builtin option
Currently it's just like if all builtin/base/compiler options are
yielding. This patch makes possible to have non-yielding builtin
options. The value in is overriden in this order:
 - Value from parent project
 - Value from subproject's default_options if set
 - Value from subproject() default_options if set
 - Value from command line if set
2020-02-06 14:11:24 -05:00
Michael Hirsch, Ph.D a4e4d2e75a
doc 2020-02-05 13:26:35 -05:00
Michael Hirsch, Ph.D 554d35c3f3
add get_external_property to replace get_cross_property 2020-02-05 13:23:55 -05:00
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
Xavier Claessens 15eb0014ac interpreter: Iterate custom target outputs 2020-02-04 21:28:32 +02:00
Xavier Claessens 31f00c11d3 summary: Fix empty list case
Fixes: #6557.
2020-02-01 11:21:16 +01:00
Daniel Mensinger d0c7b51693 mintro: use interpreter data for buildsystem-files (fixes #6390) 2020-01-28 21:18:25 +02:00
Daniel Mensinger 668610c0d2 backend: refactor: set self.interpreter in the constructor 2020-01-28 21:18:25 +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
Xavier Claessens b74ece344f Support multiple args to message() and warning() 2020-01-26 07:51:16 -05:00
Xavier Claessens f54f27b1a8 Fix required dependency() not failing when wrap-mode=nofallback
When a dependency is required, not found on the system, and its fallback
is disabled with --wrap-mode=nofallback, meson should abort instead of
returning not-found.
2020-01-25 08:51:46 -05:00
Xavier Claessens 61993f893b Fix typo in error message 2020-01-18 11:23:46 -05:00
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
Xavier Claessens e5297aeca5 summary: Change 'section' to be a kwarg instead of positional
Fixes: #6372.
2019-12-19 14:19:39 -05:00
Michael Hirsch, Ph.D 5695dc0f16 add compiler.get_linker_id() method
this can be useful for if/elif where linker behaviors must be
considered.

For example, clang with "link" vs gcc with "ld.bfd" etc.

ci for compiler.get_linker_id() method

doc

add @FeatureNew check

Co-Authored-By: Daniel Mensinger <daniel@mensinger-ka.de>
2019-12-19 12:03:55 -05:00
Daniel Mensinger c4649704c8 python: add embed to the python dependency function 2019-12-18 01:19:16 +02:00
Xavier Claessens a4bb0928e3 summary: Add 'Subprojects' section to main project 2019-12-12 18:30:17 -05:00
Xavier Claessens 38953d8ee3 summary: Add bool_yn keyword argument 2019-12-12 18:30:17 -05:00
Xavier Claessens 49082f9669 summary: Allow section with no title, and passing key/value separately 2019-12-12 18:30:17 -05:00
Xavier Claessens 6e865a2330 Add a summary() function for configuration summarization
Based on patch from Dylan Baker.

Fixes #757
2019-12-12 18:30:17 -05:00
Xavier Claessens 552e78da4d assert(): Make message argument optional 2019-12-10 18:02:41 +02:00
Xavier Claessens 162d2bcc71 run_command: Do not add dependency on /dev/stdout
Blacklist /dev paths, this fix infinite reconfigure when /dev/stdout is
redirected to a file.

Fixes: #6315.
2019-12-09 18:05:18 +02:00
Xavier Claessens b872099468 find_program(): Add 'dirs' keyword argument
Fixes: #1576
2019-12-05 16:52:22 -05:00
Xavier Claessens 691a74aec2 interpreter: Remove useless check
extract_required_kwarg() above already ensure that required is always
boolean at that point.
2019-12-05 16:52:22 -05:00
Daniel Mensinger f1971fed90 lgtm: Actually supress the Non-standard exception warning 2019-12-05 11:08:12 -05:00
Daniel Mensinger 454e323d3d lgtm: ignore Non-standard exception raised in special method 2019-12-05 00:22:10 +02: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
Xavier Claessens 80dd3e30ce Fix crash when checking multi version on subproject dep
Also harminize a bit the logged message.
2019-11-26 11:31:48 -05:00
Xavier Claessens f0565e6dc8 Simplify list of build def files
Refactor the code inside a common function for consistency.

It's not needed to add dependencies in func_configure_file() because
it's already done in run_command_impl(). Do it only for files from
`input:` in the case some of them does not end up in the command
arguments.
2019-11-25 22:35:34 +02:00
Jussi Pakkanen 5920344b92
Merge pull request #6199 from mensinda/cmSysInc
cmake: Handle CMake system include dirs (closes #6079)
2019-11-20 18:41:18 +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
Eric Le Bihan 24cdb4a92f Interpreter: display linker executable path, if available
Instead of only displaying the identifier of the linker, display also the path
to the executable in order to report useful information when cross-compiling.
2019-11-19 16:32:12 +02:00
Daniel Mensinger 9435f11b17
ci: Add CI command to include text files in the CI log 2019-11-19 15:21:13 +01:00
Jussi Pakkanen bf800101c2
Merge pull request #6182 from mensinda/depInfo
Better dependency logs
2019-11-17 14:29:47 +02:00
Jehan c6f93b6bf6 Issue #6174: run_command() with compiler object behind ccache fails.
When run_command() first parameter is a compiler object, keep additional
exelist values as arguments.
2019-11-17 00:38:23 +02:00
Daniel Mensinger 2e62d6a203
Highlight '(cached)' and add color to the dependency version 2019-11-14 17:19:42 +01:00
Daniel Mensinger f8ba76cc22
dependencies: Print version of cached dependencies 2019-11-14 17:15:59 +01: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
Zbigniew Jędrzejewski-Szmek 74151ead9a Make the hint about built-in options more useful
In a large project, it can be hard to guess what meson "had in mind", when many different
warnings are added in different places. Let's make the message precise and specify the location.

WARNING: Consider using the built-in warning_level option instead of adding warning flags by hand.
↓
meson.build:414: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".
2019-11-08 23:21:49 +02:00
Zbigniew Jędrzejewski-Szmek d55aaa56f4 "built-in" is the standard spellling 2019-11-08 23:21:49 +02:00
Jussi Pakkanen 46788d1b5b Created the filesystem module. 2019-11-08 00:44:45 +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
Michael Hirsch, Ph.D 4857940e89
raise exception when a non-required module not found and subsequently used 2019-10-22 23:38:39 -04:00
Michael Hirsch, Ph.D ebb1ad528a path interpreter--silently discard invalid Unix relative paths on Windows
fixes #6000

The idea is that end-users want to specify an array of directories to search by default
without an if/elif stack. It's obvious that Unix absolute paths are not absolute on
Windows, so silently discard Unix absolute paths here for Windows instead of raising
exception.
2019-10-11 10:08:00 -07:00
Jussi Pakkanen 51fef880b6
Merge pull request #5953 from mensinda/isystem
Add is_system to dependency
2019-10-06 17:33:12 +03:00
Daniel Mensinger 73d52266b5
Use include_type instead of is_system 2019-10-03 10:06:04 +02:00
Daniel Mensinger e5c720ff60
Move generate_system_dependency to Dependency 2019-10-03 10:06:04 +02:00
Daniel Mensinger 8593506b7b
add is_system kwarg to dependency
Also adds the is_system and as_system methods to
the dependency holder.
2019-10-03 10:06:03 +02:00
Dylan Baker 00aba4a279 interpreter: Combine test and benchmark args
Adding the test specific args later. This will help prevent bugs where
arguments are added to test but not to benchmark even when they apply.
2019-10-02 13:50:25 -07:00
Dylan Baker 0fb1d029b6 interpreter: Correctly handle arguments to benchmark
This fixes two separate issues, one is that benchmark warns about
depends and priority; The other is that we passed bad values like
is_parallel into the test and would actually run benchmarks in parallel,
which is bad.
2019-10-02 13:43:08 -07:00
Xavier Claessens 22d578e1a0 Remove unused 'required' argument 2019-10-01 13:30:15 -04:00
Xavier Claessens 70b1391248 cmake: Write AST into build dir
It easier to read it from a file than looking into logs. Users needs to
read it to find variable names of generated dependency objects.
2019-10-01 13:30:15 -04:00
Marc-André Lureau 01569fee2e Add depfile to configure_file()
In qemu, minikconf generates a depfile that meson could use to
automatically reconfigure on dependency change.

Note: someone clever can perhaps find a way to express this with a
ninja rule & depfile=. I didn't manage, so I wrote a simple depfile
parser.
2019-09-30 22:17:50 +03:00
Marc-André Lureau a65d5801f3 environment: Support taking values from dict
Related to #5955.
2019-09-29 08:42:53 -04:00
Marc-André Lureau 18897b6afd ConfigurationDataHolder: pass initial_values to ctor 2019-09-29 08:42:53 -04:00
Marc-André Lureau 6c72119cfd configure_file: add feature version checks for taking dict
Since commit 38a658214 ("configure_file: Support taking values from a
dict" #4236), configuration_data() and configure_file()'s
configuration kwarg can take a dict. Add missing version checks.
2019-09-29 08:42:53 -04:00
Daniel Mensinger c4f96e00a6 removed the InternalDepdendencyHolder, since it is unused 2019-09-25 08:28:11 -04:00
Xavier Claessens ef3992f1cc configure_file(): Allow multiple inputs in command mode
Closes: #5893
2019-09-17 13:05:40 -04:00
Peter Hutterer 4ebce2c3f2 Add test priorities to force test start order 2019-08-24 21:26:41 +03:00
Dylan Baker 110b562930 Vs backend compiler selection (#5448)
* backends/vs: Only set platform_toolset if it isn't already set

* interpreter: set backend up after the compiler

Otherwise we won't be able to check which VS toolchain to use.

* docs/using-visual-studio: wrap lines

* docs: recommend the py launcher instead of python3 for windows

* set backend.environment when building a dummy version

* backends/vs: Add support for clang-cl with vs2017 and vs2019 backends

* backends/vs: Add support for ICL (19.x) with vs2015 and vs2017 backends
2019-08-24 02:32:56 +03:00
Jussi Pakkanen 3db6dcb3b8 Rerun configuration for all potential input files. Closes #5809. 2019-08-21 20:49:49 +03: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
Thibault Saunier edec2ee0ee gnome: Handle overriden g-ir-scanner
When g-ir-scanner is overriden, we can't call it at configure time
but we know what options are avalaible (as it started using meson
after checked options where added) so do not try to call it to retrieve
the version as it will fail.

Also see https://github.com/mesonbuild/meson/issues/3442
2019-08-17 12:07:20 +03:00
Michael Hirsch, Ph.D fd7e8c5400 expand tilde when looking up libraries -Dfoo=~/mylib
It is often desirable to use ~ for home directory in -D compilation args.

Why the transform to pathlib.Path and back to str? Because this is one of many
places where the list(map(str,..))) will be eliminated upon Python 3.6 being
minimum Meson Python requirement.
2019-08-15 23:50:36 +03:00
Dylan Baker c55285351a Interpreter: identify the linker being used, if there is one 2019-08-14 13:13:23 -07:00
James Hilliard b21fd95f73 Add is_disabler function
This is useful if one needs to check if a variable is a disabler.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2019-08-12 01:05:45 +03:00
Jussi Pakkanen 8764e4f579 Print only host platform info in some cases during native builds
Build and target info is confusing in that case. However still log that
information, as it is useful in case something slips out of sync and
needs to be debugged.
2019-08-11 20:38:35 +03:00
Jussi Pakkanen 5fd4963766 Made build. options alias basic ones when native building. 2019-08-06 21:34:15 +03:00
Jussi Pakkanen b739652bc4 Do not print build compiler info when not cross compiling. It is confusing. 2019-08-06 21:34:15 +03:00
Dylan Baker b3ea27f596 interpreter: Fix permitted kwargs in dependency.get_variable
default -> default_value
2019-07-26 12:06:47 +00:00
Xavier Claessens 2e41d53e4d Add version check support to find_program()
Closes: #1609
2019-07-19 08:55:50 -04:00
Daniel Mensinger bc0f510ef1 fix all flake8 issues 2019-07-18 23:43:29 +03:00
Jussi Pakkanen 19cda6b7c9
Merge pull request #5606 from xclaesse/alias_target
Add alias_target() function
2019-07-11 00:34:40 +03:00
Xavier Claessens 12d4031f52 Add alias_target() function 2019-07-10 15:01:18 -04:00
Jussi Pakkanen 724113849c Warn if the user manually adds arguments we have builtin support for. 2019-07-10 01:05:47 +03:00
John Ericson 9149aaba9c `add_{global,project}_{,link_}arguments`: simply native flag behavior
This further simplifies behavior to match the "build vs host" decision
we did with `c_args` vs `build_c_args`. The rules are now simply:

 - `native: true` affects `native: true` targets

 - `native: false` affects `native: false` targets

 - No native flag is the same as `native: false`

I like this because you don't even have to know what "build" and "host"
mean to understand how it works, and it doesn't depend on whether the
overall build is cross or not.

Fixes #4933
2019-06-27 21:24:50 +03:00
Michael Hirsch, Ph.D 5b109c9ad2 correct missing argument for IntelClFortranCompiler
ifort passes all tests

cleanup logic
2019-06-24 14:06:32 -04:00
John Ericson 34c22522f3 Further deduplicate Interpreter native kwarg code
This ensures that invalid arguments properly cause errors, but doesn't
otherwise change semantics
2019-06-12 14:50:51 +03:00
John Ericson 2ddb1af294 Simplify and dedup machine kwarg -> MachineChoice logic in the interpreter 2019-06-09 13:13:29 -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
Daniel Mensinger b1bef5ae0d
cmake: removed legacy kwargs from interpreter dict 2019-06-06 18:27:05 +02:00
Daniel Mensinger e02c101575
cmake: moved subprojects into the CMake module 2019-06-06 18:27:05 +02:00
Daniel Mensinger 35936316eb
cmake: rebase fixes 2019-06-06 18:27:04 +02:00
Daniel Mensinger 3d7c50d109
cmake: Added option for additional CMake args 2019-06-06 18:27:03 +02:00
Daniel Mensinger d114d8446e
cmake: Minor fixes 2019-06-06 18:27:03 +02:00
Daniel Mensinger 1041c71eb0
cmake: support object libraries 2019-06-06 18:27:03 +02:00
Daniel Mensinger 2b44b4be9f
cmake: Fixed install prefix 2019-06-06 18:27:02 +02:00
Daniel Mensinger be6a9191e1
cmake: First working version 2019-06-06 18:27:02 +02:00
Daniel Mensinger e55236bde4
cmake: basic AST generation 2019-06-06 18:27:02 +02:00
Daniel Mensinger 8d3bd6eea8
cmake: Server handshake 2019-06-06 18:27:01 +02:00
Daniel Mensinger a9a3b3ffe6
Added method kwarg to subproject 2019-06-06 18:22:26 +02:00
John Ericson af2d7af998 Per machine do 'build.' and '' option prefixes
See the docs/ changes for details.
2019-06-05 23:05:34 -04:00
Mathieu Duponchelle 12a82e763d interpreter: add fallback argument to subproject.get_variable() 2019-05-28 20:26:54 +03:00
Jussi Pakkanen e9bd7d49bd
Merge pull request #5372 from dcbaker/get_variable
Dependency.get_variable method
2019-05-21 21:57:05 +03:00
Jussi Pakkanen 79d530e325 Generators can have extra target dependencies. Closes #4131. 2019-05-20 23:38:13 +03:00
Jussi Pakkanen ef024583df
Merge pull request #5276 from dcbaker/pkg-config-path-invalidate-cache
coredata: add pkg_config_path to depedency cache key
2019-05-20 22:50:12 +03:00
Jon Turney fb35e6faac Remove compiler data from build object
The actual data is in Coredata (which is serialized) and we just held a
reference in Build for (in)convenience.
2019-05-20 11:29:17 -07:00
Jon Turney 58870fda16 Remove compilers from ModuleState object
It doesn't make much sense to have this and not also have
cross-compilers (so any use of this is already pretty suspect as
probably wrong when cross-compiling).

This information is accessible anyhow via environment.coredata.
2019-05-20 11:29:17 -07:00
Dylan Baker 4f347ef14a fixup! interpreter: Add get_variable method to dependency holders 2019-05-20 10:59:18 -07:00
Dylan Baker 146e97e974 Use dependency cache 2019-05-20 10:05:36 -07:00
Jussi Pakkanen 67a5af99aa
Merge pull request #5395 from dcbaker/mtest-annotations
Mtest annotations and bug fixes
2019-05-16 00:31:01 +03:00
John Ericson 957d8e051c Make `PerMachine` and `MachineChoice` have just `build` and `host`
Meson itself *almost* only cares about the build and host platforms. The
exception is it takes a `target_machine` in the cross file and exposes
it to the user; but it doesn't do anything else with it. It's therefore
overkill to put target in `PerMachine` and `MachineChoice`. Instead, we
make a `PerThreeMachine` only for the machine infos.

Additionally fix a few other things that were bugging me in the process:

 - Get rid of `MachineInfos` class. Since `envconfig.py` was created, it
   has no methods that couldn't just got on `PerMachine`

 - Make `default_missing` and `miss_defaulting` work functionally. That
   means we can just locally bind rather than bind as class vars the
   "unfrozen" configuration. This helps prevent bugs where one forgets
   to freeze a configuration.
2019-05-16 00:27:57 +03:00
John Ericson 4030e7cb7a UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its
name, and also contains its own name. In general, the maxim in
programming is things shouldn't know their own name, so removed the name
field just leaving the option's position in the dictionary as its name.
2019-05-15 14:21:47 +03:00
Dylan Baker 502a684872 build: TestSetup doesn't take keyword arguments
This function is currently setup with keyword arguments defaulting to
None. However, it is never called without passing all of it's arguments
explicitly, and only one of it's arguments would actually be valid as
None. So just drop that, and make them all positional. And annotate
them.
2019-05-14 16:43:29 -07:00
Dylan Baker 285db6637d interpreter: annotate the Test class
This is needed for mtest, in a round about way through backends
2019-05-14 16:43:28 -07:00
Dylan Baker d770f1c815 interpreter: Add get_variable method to dependency holders 2019-05-10 10:55:58 -07:00
Daniel Eklöf c2ee82cc41 add support for "target_type: 'shared_module'" in build_target() 2019-05-09 22:43:10 +03:00
Jon Turney 261878f438 Fix an assertion exception when misusing install_data
* Failing test case for trying to install_data a custom_target

* Validate install_data() arguments are either string or file
2019-05-05 21:11:20 +03:00
Dylan Baker c0aa89e57f
Merge pull request #4952 from mensinda/cacheCompiles
Cache compilers.compile() in coredata
2019-05-02 14:54:02 -07:00
Jussi Pakkanen 1f4023fa47
Merge pull request #5311 from mensinda/flake8Plugins
Added flake8 plugins and some code fixes
2019-05-02 23:30:29 +03:00
Jussi Pakkanen 7ac03f6264 Non-required appleframework deps should not be an error. Closes #5295. 2019-05-02 21:37:57 +03:00
Daniel Mensinger 74b535fea7
Do not pass None to mlog.exception 2019-04-29 19:00:46 +02:00
Daniel Mensinger 236221061a
Fixed unnecessary .items() 2019-04-29 12:23:13 +02:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger c9e2d22eef
Make flake8 happy 2019-04-28 14:33:21 +02:00
Daniel Mensinger 971dfd664b
Added some cahced values 2019-04-28 14:33:21 +02:00
Daniel Mensinger dfe3d56bfd
Print '(cached)' when compiler result was cached 2019-04-28 14:33:21 +02:00
Daniel Mensinger 75b7a856cd
ast: support elementary object methods 2019-04-23 09:10:47 +02:00
Dylan Baker add821db64 Don't use mutable types as default arguments
This isn't safe given the way python implements default arguments.
Basically python store a reference to the instance it was passed, and
then if that argument is not provided it uses the default. That means
that two calls to the same function get the same instance, if one of
them mutates that instance every subsequent call that gets the default
will receive the mutated instance. The idiom to this in python is to use
None and replace the None,

def in(value: str, container: Optional[List[str]]) -> boolean:
   return src in (container or [])

if there is no chance of mutation it's less code to use or and take
advantage of None being falsy. If you may want to mutate the value
passed in you need a ternary (this example is stupid):

def add(value: str, container: Optional[List[str]]) -> None:
    container = container if container is not None else []
    container.append(value)

I've used or everywhere I'm sure that the value will not be mutated by
the function and erred toward caution by using ternaries for the rest.
2019-04-23 02:03:19 +03:00
Jussi Pakkanen ce160e1eab
Merge pull request #5250 from jon-turney/test-compiler-report
Add a report of compilers used to run_project_tests.py
2019-04-20 14:36:16 +03:00
Nirbheek Chauhan 2795f942be interpreter: Check the meson version before parsing options
Also add a test for it so we don't regress this in the future.

Closes https://github.com/mesonbuild/meson/issues/5281
2019-04-18 19:18:21 +00:00
Nirbheek Chauhan 10468b3a28 interpreter: Warn when environment() ops are overriden
Warn when someone tries to use append() or prepend() on an env var
which already has an operation set on it. People seem to think that
multiple append/prepend operations stack, but they don't.

Closes https://github.com/mesonbuild/meson/issues/5087
2019-04-13 22:53:33 +03:00
Jon Turney 3fc3695624
Push formatting of compiler version string down into Compiler class 2019-04-12 11:47:28 +01:00
Dylan Baker 0a0b473e84 interpreter: use container explosion where it makes sense
we can avoid writing code like:
a = c[0]
b = c[1]
by using:
a, b = c

or
a = c[0]
b = c[1:]
by using:
a, *b = c

This saves just a bit of code and is a teeny bit faster. But mostly
for less code
2019-04-12 00:24:51 +03:00
Dylan Baker 00a3bb8d69 interpreter: use zip function
Currently this is implemented as range(min(len(a), len(b)), an then
indexing into a and b to get what we actually want. Fortunately python
provides a function called zip that just does this.
2019-04-12 00:24:51 +03:00
TheQwertiest 38273ac668 Added deduplication for configurration time file dependencies (fixes #5190) 2019-04-02 22:46:03 +03:00
Rico Tzschichholz 201ef0778e Add 'is_default' to permitted_kwargs for add_test_setup()
This missing in 0821462ce3

See #4430
2019-04-01 20:48:59 +03:00
Jakub Adam 0ad5670895 Fix run_command() with command on a different drive
On Windows, program on a different drive than srcdir won't have
an expressible relative path; cmd_path will be absolute instead and
shouldn't get added into build_def_files.
2019-03-28 23:20:21 +02:00
Jussi Pakkanen 68567482f5 Maintain backwards compatibility for one release. Closes #5051.
Also, specify what the replacement is.
2019-03-27 20:44:17 +02:00
Jussi Pakkanen e2f4e926b2 Reduce absolute paths to a deprecation. Closes #5050. 2019-03-26 01:48:00 +02:00
John Ericson 3037ade41d Inline check_compilers
This function is used just once. It also seems all policy and no
mechanism (it raises, it calls the same function to do all the work
twice in a simple way). This makes it seem to be as a good candidate for
inlining.

`environment` and `coredata` are woefully intertwined and while this
change doesn't fix that, but at least it makes it easier to follow.
2019-03-24 13:33:27 +02:00
Jon Turney 8a9e1b1166 Disallow add_languages('vala') without 'c'
v2:
Exercise add_lanagues('vala') after 'c' in a test case
2019-03-22 20:04:50 +02:00
Jussi Pakkanen ed5992a10d
Merge pull request #5031 from bonzini/kconfig
Kconfig Module
2019-03-20 22:03:47 +02:00
Dylan Baker ac627bcea7 replace library type strings with an enum
This patch creates an enum for selecting libtype as static, shared,
prefer-static, or prefer-shared. This also renames 'static-shared'
with 'prefer_static' and 'shared-static' with 'prefer_shared'. This is
just a refactor with no behavioral changes or user facing changes.
2019-03-20 18:45:56 +02:00
Paolo Bonzini 66db1af4dd interpreter: allow passing dictionaries to holderify
This in turn allows modules to return dictionaries, since their return values
is automatically passed through holderify.
2019-03-15 11:41:49 +01:00
Niklas Claesson dd2c44cdf6 Add static as keyword to find_library 2019-03-11 20:56:52 +02:00
Jussi Pakkanen 65487f1599 Install header\'s subdir must not be absolute. 2019-03-04 01:49:28 +02:00
Paolo Bonzini 91f847d308 mtest: implement TAP parsing
This provides an initial support for parsing TAP output.  It detects failures
and skipped tests without relying on exit code, as well as early termination
of the test due to an error or a crash.

For now, subtests are not recorded in the TestRun object.  However, because the
TAP output goes on stdout, it is printed by --print-errorlogs when a test does
not behave as expected.  Handling subtests as TestRuns, and serializing them
to JSON, can be added later.

The parser was written specifically for Meson, and comes with its own
test suite.

Fixes #2923.
2019-03-02 09:07:54 +01:00
Paolo Bonzini 4b5cf3f7c5 interpreter: add "protocol" kwarg to test
This is the first step towards adding support for TAP.
2019-03-02 09:07:54 +01:00
John Ericson 2622e9ec32 Move some configuration classes out of environment.py
First of all, I'd like compilers and other modules that environment.py
currently imports to be able to take these without creating
hard-to-follow module cycles.

Second of all, environment.py's exact purpose seems a bit obscured.
Splitting the data types (and basic pure functions) from the more
complex logic that infers that data seems like a good way to separate
concerns.
2019-02-27 13:10:16 -08:00
Jussi Pakkanen 067ff7eeae Fall back to current interpreter when python3 not found. 2019-02-26 01:26:54 +02:00
John Ericson 3e9396f259 Fix cross static linker lookup
Need to search based off of `cross_comp`, not `comp`.

Fixes #4822
2019-02-14 11:18:55 -08:00
Dylan Baker 5b896ed70b allow setting directory locations in a native file
This allows the person running configure (either a developer, user, or
distro maintainer) to keep a configuration of where various kinds of
files should end up.
2019-02-11 12:50:32 -08:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Daniel Mensinger e1a83793ae CMake: Added support for CMAKE_MODULE_PATH and extra CMake args (closes #4779) 2019-02-01 00:25:21 +02:00
Nirbheek Chauhan 1575bd988a configure_file: Allow setting install_dir: false with deprecation
Also add location node for two more deprecations

See: https://github.com/mesonbuild/meson/pull/4489#issuecomment-459246879
2019-01-31 13:48:59 -05:00
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Nicolas Schneider 3fc8a0dc41 fix non-default option printing
Previously, the default option string was compared to the actual project
option that has been converted to the proper type. This lead to messages
like 'Option x is: true [default: true]'.

Fixes #4806.
2019-01-27 20:52:46 +02:00
Jan Tojnar 33d82201bd run_command: add env kwarg 2019-01-27 19:24:15 +02:00
Xavier Claessens 15cea55f5b Interpreter: Add a location to all mlog.warning() calls
Now that the current node is always available as self.current_node in
both function and method calls, it's easy to pass it to warning
messages.
2019-01-22 16:12:15 -05:00
Xavier Claessens 0d195cefa6 Interpreter: Add current_node to 'state' passed to module methods
The current node is useful to pass as location to mlog.warning().
2019-01-22 15:59:36 -05:00
Daniel Mensinger af38722f89 mintro: Introspection interpreter refactoring (#4733)
* Fixed spelling

* Merged the Buildoptions and Projectinfo interpreter

* Moved detect_compilers to Environment

* Added removed test case

* Split detect_compilers and moved even more code into Environment

* Moved set_default_options to coredata

* Small code simplification in mintro.run

* Move cmd_line_options back to `environment`

We don't actually wish to persist something this unstructured, so we
shouldn't make it a field on `coredata`. It would also be data
denormalization since the information we already store in coredata
depends on the CLI args.
2019-01-16 23:42:54 +02:00
Xavier Claessens 83766b3687 Fix flake8 errors 2019-01-16 11:16:46 -05:00
Xavier Claessens 815f1205a8 do_subproject: Improve log messages and formatting 2019-01-16 11:16:46 -05:00
Xavier Claessens af643d6409 extract_required_kwarg: Fix typo 2019-01-16 11:16:46 -05:00
Xavier Claessens 35f0f7090d dependency: Cleanup code by avoiding nested if blocks 2019-01-16 11:16:46 -05:00
Xavier Claessens 5dac8e51f4 dependency: Not all DependencyException means not-found dep 2019-01-16 11:16:46 -05:00
Xavier Claessens 335b87fcaa dependency: Add has_fallback variable 2019-01-16 11:16:46 -05:00
Xavier Claessens 1cd393c6e2 dependency_fallback: Set 'required' in subproject's kwargs
This makes error clearer because it stops exactly where the error occurs
during the subproject configuration.
2019-01-16 11:16:46 -05:00
Xavier Claessens 2867371f1a dependency_fallback: Pass display_name in arguments 2019-01-16 11:16:46 -05:00
Xavier Claessens bdf301d05b do_subproject: InvalidCode is always an error
Not need to catch exceptions in dependency_fallback(), it's already
handled in do_subproject(). This ensure subproject errors are handled
the same way when doing dependency() fallback and when doing
subproject().
2019-01-16 11:16:46 -05:00
Xavier Claessens f6a34c8aaf dependency_fallback: Simplify useless try block 2019-01-16 11:16:46 -05:00
Xavier Claessens b209a3cd8f dependencies: Avoid duplicated code
The dependency version from a subproject was checked in two different
places. Do it in get_subproject_dep().
2019-01-16 11:16:46 -05:00
Xavier Claessens a92b41fdcd dependencies: Remove version from cache key
We cannot have 2 different versions with all other kwargs being
identical. This simplifies a lot that code.
2019-01-16 11:16:46 -05:00
John Ericson b53c982b58 Build class should not duplicate compiler state
Compilers should be held by coredata, so this is just here for
convenience.
2019-01-14 00:16:36 +02:00
Marco Trevisan (Treviño) 95c1cdf776 interpreter: obey to the install argument in configure_file
If a configure_file has an install_dir set, the supported install
argument is ignored, while this should have actually higher priority
than the install_dir itself.
Also check that correct types are used for `install` and `install_dir`.

Add test to verify this.

Fixes #3983
2019-01-13 19:51:31 +02:00
Jon Turney 680d266591 Fix a typo in an error message 2019-01-11 20:58:43 +02:00
John Ericson 17a602a4ec Remove spurious case in interpreter
`need_cross_compiler = is_cross_build()`, so the condition is always
false.
2019-01-10 22:59:01 +02:00
Nicolas Schneider 3232f780d8 use same code for printing options in mconf and msetup
Also, options are now responsible for providing a suitable printable
representation of their value instead of handling this at the caller.
2019-01-06 19:41:24 -05:00