When meson is currently being run with a python that seems to have been
installed from the Windows Store, replace the general WindowsApps
directory in search paths with dirname(sys.executable), and also handle
failures with pathlib.resolve on WindowsApps exe files.
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.
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.
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.
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.
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.
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().
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).
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.
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.
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>
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!
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
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
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.
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.
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>