aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
AgeCommit message (Collapse)AuthorFilesLines
2020-11-21Handle cmake dependencies which require a specified versionJason Ekstrand1-0/+2
Some CMake packages fail to find at all if no version is specified. This commit adds a cmake_version parameter to dependency() to allow you to specify the requested version.
2020-11-17add warning for projects with manually specified -WerrorEli Schwartz1-0/+3
Point people to the "werror" builtin option.
2020-11-13Do not warn when -Wpedantic is added as a project argument.Eli Schwartz1-1/+5
The only way to add it via warning_level is top opt in to -Wextra too. But this is often not really desirable, since -Wextra is not stable -- it changes its meaning every compiler release, thus mysteriously adding new warnings. Furthermore, it's not really the same kind of warning -- a pedantic warning is always correct that your code is wrong, but defines wrongness as "not per the portable standard". Unlike -Wextra it doesn't try to judge your code to see if you're doing something that is "often not what you meant", but is prone to false positives. Really, we need different *kinds* of warning levels, possibly as an array -- not just a monotonically increasing number. But since there's currently nothing flexible enough to specify -Wpedantic without -Wextra, we will just remove the warning for the former, and let people add it to their project arguments in peace.
2020-11-13The version kwarg must be a string. Closes #7975.Jussi Pakkanen1-0/+2
2020-11-12interpreter: Add get_keys function for configuration_data (#7887)Jones1-0/+5
2020-11-01interpreter: store correct files for project regenerationDylan Baker1-6/+18
Right now sub-sub projects are not correctly registered, because we don't have a way to pass up past the first level of subproject. This patch changes that by making the build_Def_files as defined in the Interpreter initializer accurate for translated dependencies, ie, cmake dependencies won't define a dependency on a non-existent meson.build. This means that it can always add the subi.build_def_files because they are always accurate.
2020-10-19interpreter: Add missing new feature flag for executable(win_subsystem)Dylan Baker1-1/+2
I noticed this when reviewing #7872
2020-10-19switch gui_app deprecation to FeatureDeprecatedKwargsPaolo Bonzini1-0/+1
The deprecation message for "gui_app" is appearing for every target rather than just once, and even if the required version is older than 0.56.0. Use @FeatureDeprecatedKwargs to fix both issues.
2020-10-16Refactor handling of machine file optionsXavier Claessens1-3/+2
It is much easier to not try to parse options into complicated structures until we actually collected all options: machine files, command line, project()'s default_options, environment.
2020-10-16Fix consistency in variables kwargXavier Claessens1-6/+27
Share common code to extract the `variables` kwarg in declare_dependency() and pkg.generate().
2020-10-13Add wrap mode to disable auto promoteXavier Claessens1-6/+7
2020-10-13interpreter: Improve message when fallback dependency is not foundXavier Claessens1-32/+48
- Log the message before raising the exception. - Add a reason when the dependency is not found because the subproject failed to configure, because it was not obvious in the case the subproject failed to configure earlier while looking for an optional dependency. - Avoid double message when the subproject has overriden the dependency and we provided the fallback variable as well.
2020-10-13Merge wraps from subprojects into wraps from main projectXavier Claessens1-60/+34
wraps from subprojects are now merged into the list of wraps from main project, so they can be used to download dependencies of dependencies instead of having to promote wraps manually. If multiple projects provides the same wrap file, the first one to be configured wins. This also fix usage of sub-subproject that don't have wrap files. We can now configure B when its source tree is at `subprojects/A/subprojects/B/`. This has the implication that we cannot assume that subproject "foo" is at `self.subproject_dir / 'foo'` any more.
2020-10-13interpreter: Rename dirname to subp_nameXavier Claessens1-65/+65
dirname is confusing because the name of a subproject does not always match its directory name, the wrap file can define another directory. For example foo.wrap will often extract the subproject into foo-1.2 directory, in that case the subproject name is 'foo' and the subproject directory is 'foo-1.2'.
2020-10-13include_type: honor include_type in dependency fallbacks (fixes #7503)Daniel Mensinger1-0/+8
2020-10-13mtest: Allow filtering tests by subprojectNirbheek Chauhan1-4/+9
You could always specify a list of tests to run by passing the names as arguments to `meson test`. If there were multiple tests with that name (in the same project or different subprojects), all of them would be run. Now you can: 1. Run all tests with the specified name from a specific subproject: `meson test subprojname:testname` 1. Run all tests defined in a specific subproject: `meson test subprojectname:` Also forbid ':' in test names. We already forbid this elsewhere, so should not be a big deal.
2020-10-08dependency: support boolean argument "allow_fallback"Paolo Bonzini1-3/+12
Sometimes, distros want to configure a project so that it does not use any bundled library. In this case, meson.build might want to do something like this, where slirp is a combo option with values auto/system/internal: slirp = dependency('', required: false) if get_option('slirp') != 'internal' slirp = dependency('slirp', required: get_option('slirp') == 'system') endif if not slirp.found() slirp = subproject('libslirp', ...) .variable('...') endif and we cannot use "fallback" because the "system" value should never look for a subproject. This worked until 0.54.x, but in 0.55.x this breaks because of the automatic subproject search. Note that the desired effect here is backwards compared to the policy of doing an automatic search on "required: true"; we only want to do the search if "required" is false! It would be possible to look for the dependency with `required: false` and issue the error manually, but it's ugly and it may produce an error message that looks "different" from Meson's. Instead, with this change it is possible to achieve this effect in an even simpler way: slirp = dependency('slirp', required: get_option('slirp') != 'auto', allow_fallback: get_option('slirp') == 'system' ? false : ['slirp', 'libslirp_dep']) The patch also adds support for "allow_fallback: true", which is simple and enables automatic fallback to a wrap even for non-required dependencies.
2020-10-08interpreter: clean up handling of force_fallbackPaolo Bonzini1-13/+12
Force_fallback is not an interpreter keyword argument, and there is no reason to handle it as one since it is not used anywhere else (and in fact is explicitly ignored by get_dep_identifier). Use a Python keyword argument instead, which makes the code simpler.
2020-10-08interpreter: refactor handling of dependency(fallback: ...)Paolo Bonzini1-21/+22
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-10-04cmake: switch to pathlib (fixes #7322)Daniel Mensinger1-1/+1
2020-10-01deprecated get_configtool_variable and get_pkgconfig_variableDylan Baker1-0/+4
The get_variable method is able to do everything they do and more, making it generally more useful. Let's tell people to stop using the old ones.
2020-09-28Add meson.project_build/source_root() methodsXavier Claessens1-0/+22
2020-09-23Deprecate meson.build_root() and meson.source_root()Xavier Claessens1-0/+2
Those function are common source of issue when used in a subproject because they point to the parent project root which is rarely what is expected and is a violation of subproject isolation.
2020-09-14InternalDependency: Add as_link_whole() methodXavier Claessens1-0/+10
2020-09-13external-project: New module to build configure/make projectsXavier Claessens1-0/+4
This adds an experimental meson module to build projects with other build systems. Closes: #4316
2020-09-13Allow installing dir from build dirXavier Claessens1-1/+3
2020-09-10Identify machine in error accesing compiler object for missing languageJon Turney1-1/+1
Also add a failing test case for that error.
2020-09-10Don't require build machine compilers for project() languagesJon Turney1-1/+3
This means that, in the common case of a simple meson.build which doesn't contain any 'native: true' targets, we won't require a native compiler when cross-compiling, without needing any changes in the meson.build.
2020-09-08typing: more fixesDaniel Mensinger1-14/+28
2020-09-02Special case meson.version().version_compare() statementXavier Claessens1-2/+2
when that statement gets evaluated, the interpreter remembers the version target and if it was part of the evaluation of a `if` condition then the target meson version is temporally overriden within that if-block. Fixes: #7590
2020-08-20interpreter: Do not get variable on failed subprojectXavier Claessens1-4/+9
Fixes: #7620
2020-08-20simplify shutil usage by invoking copy2 where appropriateEli Schwartz1-2/+1
It's equivalent to copyfile + copystat with the same arguments.
2020-08-18Interpreter: Fix c_stdlib usageXavier Claessens1-24/+25
- 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.
2020-08-15find_library: Print type of library not foundNirbheek Chauhan1-2/+7
If we can't find a static library, we should say that. It's confusing otherwise.
2020-08-12interpreter: Don't force fallback when subproject failed to configureXavier Claessens1-1/+2
Fixes: #7534
2020-08-07interpreter: Lower case languages before checking if 'c' is in the listXavier Claessens1-1/+1
Fixes: #7495
2020-08-04Capitalize some constants in coredataJohn Ericson1-1/+1
I've been getting confused between them and similarly-named other things, so I figured it was high time to clean this up.
2020-08-01Put machine file and cmd line parsing in EnvironmentDylan Baker1-3/+5
This creates a full set of option in environment that mirror those in coredata, this mirroring of the coredata structure is convenient because lookups int env (such as when initializing compilers) becomes a straight dict lookup, with no list iteration. It also means that all of the command line and machine files are read and stored in the correct order before they're ever accessed, simplifying the logic of using them.
2020-08-01Allow setting built-in options from cross/native filesDylan Baker1-0/+1
This is like the project options, but for meson builtin options. The only real differences here have to do with the differences between meson builtin options and project options. Some meson options can be set on a per-machine basis (build.pkg_config_path vs pkg_config_path) others can be set on a per-subproject basis, but should inherit the parent setting.
2020-07-28Only emit warning about "native:" on projects with minimum required versionZbigniew Jędrzejewski-Szmek1-2/+5
'native:' keyword was only added in 0.54. For projects declaring meson_version >= 0.54, warn, because those projects can and should set the keyword. For older projects declaring support for older versions, don't warn and use the default implicitly. Fixes https://github.com/mesonbuild/meson/issues/6849.
2020-07-21summary: Wrap lines when printing listsXavier Claessens1-5/+29
When a list_sep is provided (e.g. ', ') all items are printed on the same line, which gets ugly on very long lists (e.g. list of plugins enabled).
2020-07-19Print a warning when importing a stabilized moduleMarc-André Lureau1-7/+17
2020-07-04find_program: Do not use fallback when before parsing project()Xavier Claessens1-1/+1
Mesa is doing `project(... find_program() ...)` so environment.wrap_resolver is not defined yet.
2020-07-04qt: Fix has_tools() when required=FalseXavier Claessens1-2/+6
Improve logs by making it clear when the program is found but has wrong version.
2020-07-04give user control of option skip_sanity_checkAlexander Neumann1-4/+4
2020-07-01interpreter: Don't abort if dep isn't required and sub didn't overrideXavier Claessens1-2/+6
2020-07-01interpreter: Already configured fallback should be used for optional depXavier Claessens1-3/+5
2020-07-01wrap: Refactor to split wraps dictionary into 3 separate dictsXavier Claessens1-1/+1
It makes the code cleaner to have 3 separate dictionaries for packagename, dependency and programs.
2020-07-01find_program: Fallback if a wrap file provide the program nameXavier Claessens1-25/+58
We don't need the legacy variable name system as for dependency() fallbacks because meson.override_find_program() is largely used already, so we can just rely on it.