Commit Graph

966 Commits

Author SHA1 Message Date
Xavier Claessens 435db35962 interpreter: Don't force fallback when subproject failed to configure
Fixes: #7534
2020-08-12 13:38:55 +00:00
Xavier Claessens 2e4a2bb373 interpreter: Lower case languages before checking if 'c' is in the list
Fixes: #7495
2020-08-07 23:44:31 +03:00
John Ericson 2447a1132a Capitalize some constants in coredata
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-04 00:24:05 +03:00
Dylan Baker 591e6e94b9 Put machine file and cmd line parsing in Environment
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-01 22:00:06 -07:00
Dylan Baker bbba6a7f36 Allow setting built-in options from cross/native files
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-08-01 22:00:06 -07:00
Zbigniew Jędrzejewski-Szmek 3dea817a59 Only emit warning about "native:" on projects with minimum required version
'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-28 19:51:58 +02:00
Xavier Claessens 7f1e9b7492 summary: Wrap lines when printing lists
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-21 07:30:37 +00:00
Marc-André Lureau 1c945511eb Print a warning when importing a stabilized module 2020-07-19 17:53:32 +03:00
Xavier Claessens b510d644fe find_program: Do not use fallback when before parsing project()
Mesa is doing `project(... find_program() ...)` so
environment.wrap_resolver is not defined yet.
2020-07-04 13:57:51 +03:00
Xavier Claessens f66c8c35da qt: Fix has_tools() when required=False
Improve logs by making it clear when the program is found but has
wrong version.
2020-07-04 13:57:08 +03:00
Alexander Neumann 92075f5ef3 give user control of option skip_sanity_check 2020-07-04 13:31:25 +03:00
Xavier Claessens 7c90639078 interpreter: Don't abort if dep isn't required and sub didn't override 2020-07-01 09:51:57 -04:00
Xavier Claessens f7a07ee91a interpreter: Already configured fallback should be used for optional dep 2020-07-01 09:51:57 -04:00
Xavier Claessens 13316f99fe wrap: Refactor to split wraps dictionary into 3 separate dicts
It makes the code cleaner to have 3 separate dictionaries for
packagename, dependency and programs.
2020-07-01 09:51:57 -04:00
Xavier Claessens f08eed37cb find_program: Fallback if a wrap file provide the program name
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.
2020-07-01 09:51:57 -04:00
Xavier Claessens 288d1ae5a5 wrap: Do not fallback implicitly on optional dependency
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
2020-07-01 09:51:57 -04:00
Xavier Claessens 2a7f72885f wrap: Add 'provide' section 2020-07-01 09:51:44 -04:00
Xavier Claessens 56c9e95b04 Implicit dependency fallback when a subproject wrap or dir exists 2020-07-01 09:45:33 -04:00
Jussi Pakkanen 64f36613ef
Merge pull request #7231 from mensinda/cmOverride
cmake: Add more advanced subproject configuration options
2020-07-01 00:04:08 +03:00
Xavier Claessens 07d2331d23 interpreter: Allow dependecy or subproject name in force_fallback_for 2020-06-16 17:36:33 -04:00
Xavier Claessens 4180f04433 interpreter: Avoid new feature warning when using old has_exe_wrapper() 2020-06-16 15:04:03 -04:00
Mathieu Duponchelle 20709af4d2 interpreter: add support for --force-fallback-for
This new command line option allows specifying dependencies for
which to force fallback.

See the documentation for more information

Fixes: #7218
2020-06-16 13:45:40 -04:00
D Scott Phillips f6a842821b Fix python3 installed from the Windows Store
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.
2020-06-10 01:09:16 +03:00
Daniel Mensinger a2f94ca18b
cmake: Add more advanced subproject configuration options
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.
2020-06-05 11:45:05 +02:00
Jussi Pakkanen c61f75adbf
Merge pull request #6818 from mensinda/localPatch
Wrap: add local files support via *_filename
2020-05-27 23:42:30 +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
Dylan Baker d51551231f use FeatureNew.single_use
This is just slightly cleaner looking
2020-05-14 12:15:03 -07:00
Dylan Baker 06481666f4 interpreter: Replace some uses of mlog.deprecation with FeatureDeprecated
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.
2020-05-14 11:28:04 -07:00
Dylan Baker a63e36f7b1 interpreter: Rename has_exe_wrapper -> can_run_host_binaries
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.
2020-05-14 11:04:51 -07:00
Dylan Baker 85708facae
Merge pull request #6620 from jon-turney/test-output-check
Add a mechanism for validating meson output in tests
2020-05-13 11:32:28 -07:00
Jussi Pakkanen 4ea7c6ee12
Merge pull request #7064 from dcbaker/gtest-protocol
Add support for Gtest as a test protocol
2020-05-06 23:57:44 +03:00
Dylan Baker 083c5f6357 Add native support for gtest tests
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.
2020-05-04 11:33:19 -07:00
Jussi Pakkanen 9a6e79dc68
Merge pull request #7060 from dcbaker/install-script-targets
Allow meson.add_*_script to take additional types
2020-05-03 23:20:59 +03:00
Dylan Baker 28e3ce67ae Convert test protocol into an enum
This gives us better type safety, and will be important as we add more
test methods
2020-04-30 13:54:46 -07:00
James Hilliard d7c24ccddd Allow get_variable to still function when the fallback is a disabler. 2020-04-30 13:06:56 -07:00
Jon Turney b647ce1b63
Cosmetic tweak to error message for incdir() with an absolute path
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.
2020-04-30 20:11:34 +01:00
Jon Turney 1081738113
Check before compiler detection if 'c' language is present when adding 'vala'
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.
2020-04-30 20:11:33 +01:00
Jon Turney 6a5c6fb439
Be more careful about the use of repr() in error messages
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.
2020-04-30 20:11:32 +01:00
Dylan Baker c239ce31f5 allow postconf and dist scripts to use Files, ExternalPrograms, and
ConfigureFiles

These things are all known to be ready when these scripts are run, and
thus they can safely consume them.
2020-04-30 10:01:14 -07:00
Dylan Baker 2c0eaf5c4f interpreter: Allow install_script to use additional input types
This adds support for Files, CustomTarget, Indexs of CustomTargets,
ConfigureFiles, ExternalPrograms, and Executables.

Fixes: #1234
Fixes: #3552
Fixes: #6175
2020-04-30 10:01:14 -07:00
Benjamin Frye ad426547e8
Clarified error message for test(). (#7040)
Changes the error message for test() so it now reports the expected and actual number of parameters.

Fixes: #7029
2020-04-28 21:28:20 -07:00
Xavier Claessens 707d3a2e20 gnome: Fix usage of gobject-introspection as subproject 2020-04-28 14:39:59 -04:00
Eli Schwartz 76c36a64c3
dependency: log cached or skipped dependencies with reference to modules
* 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.
2020-04-28 02:06:39 +03:00
Xavier Claessens 39a69d1fb0 find_program: Fixes when the program has been overridden by executable
- 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.
2020-04-28 01:39:56 +03:00
Daniel Mensinger ccdf7f6d34
wrap: Add support for local files via only `*_filename` 2020-04-25 11:43:42 +02:00
John Ericson 278c294aa4 Compiler options per lang
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`.
2020-04-20 23:23:15 +03:00
Xavier Claessens f798207a9a interpreter: Correctly ignore def files in build directory
See https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/85.
2020-04-17 22:02:41 +00:00
Ariel D'Alessandro 55f02c1949 interpreter: find_program: Store program's name when not found
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>
2020-04-14 23:20:39 +03:00
Ariel D'Alessandro b1b3987d9c interpreter: Show program's name on run_command error message
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>
2020-04-14 23:20:39 +03:00
Xavier Claessens 1ba62c484d Fix requireed meson version for override_dependency() 2020-04-08 23:45:00 +03:00
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