Commit Graph

952 Commits

Author SHA1 Message Date
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
Xavier Claessens aa840afb3a Always flatten include_directories lists 2019-01-06 19:24:05 +02:00
John Ericson 2b22576fb6 Remove cross_info; cross file is parsed up front and discarded 2019-01-02 16:22:47 -05:00
John Ericson dbf080afe9 Get rid of `need_cross_compiler`
Building a cross compiler (`build == host != target`) is not cross
compiling. As such, it doesn't make sense to handle it under
`is_cross_build`.

(N.B. Building a standard library for a cross compiler would require
cross compiling, but Meson has support to do such a thing as part of a
compiler build currently.)
2019-01-02 16:11:02 -05:00
Jussi Pakkanen 3a6e2aeed9 Can use plain strings for include_directories. 2019-01-02 22:29:08 +02:00
Daniel Mensinger 10ce5deb71
Introspection refactoring 2018-12-29 23:55:45 +01:00
Jussi Pakkanen ab3aeeffe9 Print warning if using "default_options" without a "fallback". 2018-12-30 00:50:45 +02:00
Xavier Claessens b6cede2928 find_library: Add 'has_headers' kwarg
A library without its headers is often useless, so it is common to check
them together.
2018-12-27 23:06:28 -05:00
Xavier Claessens ff2aa5a9ef Add 'required' kwarg in header check functions
Closes: #3940
2018-12-24 11:12:11 -05:00
Jussi Pakkanen 4df9006ca4 Can specify a string to print when dep not found. Closes #2407. 2018-12-22 19:00:40 +02:00
Jussi Pakkanen 7d5660dcbe Reformat long lines. 2018-12-22 19:00:40 +02:00
John Ericson 9b13fb3672 Factor out more option iterating 2018-12-20 23:01:36 +02:00
Daniel Mensinger 9958262cb2 Fixed subprojects build info 2018-12-19 18:04:49 -05:00
Xavier Claessens 47b9c1a564 Allow fallback in nodownload mode
It is possible that the subproject has been downloaded already, in that
case there is no reason to not use it. If the subproject has not been
downlaoded already it will fail do_subproject().
2018-12-19 10:21:31 +02:00
Jussi Pakkanen b0611bdd9a
Merge pull request #3061 from jon-turney/introspect-custom-target-files
Fix 'meson introspect --target-files' for a custom target
2018-11-28 21:58:11 +02:00
Dylan Baker 42ddc30cfe interpreter: allow find_program to use the native file 2018-11-14 15:57:37 -08:00
Dylan Baker 95403cb615 replace ExternalProgram.from_cross_info with from_bin_list
This more generic method will also be used to check a config file for
binary information.
2018-11-14 15:57:37 -08:00
Dylan Baker de175aac00 compilers: Use keyword only arguments for compiler interfaces
Because we need to inherit them in some cases, and python's
keyword-or-positional arguments make this really painful, especially
with inheritance. They do this in two ways:

1) If you want to intercept the arguments you need to check for both a
   keyword and a positional argument, because you could get either. Then
   you need to make sure that you only pass one of those down to the
   next layer.

2) After you do that, if the layer below you decides to do the same
   thing, but uses the other form (you used keyword by the lower level
   uses positional or vice versa), then you'll get a TypeError since two
   layers down got the argument as both a positional and a keyword.

All of this is bad. Fortunately python 3.x provides a mechanism to solve
this, keyword only arguments. These arguments cannot be based
positionally, the interpreter will give us an error in that case.

I have made a best effort to do this correctly, and I've verified it
with GCC, Clang, ICC, and MSVC, but there are other compilers like Arm
and Elbrus that I don't have access to.
2018-11-13 00:40:13 +02:00
Stian Selnes 0821462ce3 Add kwarg is_default to add_test_setup()
is_default may be used to set the name of the test setup that will be
used by default whenever the option --setup is not given.

Fixes #4430
2018-11-12 16:23:59 +05:30
Jon Turney bb31a8c1c7
Only add link arguments when needed in Compiler object methods
Currently, ComplierHolder.determine_args() unconditionally adds the link
arguments to the commmand, even if we aren't linking, because it doesn't
have access to the mode (preprocess, compile, link) that
_get_compiler_check_args() will use.

This leads to command lines like:

'cl testfile.c /nologo /showIncludes /c /Fooutput.obj /Od kernel32.lib
user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib comdlg32.lib advapi32.lib'

which clang-cl considers invalid; MSVS cl accepts this, ignoring the
unneeded libraries

Change from passing extra_args down to _get_compiler_check_args(), to
passing down a callback to CompilerHolder.determine_args() (with a bound
kwargs argument), so it can consult mode and kwargs to determine the args to
use.
2018-11-04 15:42:06 +00:00
Dylan Baker 63f4f9481e Add new compiler.get_argument_syntax method
Some compilers try very had to pretend they're another compiler (ICC
pretends to be GCC and Linux and MacOS, and MSVC on windows), Clang
behaves much like GCC, but now also has clang-cl, which behaves like MSVC.

This method provides an easy way to determine whether testing for MSVC
like arguments `/w1234` or gcc like arguments `-Wfoo` are likely to
succeed, without having to check for dozens of compilers and the host
operating system, (as you would otherwise have to do with ICC).
2018-11-03 18:10:36 +02:00
Dylan Baker 8cd7f7871b interpreter: Don't warn about clang b_undef and b_sanitizer if sanitizer is none
Since the "none" sanitizer isn't actually a sanitizer at all.
2018-11-02 23:20:40 +02:00
Jussi Pakkanen 23ed0e1857 Make string division do path joining. 2018-11-02 21:02:25 +02:00
Nirbheek Chauhan a52cd31a6c Print dependencies being used for compiler checks
It is a common idiom to look for a function or a specific type or
a header in various locations/libraries, and it can be confusing to
see the (seemingly) identical compiler check being done multiple
times.

Now we print the dependencies being used when a compiler check is run

Before:
Checking for function "fbGetDisplay": NO
Checking for type "GLeglImageOES": YES
Checking for function "asinh": YES

After:
Checking for function "fbGetDisplay" with dependency egl: NO
Checking for type "GLeglImageOES" with dependencies glesv2, gl: YES
Checking for function "asinh" with dependency -lm: YES
2018-10-29 21:44:46 +02:00
Xavier Claessens edccb11f01 Rollback if an optional subproject fails
If a subproject is not required and fails during its configuration, the
parent project continues, but should not include any target or state set
by the failed subproject. This fix ninja still trying to build targets
generated by subprojects before they fail in their configuration.

The 'build' object is now per-interpreter instead of being global. Once
a subproject interpreter succeed, values from its 'build' object are
merged back into its parent 'build' object.
2018-10-29 20:22:33 +02:00
Xavier Claessens 61348da069 Add 'disabler' argument to functions returning not-found objects
When dependency(), find_library(), find_program(), or
python.find_installation() return a not-found object and disabler is
true, they return a Disabler object instead.
2018-10-23 22:09:55 +03:00
Xavier Claessens 3f98ad8eed wrap: Improve error handling and logging 2018-10-18 11:42:17 -04:00
Jon Turney a0a0c244e2 os.path.relpath() can fail on Windows
If builddir and sourcedir have different drive letters, a relative path
doesn't exist, and os.path.relpath fails with a ValueError exception.

This just fixes the places which are hit by test cases in a simple-minded
way.  There are several other uses of os.path.relpath(), which might be
suspect.
2018-10-10 19:43:24 +03:00
Xavier Claessens 38a6582145 configure_file: Support taking values from a dict
Closes #4218
2018-10-08 21:03:32 +03:00
Jussi Pakkanen 4d986563dc Expose wrap_mode as an option. Closes #4266. 2018-10-07 22:52:54 +03:00
Jussi Pakkanen 85efd363cb
Merge pull request #3900 from xclaesse/in-operator
Interpreter: Add "in", "not in", "break", and "continue" operators
2018-10-07 20:02:03 +03:00
Xavier Claessens 091e079354 dependency variable from subproject could be not-found
When using a subproject as fallback for a required dependency, we should
check if the dependency object we get from the subproject is found.
2018-10-07 19:35:11 +03:00
Christoph Behle c0236e10f3 Substitute output file then check for conflict.
Fixes Issue #4323.
The check to see if a call to configure_file() overwrites the output of
a preceding call should perform the substitution for the output file
before doing the check.

Added tests to ensure the proper behaviour.
2018-10-07 19:06:01 +03:00
Xavier Claessens fa2e096aa0 Interpreter: Add "in" and "not in" operators
Closes: #3600
2018-10-04 20:14:37 -04:00
John Ericson 1c6b8b72cb Centralize description of build, host, and target, machines
Instead of just putting these together in the interpreter, put them
together in `environment.py` so Meson's implementation can also better
take advantage of them.
2018-10-05 00:14:44 +03:00
Jan Tojnar c0c075c129 Make custom dist scripts accept arguments.
meson.add_dist_script, introduced in #3906, did not accept any arguments
other than script name. Since all other meson.add_*_script methods
do accept args, this makes the dist script accept them as well.
2018-10-04 21:20:57 +03:00
Xavier Claessens 6112e6a815 Fix version check when passing feature option to find_installation() 2018-09-17 11:37:14 -04:00
Jon Turney e702d754b1
Tolerate custom target sources which can't be converted to Files
For backwards compatibility, tolerate but warn about custom target sources
which can't be converted to Files
2018-09-15 16:23:20 +01:00
Jussi Pakkanen 0a1468f8f3
Convert custom target sources to Files with self.source_strings_to_files. 2018-09-15 15:39:08 +01:00
Dylan Baker 51e9db370a Add method to check for C/C++ function attributes
It's fairly common on Linux and *BSD platforms to check for these
attributes existence, so it makes sense to me to have this checking
build into meson itself. Autotools also has a builtin for handling
these, and by building them in we can short circuit cases that we know
that these don't exist (MSVC).

Additionally this adds support for two common MSVC __declspec
attributes, dllimport and dllexport. This implements the declspec
version (even though GCC has an __attribute__ version that both it and
clang support), since GCC and Clang support the MSVC version as well.
Thus it seems reasonable to assume that most projects will use the
__declspec version over teh __attribute__ version.
2018-09-07 11:52:15 -07:00
Nirbheek Chauhan 68cfe1bb52 Test + fix for not-found dependency fallback version comparison
Fixes:
meson.build:6:0: ERROR:  Uncomparable version string 'unknown'.

This was previously partially fixed in a8694f4b, which only fixed it
for cached fallback dependencies.
2018-09-04 22:50:17 -07:00
Rafael Ávila de Espíndola 07d2d88fa9 Allow override_find_program to use an executable.
With this it is now possible to do

foobar = executable('foobar', ...)
meson.override_find_program('foobar', foobar)

Which is convenient for a project like protobuf which produces both a
dependency and a tool. If protobuf is updated to use
override_find_program, it can be used as

protobuf_dep = dependency('protobuf', version : '>=3.3.1',
                          fallback : ['protobuf', 'protobuf_dep'])
protoc_prog = find_program('protoc')
2018-09-03 21:24:01 +03:00
Alexis Jeandet 73a5b4332d Meson should warn if b_lundef is mixed with any sanitizer with clang
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-09-02 18:21:44 +03:00
Jussi Pakkanen b86f2fd17f
Merge pull request #4016 from thiblahute/hotdoc
modules: Add an 'hotdoc' module
2018-08-29 21:18:26 +03:00
Jussi Pakkanen fb770e1e3d Add support for custom dist scripts. 2018-08-27 23:35:29 +03:00
Jussi Pakkanen 1ffc8de5e8
Merge pull request #3981 from GoaLitiuM/d-win-fixes
Fix D support on Windows
2018-08-27 22:30:23 +03:00
Thibault Saunier 731906504e Add a `required` argument to `subproject`
Allowing to use the new "feature" option type and allowing not to fail
on subproject if it is not necessary to fail.

By default subprojects are "required" so previous behaviour is not
changed.

Fixes #3880
2018-08-27 21:37:18 +03:00
Jon Turney 0f568cc8d5
Don't use version to check for a not-found fallback
In _find_cached_fallback_dep(), actually check if dependency is not found,
rather than using a specific version as a proxy for that.
2018-08-26 17:23:39 +01:00
Xavier Claessens 3f3ae097d5
Merge pull request #3769 from xclaesse/command-line-step2
Command line step2
2018-08-23 09:12:27 -04:00
Jussi Pakkanen 54aed1a92c Added "native" kwarg to add_XXX_args. Closes #3669. 2018-08-22 23:22:48 +03:00
Xavier Claessens fda99b08a4 interpreter: Simplify get_option_internal() and fix base option fallback
The fallback to compilers.base_options was done after optname is changed
to have subproject prefix. Simplify the code by looping over all
dictionaries and only keep user_options separate because that one is
special.
2018-08-22 15:15:54 -04:00
GoaLitiuM 9d5448ab45 Normalize string constructs of d_import_dirs paths
Fixes skipped deprecation warnings of badly constructed d_import_dirs on Windows.
2018-08-20 22:27:31 +03:00
Thibault Saunier 221ac05c69 interpreter: Also process *TargetHolder returned by modules
The module might need to add extra methods on the returned targets
and thus it can return TargetHolders, we should process the
held targets
2018-08-18 09:04:08 -03:00
Thibault Saunier a95763c715 interpreter: Handle 'bool, str, int' values returned by modules 2018-08-18 09:04:08 -03:00
Nirbheek Chauhan 219dec39c0 Fix yielding when subproject option type is different
Earlier, we would replace the subproject option with the parent
project's option, which is incorrect if the types are not the same.

Now we retain the subproject's option and print a warning. It's not
advisable to issue an error in this case because subproject option
yielding is involuntary for the parent project (option names can match
because of coincidences).
2018-08-14 23:06:55 +03:00
Jussi Pakkanen f91b463bf4
Merge pull request #3831 from mesonbuild/symvisibility
Add gnu_symbol_visibility keyword argument
2018-08-11 19:59:34 +03:00
Nirbheek Chauhan ecede89b5d Fix FeatureNew false positive in vcs_tag
Fixes https://github.com/mesonbuild/meson/issues/3904
2018-08-11 09:15:05 -07:00
Jussi Pakkanen fb2cdd0fe2 Call it gnu_symbol_visibility instead. 2018-08-09 19:46:49 +03:00
Jussi Pakkanen 6a0e674043 Add kwarg for specifying symbol visibility. 2018-08-09 19:46:49 +03:00
Nirbheek Chauhan a8694f4b26 Don't check version for fallback not-found dependency
Otherwise we get an error while checking the subproject version:

  Uncomparable version string 'none'.

If the dependency was found as a not-found dependency in the
subproject and is not required, just take it.
2018-08-08 19:31:13 +03:00
Nirbheek Chauhan 8402a22233 Test that vim syntax highlighting is up-to-date
Needs a `mock` kwarg to Interpreter to not do any parsing of build
files, but only setup the builtins and functions.

Also consolidate the documentation and data tests into one class.
2018-08-07 12:54:56 -07:00
Patrick Griffis e45ab8b24c Fix missing permitted kwarg
get_pkgconfig_variable() takes a 'default' keyword
2018-08-07 06:38:43 -07:00
Nirbheek Chauhan a2dab5439c custom targets: Add a 'console' kwarg for long-running commands
Ninja buffers all commands and prints them only after they are
complete. Because of this, long-running commands such as `cargo
build` show no output at all and it's impossible to know if the
command is merely taking too long or is stuck somewhere.

To cater to such use-cases, Ninja has a 'pool' with depth 1 called
'console', and all processes in this pool have the following
properties:

1. stdout is connected to the program, so output can be seen in
   real-time
2. The output of all other commands is buffered and displayed after
   a command in this pool finishes running
3. Commands in this pool are executed serially (normal commands
   continue to run in the background)

This feature is available since Ninja v1.5

https://ninja-build.org/manual.html#_the_literal_console_literal_pool
2018-07-31 19:38:54 +03:00
Jussi Pakkanen e75f6e4305
Merge pull request #3850 from mesonbuild/nirbheek/exe-wrapper-compiler-fallbacks
Be more permissive about not-found exe_wrapper
2018-07-31 19:33:06 +03:00
Nirbheek Chauhan 0ea21d7aea Add a feature-new entry for UserFeatureOption
Since we can't detect it in meson_options.txt, detect it when the
option is used.
2018-07-25 08:02:49 -07:00
Jussi Pakkanen 306fa07f62
Merge pull request #3893 from FFY00/master
Add dlang module (dub support)
2018-07-21 02:46:11 +03:00
Jussi Pakkanen f390a0a2f3
Merge pull request #3814 from behlec/configure-file-output
Check if calls to configure_file write to the same output file.
2018-07-19 01:17:34 +03:00
Nirbheek Chauhan 416a00308f cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
2018-07-09 04:09:46 +05:30
Nirbheek Chauhan 78f1ef85fd
Add missing method on external library object: type_name() (#3845)
For some reason this was missing, but it should've always existed
since cc.find_library() returns an object that is internally an
ExternalDependency instance.
2018-07-08 10:58:07 -07:00
Christoph Behle 430506f814 Use mlog.bold to add quotes 2018-07-08 19:46:36 +02:00
Christoph Behle 2f494d2ccf Simplified and cleaned up warning. 2018-07-08 18:19:17 +02:00
Christoph Behle 2d5e1e24a1 Consider subdir for output files.
Files will only clash if in the same subdir.
Print the subdir in the warning.
2018-07-07 21:20:23 +02:00
Christoph Behle 620c0b07a9 Track line numbers for configure_file.
Track line numbers of calls. Warning reports now the line number of the
first and the current write to the same file.
2018-07-07 21:20:23 +02:00
Christoph Behle 07f5a5e490 Add warning if configure_file overwrites output.
Record the output for each call to configure_file.
If a previous output is overwritten print a warning.
2018-07-07 21:20:23 +02:00
Nirbheek Chauhan 2093d45a4e Print a more usable message when a subproject fails to configure
Instead of just printing the message in the exception, if it's
a MesonException, also print the file and the line number. If it's an
unknown exception, print the entire traceback so that we can pin-point
what the Meson bug causing it is.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 80392225a6 Raise a MesonException when substituting an invalid value
Avoids throwing a traceback. Also, warn when setting such a value.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 4fb00ee1d8 Add new method: mlog.deprecation()
Instead of constructing it manually, use a helper.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 1415cd2d07 mlog: Add built-in support for quoting bolded messages
This allows us to drop wonky sep='' hacks and manual addition of
spaces across the codebase.
2018-07-06 06:25:12 +00:00
Nirbheek Chauhan 602e58d398 configure_file: Don't optimize away substitutions
It's possible that the configuration data object has components added
conditionally, and that sometimes an empty configuration data object
is passed on purpose.

Instead, we do the substitution and also warn if no tokens were found
that could've been substituted.

Closes https://github.com/mesonbuild/meson/issues/3826
2018-07-04 00:25:01 +00:00
Nirbheek Chauhan d6a9b4cc79 Contributing.md: Document procedure for new features [skip ci] 2018-07-02 19:52:53 +05:30
Nirbheek Chauhan a1d9adba09 FeatureNew: Make all checks subproject-specific
We now pass the current subproject to every FeatureNew and
FeatureDeprecated call. This requires a bunch of rework to:

1. Ensure that we have access to the subproject in the list of
   arguments when used as a decorator (see _get_callee_args).
2. Pass the subproject to .use() when it's called manually.
3. We also can't do feature checks for new features in
   meson_options.txt because that's parsed before we know the
   meson_version from project()
2018-07-02 19:52:53 +05:30
Nirbheek Chauhan a524524ac0 interpreter: Use is_subproject() everywhere 2018-07-02 07:05:08 +00:00
Nirbheek Chauhan 907a68bcf1 FeatureNew: Fix method names for some feature checks 2018-07-02 07:05:08 +00:00
Salamandar df1970d3ad Various bug fixes for FeatureNew
* Use _get_callee_args to unwrap function call arguments, needed for
  module functions.

* Move some FeatureNewKwargs from build.py to interpreter.py

* Print a summary for featurenew only if conflicts were found. The
  summary now only prints conflicting features.

* Report and store featurenew/featuredeprecated only once

* Fix version comparison: use le/ge and resize arrays to not fail on
  '0.47.0>=0.47'

Closes https://github.com/mesonbuild/meson/issues/3660
2018-07-02 07:05:08 +00:00
Jussi Pakkanen dc683218a4
Proper error message for non-found exe in run_target. Closes #3818 2018-07-01 19:45:03 +03:00
Nirbheek Chauhan ec29f19c12 Add a helper for fetching of binaries from cross files
A number of cases have to be taken care of while doing this, so
refactor it into a helper on ExternalProgram and use it everywhere.

1. Command is a list of len > 1, use it as-is
2. Command is a list of len == 1 (or a string), use as a string
3. If command is an absolute path, use it as-is
4. If command is not an absolute path, search for it
2018-07-01 13:59:48 +00:00
Nirbheek Chauhan ae8d044cb6 Allow command lists for find_program cross file overrides
This is accepted by all other binaries in the cross file. With this
change, we also don't check whether the specified command exists at
configure time, but that's probably a feature anyway.

Fixes https://github.com/mesonbuild/meson/issues/3737
2018-07-01 13:59:48 +00:00
Jon Turney c151eb4967 Improve logging when dependency is anonymous
Various pieces of logging assume the dependency has a name, and aren't
grammatical if the dependency is '', so say it is anonymous instead.
2018-06-30 13:28:15 +00:00
Jon Turney fd4872ae77 More tests to cover missing fallback for a non-found dependency
Fix logic so we correctly raise an exception about missing fallback in the
case where the dependency is required.
2018-06-30 13:28:15 +00:00
Jon Turney 9efdcfbb8d Fix handling of dependency('', fallback: ['subproject', 'dep'])
Also extend a test case to cover this.
2018-06-30 13:28:15 +00:00
Jussi Pakkanen bde99eb6c4 Warn if using Clang+asan+b_lundef. Closes #764. 2018-06-30 00:50:06 +03:00
Niklas Claesson 9620755ff7 Print default option values that don't match the current value 2018-06-21 00:56:30 +03:00
Nirbheek Chauhan 58ae2c9a8c Rename clike_langs to clink_langs for clarity
D is not a 'c-like' language, but it can link to C libraries. The same
might be true of Rust in the future and Go when we add support for it.

This contains no functionality changes.
2018-06-20 11:27:08 +00:00
Jon Turney 5f5480f337 Make a custom target output dir as an include dir relative to @BUILD_ROOT@
Make a custom target output dir as an include dir relative to @BUILD_ROOT@,
so that path is constructed correctly when using the absolute path forms
used by the MSVC backend.
2018-06-18 10:52:21 +00:00
Jon Turney 7c4b8591b0 Make depends: of windows.compile_resources() include-able
Add the output directories for any custom target in depends: to the resource
compiler include path
2018-06-18 10:52:21 +00:00
Nirbheek Chauhan c9a89027ac run_command: Add new kwarg 'capture'
capture: false means we won't try to read the stdout at all.

Closes https://github.com/mesonbuild/meson/issues/3364
2018-06-18 10:51:46 +00:00
Alex Hirsch cbe18e01e4 Deprecate `build_always`, add `build_always_stale`
Since `build_always` also adds a target to the set of default targets,
this option is marked deprecated in favour of the new option
`build_always_stale`.

`build_always_stale` *only* marks the target to be always considered out
of date, but does *not* add it to the set of default targets.

The old behaviour can still be achieved by combining
`build_always_stale` with `build_by_default`.

fixes #1942
2018-06-18 10:49:40 +00:00
Christoph Behle dbb3c05cf9 Add check for arguments of has_members.
Ensure that has_members has at least two arguments.
2018-06-18 07:52:15 +00:00
Christoph Behle 9e0397805e Use stub to report misuse of get_define
Instead of checking on the call site add a stub to Compiler which raises
an exception.
2018-06-18 07:52:15 +00:00
Christoph Behle 93b5a42ada Test if compiler supports get_define.
Raise an InterpreterError for a clean error message if get_define is not
supported by the compiler.
2018-06-18 07:52:15 +00:00
Xavier Claessens e565945253 Add UserFeatureOption type
This is a special type of option to be passed to most 'required' keyword
arguments. It adds a 3rd state to the traditional boolean value to cause
those methods to always return not-found even if the dependency could be
found.

Since integrators doesn't want enabled features to be a surprise there
is a global option "auto_features" to enable or disable all
automatic features.
2018-06-18 04:57:32 +00:00
FFY00 8ef4864ae4
dependencies: add dub as a dependency method 2018-06-17 22:34:32 +01:00
Christoph Behle 47c3a26915 Always apply concatenate_string_literal.
get_define always applies concatenate_string_literal to its result.
Remove kwarg concatenate_string_literal from get_define.
2018-06-12 00:14:54 +00:00
Christoph Behle 40d121d33e get_define can concatenate string literals.
Added method concatenate_string_literals to CCompiler. Will concatenate
  string literals.
Added keyword argument 'concatenate_string_literals' to Compiler.get_define.
  If used will apply concatenate_string_literals to its return value.
2018-06-12 00:14:54 +00:00
Nirbheek Chauhan be7d8b2d2f configure_file: Add 'encoding' to FeatureNew 2018-06-10 01:44:26 +00:00
Sander Sweers 47785bf89b Add file encoding to configure_file
Input files can be in any file encoding, not just utf-8 or isolatin1. Meson
should not make assumptions here and allow for the user to specify the
encoding to use.
2018-06-09 18:17:48 +00:00
Xavier Claessens 18e25b6773 Fix options being reset to default on reconfigure
Closes: #3712
2018-06-09 18:10:23 +00:00
Xavier Claessens 2d3bfa0778 Interpreter: Fix subdir_done() to exit from inside if/foreach blocks
Closes: #3700.
2018-06-07 12:56:27 +00:00
Xavier Claessens 7c4736d27f Convert args.projectoptions into a dict
This simplifies a lot of code, and centralize "key=value" parsing in a
single place.

Unknown command line options becomes an hard error instead of
merely printing warning message. It has been warning it would become an
hard error for a while now. This has exceptions though, any
unknown option starting with "<lang>_" or "b_" are ignored because they
depend on which languages gets added and which compiler gets selected.
Also any option for unknown subproject are ignored because they depend
on which subproject actually gets built.

Also write more command line parsing tests. "19 bad command line
options" is removed because bad cmd line option became hard error and
it's covered with new tests in "30 command line".
2018-06-06 20:02:37 +00:00
Xavier Claessens 75e501ceb8 coredata: Stop setting default option values as argparse attribute
All options are now the projectoptions list, regardless of how they got
defined in the command line.

This also delays setting builtin option values until the main project()
default options are parsed to simplify the code. This is possible
because we already delayed setting the backend after parsing main
project() in a previous commit.
2018-06-06 20:02:37 +00:00
Xavier Claessens 8fb72510c3 Move to coredata some methods handling options
Those methods only use coredata object, so better just move them as a
coredata method.
2018-06-06 20:02:37 +00:00
Xavier Claessens 5af98d16b9 Delay backend creation until project() is parsed
The project() function could have a different value for the backend
option in its default_options kwargs.

Also set backend options, passing them in command line had no effect
previously.
2018-06-06 20:02:37 +00:00
Xavier Claessens b7d442150d Move <lang>_args to coredata.compiler_options 2018-06-06 20:02:37 +00:00
Xavier Claessens fa72cd7173 Move get_args_from_envvars() from environment to compilers 2018-06-06 20:02:37 +00:00
Nirbheek Chauhan 56a7d8b2b3 Warn when Apple bitcode support is enabled and in-use
We have to disable some options, so tell the user about them and point
to the documentation so they can read more about it.
2018-06-06 07:53:10 +00:00