Commit Graph

5299 Commits

Author SHA1 Message Date
6ca423e1fc interpreter: Do not get variable on failed subproject
Fixes: #7620
2020-08-20 18:47:33 -04:00
1f2150fe49 Correctly determine C++ stds for Elbrus compiler 2020-08-20 23:49:18 +03:00
86b47250c6 simplify shutil usage by invoking copy2 where appropriate
It's equivalent to copyfile + copystat with the same arguments.
2020-08-20 23:47:54 +03:00
1c403e20e7 Interpreter: Fix c_stdlib usage
- Exceptions raised during subproject setup were ignored.
- Allow c_stdlib in native file, was already half supported.
- Eliminate usage of subproject variable name by overriding
  '<lang>_stdlib' dependency name.
2020-08-18 14:47:38 -04:00
adfee4460a prevent disabler() object from overwriting arrays (#7484)
* prevent disabler object from overwriting arrays

fixes #7107

* fix failing test

forgot that func() != func(void) in c
2020-08-18 07:07:59 -07:00
23f795fb54 find_library: Print type of library not found
If we can't find a static library, we should say that. It's confusing
otherwise.
2020-08-15 10:29:07 +00:00
9fdb97733b ninjabackend: Fix coverage rule generation
Without the parenthesis, the command evaluates to `[]` if
`use_llvm_cov` is `False`.

Also fix tests to actually check whether or not coverage reports are
generated.

Fixes https://github.com/mesonbuild/meson/issues/7553
2020-08-15 08:41:52 +00:00
cdc2a67687 mtest: Actually call colorize_console() 2020-08-13 22:54:19 +03:00
435db35962 interpreter: Don't force fallback when subproject failed to configure
Fixes: #7534
2020-08-12 13:38:55 +00:00
4b0e1850a0 cmake: Use a mapping when writing compiler ID
Meson and CMake compiler ids are different. This commit adds a mapping
from the meson list:

https://mesonbuild.com/Reference-tables.html#compiler-ids

to the CMake list:

https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html

The mapping is not 1-1, and not all entries are mapped, so this is
a best-effort attempt. Fallback to GNU as before to try to limp along
and hope that the build files don't rely on an accurate compiler ID.
2020-08-12 12:21:32 +00:00
bc64e1d6b0 cmake: Fix hard-coded values in fake CMakeLists for MSVC
Without this, MSVC and MSVC_VERSION won't be set by CMake during
platform detection, and the compiler will be an undefined mixture of
GNU and MSVC. In particular, find_package(opencv) will fail on Windows
when building with MSVC.
2020-08-12 12:21:32 +00:00
847d652c4e Add h5cc shlib argument for correctly link hdf5 libraries
respect "static" key in dependency function
-shlib for static dependency
-noshlib for static dependency
2020-08-11 09:42:18 -07:00
f2890cbf97 msvc: enable /std:c11 flag 2020-08-09 11:48:41 -07:00
a98db022aa cmake: Detect custom command targets in compiler args
This is required to make `-include /path/to/custom/target.hpp`
work. This setup is used by wxWidgets and this PR is
required to use wxWidgets as a CMake subproject.
2020-08-09 19:36:38 +03:00
948741355f cmake: Make the CMake targte not found error more useful (see #7567) 2020-08-09 19:36:10 +03:00
1ddd2b4cbe Use uname -p to detect x86_64 on QNX. 2020-08-08 15:43:57 -07:00
91c5b37970 Better log message on rpath error. 2020-08-07 21:13:46 -04:00
8e98819b06 mtest: fix skipping with various prefixes
According to the specification:
https://testanything.org/tap-specification.html#skipping-tests

  The harness should report the text after # SKIP\S*\s+ as a reason for
  skipping.

(it's not exactly like the TODO directive, the phrasing/presentation of
the spec could be improved).
2020-08-08 01:25:05 +03:00
02ea08ba66 cmake: make the traceparser permissive by default (fixes #7501) 2020-08-07 23:53:21 +03:00
2e4a2bb373 interpreter: Lower case languages before checking if 'c' is in the list
Fixes: #7495
2020-08-07 23:44:31 +03:00
4a923b699b qt dependency: do not require all the tools automatically
The compilers_detect function is only used in the qt module, which
checks every time before using a specific compiler, if it is found.

e.g.

  meson.build:10:6: ERROR: MOC sources specified and couldn't find moc-qt5, please check your qt5 installation

In fact, the current check means we never even hit this error to begin
with, because we previously died on the uninformative error:

  meson.build:10:6: ERROR: Program(s) ['moc'] not found or not executable

which doesn't actually tell the user why this matters, and is all around
a waste of time.

Fixes #5582
2020-08-07 12:40:31 -04:00
461cb7d534 Merge pull request #7527 from mensinda/cnFixExe
cmake: resolve IMPORTED executables in custom commands (fixes #7509)
2020-08-05 23:09:38 +03:00
7db49db67d mtest: TestResult.SKIP is not a failure (#7525)
* mtest: TestResult.SKIP is not a failure

If some but not all tests in a run were skipped, then the overall result
is given by whether there were any failures among the non-skipped tests.

Resolves: https://github.com/mesonbuild/meson/issues/7515
Signed-off-by: Simon McVittie <smcv@debian.org>

* Add test-cases for partially skipped TAP tests

issue7515.txt is the output of one of the real TAP tests in gjs, which
failed as a result of #7515. The version inline in meson.build is
a minimal reproducer.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-05 23:08:05 +03:00
d4ec080f73 cmake: Use the DEBUG config when linking to the debug CRT
The `debug` builtin option does not control whether or not the debug
CRT is used. Without this fix, when buildtype=debugoptimized or when
debug=true + b_vscrt=md, we will try to link to the debug libraries
found via cmake while linking with `/release`, which will cause a link
failure.
2020-08-05 19:50:24 +00:00
adbed4c636 cmake: Do not split CMAKE_PREFIX_PATH with ':' on Windows
This is obviously wrong, since on Windows ':' is in the drive letter.
Causes us to call cmake with `-DCMAKE_PREFIX_PATH=c;\foo\bar`.
2020-08-05 19:57:05 +02:00
6006987ce5 "Downgrade" warning when regenerating after version bump
There is nothing to "warn" about, this is a completely routine
occurence. OTOH, when something is corrupted, we should warn. Keep
the red color and "WARNING:" prefix in that case.

Example output:
$ ninja -C build
Regenerating configuration from scratch: Build directory has been generated with Meson version 0.55.999, which is incompatible with current version 0.56.0.
The Meson build system
Version: 0.56.0
...
2020-08-04 17:15:37 +03:00
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
1c1ec9ff11 cmake: resolve IMPORTED executables in custom commands (fixes #7509) 2020-08-03 17:48:12 +02:00
70edf82c6c Make meson recognize the Qualcomm LLVM toolchain
Meson calls `path/to/clang++ --version` to guess which build toolchain the
user has picked to build the source code. For the Qualcomm LLVM toolchain,
the output have an unusual output as shown below:

```
clang version 8.0.12
Snapdragon LLVM ARM Compiler 8.0.12 (based on llvm.org 7.0+)
Target: arm-unknown-linux-gnueabi
Thread model: posix
Repository: (ssh://git-hexagon-aus.qualcomm.com:...)
InstalledDir: /pkg/qct/software/llvm/release/arm/8.0.12/bin
```

Another unusual pattern is the output of `path/to/ld.qcld --version`:

```
ARM Linker from Snapdragon LLVM ARM Compiler Version 8.0.12
ARM Linker based on LLVM version: 8.0
```

The Meson logic is modified accordingly so that Meson can correctly
determine toolchain as "LLVM aarch64 cross-compiler on GNU/Linux64 OS".

This is the expected output of
`meson --native-file native_file.ini --cross-file cross_file.ini build/aarch64-debug/`:

```
...
C++ compiler for the host machine: ... (clang 8.0.12 "clang version 8.0.12")
C++ linker for the host machine: ... ld.lld 8.0.12
...
```
2020-08-02 10:39:44 -07:00
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
5db3860abf push all config-file settings into coredata.set_default_options
This puts all of them together, in the next patch they'll be pulled back
out, but it's convenient to start that refactor by moving them all
there, then moving them into env as a whole.
2020-08-01 22:00:06 -07:00
5358765806 mesonlib: Add repr() methods to PerMachine classes
Which is super helpful in debuggers
2020-08-01 22:00:06 -07:00
601789cc7c machine-files: deprecate the paths section 2020-08-01 22:00:06 -07:00
e981798e0b coredata: fix type annotation 2020-08-01 22:00:06 -07:00
17c8193615 machine-files: give better error messages about using integers 2020-08-01 22:00:06 -07:00
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
af763e093a mconf/mintro: use authoritative list of options from coredata
This splits the directory options and non-directory options into two
dicts, and then merges them later to maintain API.
2020-08-01 22:00:06 -07:00
a6164ca5a8 Allow setting project options from cross or native files
This allows adding a `[project options]` section to a cross or native file
that contains the options defined for a project in it's meson_option.txt
file.
2020-07-30 19:34:37 -07:00
cc201a5396 Support armel/armhf builds on native arm64 hosts. 2020-07-30 12:04:54 -07:00
40c197d524 pkgconfig: Fix various corner cases
See unit tests for the exact scenarios this PR fixes.
2020-07-30 18:59:10 +03:00
bbf8533a97 Merge pull request #7494 from keszybz/fix-two-warnings
Fix two warnings
2020-07-30 16:39:04 +03:00
8da1b29899 mtest: report failures and overall summary *after* test(s) logs 2020-07-30 16:38:07 +03:00
1ce4258c21 backends: fix rpath match pattern
Since -Wl,-rpath= is not the only valid rpath ldflags syntax we
need to try and match all valid rpath ldflags.

In addition we should prevent -Wl,--just-symbols from being used to
set rpath due to inconsistent compiler support.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-07-30 16:36:11 +03:00
7ef51abfc5 Fix typo 2020-07-28 19:51:58 +02:00
1123f4f311 Avoid warning about multiple outputs when building private directory name
Fixup for b4b1a2c5a1.

A warning would be printed for any rule with multiple outputs, for
example:
WARNING: custom_target 'coredump.conf.5' has more than one output! Using the first one.
WARNING: custom_target 'dnssec-trust-anchors.d.5' has more than one output! Using the first one.
WARNING: custom_target 'halt.8' has more than one output! Using the first one.

Fixes https://github.com/systemd/systemd/issues/16461.
2020-07-28 19:51:58 +02:00
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
903d5dd8a7 ninjabackend: check if target has compiler attribute
otherwise we are getting errors like:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/mesonmain.py", line 131, in run
    return options.run_func(options)
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 245, in run
    app.generate()
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 159, in generate
    self._generate(env)
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 215, in _generate
    intr.backend.generate()
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 518, in generate
    self.generate_coverage_rules()
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 991, in generate_coverage_rules
    self.generate_coverage_command(e, [])
  File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 975, in generate_coverage_command
    for compiler in target.compilers.values():
AttributeError: 'RunTarget' object has no attribute 'compilers'

This extends the 109 generatecode test case to also define a test, so
coverage can really detect something.
2020-07-28 17:59:03 +03:00
18aff92d7a Merge pull request #7461 from mensinda/noMoreSetuptools
Remove the setuptools dependency with mesondata.py
2020-07-23 13:01:29 +03:00
587e159d6c Merge pull request #7460 from mensinda/fixDeepcpy
deps: Do not deepcopy internal libraries (fixes #7457)
2020-07-23 12:45:49 +03:00
6e7d548b11 compilers: Cache gnu-mixins has_arguments() checks
want_output gives us the output file. We don't need the file. We just
need the compiler stderr, which is always stored.
2020-07-23 07:39:59 +00:00