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.
This fix the following common pattern, we don't want to implicitly
fallback on the first line:
foo_dep = dependency('foo', required: false)
if not foo_dep.found()
foo_dep = cc.find_library('foo', required : false)
if not foo_dep.found()
foo_dep = dependency('foo', fallback: 'foo')
endif
endif
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 is done with the new cmake subprojects options object
that is similar to the already exisiting configuration data
object. It is consumed by the new `options` kwarg of the
cmake.subproject function.
D lang compilers have an option -release (or similar) which turns off
asserts, contracts, and other runtime type checking. This patch wires
that up to the b_ndebug flag.
Fixes#7082
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.
This gives the version that the feature was deprecated in, and doesn't
print the warning if the project supports versions of meson in which the
project wasn't deprecated.
The implementation of this function has changed enough that the name
doesn't really reflect what it actually does. It basically returns true
unless you're cross compiling, need and exe_wrapper, and don't have one.
The original function remains but is marked as deprecated.
This makes one small change the meson source language, which is that it
defines that can_run_host_binaries will return true in build == host
compilation, which was the behavior that already existed. Previously
this was undefined in build == host compilation.
Gtest can output junit results with a command line switch. We can parse
this to get more detailed results than the returncode, and put those in
our own Junit output. We basically just throw away the top level
'testsuites' object, then fixup the names of the tests, and shove that
into our junit.
Cosmetic tweak to the error message for incdir() with an absolute path.
Don't split the message in the middle of a sentence at a point which may
or may not correspond to the terminal width.
For the sake of a consistent error message (irrespective of if 'valac' is
present or not), check if the 'c' language is present if we are adding
'vala' before (rather than after) we do compiler detection.
Generally, we'd want to use str() rather than repr() in error messages
anyhow, as that explicitly gives something designed to be read by
humans.
Sometimes {!r} is being used as a shortcut to avoid writing the quotes
in '{!s}'.
Unfortunately, these things aren't quite the same, as the repr of a
string containing '\' (the path separator on Windows) will have those
escaped.
We don't have a good string representation to use for the arbitrary
internal object used as an argument for install_data() when it's neither
a string nor file (which doesn't lead to a good error message), so drop
that for the moment.
This adds support for Files, CustomTarget, Indexs of CustomTargets,
ConfigureFiles, ExternalPrograms, and Executables.
Fixes: #1234Fixes: #3552Fixes: #6175
* dependency: log cached or skipped dependencies with reference to modules
If the dependency is a special dependency which takes modules, the
modules get cached separately and probably reference different
pkg-config files. It's very plausible that we have multiple
dependencies, using different modules. For example:
Run-time dependency qt5 (modules: Core) found: YES 5.14.2 (pkg-config)
Dependency qt5 skipped: feature gui disabled
Obviously this makes no sense, because of course we found qt5 and even
used it. The second line is a lot more readable if it shows this:
Dependency qt5 (modules: Widgets) skipped: feature gui disabled
Similar confusion abounds in the case where a module is found in the
cache -- which module, exactly, has been found here:
Dependency qt5 found: YES 5.14.2 (cached)
Rewrite the dependency function to *consistently* pass around (and use!)
the display_name even in cases where we know it isn't anonymous (this is
just more correct anyway), and make it serve a dual purpose by also
appending the list of modules just like we do for pretty-printing that a
dependency has just been found for the first time.
* fixup! dependency: log cached or skipped dependencies with reference to modules
pointlessly cast modules to str, as they cannot be anything else. But we
want to fail later on, with something more friendly than a stacktrace.
boost/wx have special exceptions for people passing an integer there.
- ExternalProgramHolder has path() method while CustomTargetHolder and
BuildTargetHolder have full_path().
- The returned ExternalProgramHolder's path() method was broken, because
build.Executable object has no get_path() method, it needs the
backend.
- find_program('overridden_prog', version : '>=1.0') was broken because
it needs to execute the exe that is not yet built. Now assume the
program has the (sub)project version.
- If the version check fails, interpreter uses
ExternalProgramHolder.get_name() for the error message but
build.Executable does not implement get_name() method.
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`.
Currently, looking for a nonexisting program using find_program() will
return an NonExistingExternalProgram instace with the default name
'nonexistingprogram'. Let's store the target program's name in it, so it
can be printed if needed.
Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Currently, the error message is printing the object itself. Showing the
program's name is better.
Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
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.