Commit Graph

14788 Commits

Author SHA1 Message Date
Scott Kyle f5ec07e7c3
Ensure private directory exists for custom targets (#13196)
* Ensure private directory exists for custom targets

Some custom target commands will expect the `@PRIVATE_DIR@` to already exist, such as with `make -C @PRIVATE_DIR@ ...`

* Prefer `exist_ok` over catching exception
2024-06-23 22:00:29 +03:00
Kai Pastor a28dde40b5
Recast CMake's IMPORTED_LOCATION into framework flags (#13299)
* Explicitly look for 'OpenAL' with method: 'cmake'

This test was added for testing cmake depenencies,
so no other method must be accepted here, and
the spelling must match FindOpenAL.cmake.

* Resolve frameworks in IMPORTED_LOCATION

The IMPORTED_LOCATION property of CMake targets may contain macOS
framework paths. These must be processed into flags. By putting the
values in the list of targets, they will be processed as if they
appeared in INTERFACE_LINK_LIBRARIES.
2024-06-23 21:58:36 +03:00
Dudemanguy 9be6e653d4 find_program: add a kwarg to specify custom version argument
When trying to get the version of a program, meson was previously
hardcoded to run the binary with `--version`. This does work with the
vast majority of programs, but there are a few outliers (e.g. ffmpeg)
which have an unusual argument for printing out the version. Support
these programs by introducing a version_argument kwarg in find_program
which allows users to override `--version` with whatever the custom
argument for printing the version may be for the program.
2024-06-23 15:10:42 +03:00
Ralf Gommers a111c28ece Add support for detecting free-threaded Python on Windows
This does a couple of things:
1. Scrape the `Py_GIL_DISABLED` sysconfig var, which is the best way as of today
   to determine whether the target interpreter was built with `--disable-gil`
2. link against the correct libpython
3. On Windows, work around a known issue in the python.org installer with a
   missing define in `pyconfig.h`, which the CPython devs have said is unlikely
   to be fixed since headers are shared between the regular and free-threaded
   builds in a single NSIS installer.
2024-06-23 13:23:31 +03:00
TheHillBright c0ca35c8fd feat(compilers): cppm extension support
recognize the file extension `cppm` as c++ source file
2024-06-23 13:20:30 +03:00
Mark A. Tsuchida 1951fe5cf0 clang-tidy: use -quiet
This adds the `-quiet` option when invoking clang-tidy for the generated
`clang-tidy` target. (Note that the `clang-tidy-fix` target already does
so.)

This prevents messages like
```
Suppressed 1084 warnings (1084 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
```
from being repeated for every file, which drowns out the actual
warnings/errors from clang-tidy when more than a few files are
processed.

Also the tip about `-header-fileter` and `-system-headers` is not very
useful here because Meson doesn't currently provide a way to supply
these options to clang-tidy.

Even with `-quiet`, clang-tidy still prints a line like `1084 warnings
generated.` for each file.
2024-06-23 13:05:29 +03:00
Tomas Popela a6258eb5e2 Fix subproject typo in interpreter.py
Found by Coverity scan.
2024-06-23 13:03:47 +03:00
Walkusz 783183260d coverage: Change --html-details to --html-nested (gcovr)
--html-nested option is used to create a separate web page for each file and directory. Each of these web pages includes the contents of file with annotations that summarize code coverage.

Signed-off-by: Ewelina Walkusz <ewelinax.walkusz@intel.com>
2024-06-23 12:35:49 +03:00
Jade Lovelace 5597b6711d tests: fix OpenAL test case on case sensitive fs on macOS
Preface: why are we doing this?

For reasons of cross-platform interop, the Lix team is strongly
considering switching to build on a case sensitive filesystem in the
macOS installation, since otherwise storing case overlapping filenames
is busted and requires very very bad hacks:
https://git.lix.systems/lix-project/lix/issues/332

What's wrong:

Command line: `clang++ '/nix/temp/meson/b d01bff197e/meson-private/tmpjqid64j1/testfile.cpp' -o '/nix/temp/meson/b d01bff197e/meson-private/tmpjqid64j1/output.exe' -O0 -fpermissive -Werror=implicit-function-declaration -F/nix/store/qa92ravmclyraw7b46cz3q3m834mmbw9-apple-framework-OpenAL/Library/Frameworks -framework openal` -> 1
stderr:
ld: framework not found openal
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

Why is that happening:

$ ls /nix/store/qa92ravmclyraw7b46cz3q3m834mmbw9-apple-framework-OpenAL/Library/Frameworks
OpenAL.framework

So the test was relying on case insensitive fs, which is not a reliable
assumption on all macOS installations (since weird people like us can
set their fs to case sensitive!).
2024-06-23 12:32:24 +03:00
Artturin c21b886ba8 dependencies/boost.py: Allow getting `lib_dir` and `include_dir` via pkg-config
`boost_root` doesn't work if lib and include are in different directories like in the `nix` `boost` package.

The `prefix` checking could probably be removed, in 2019 conan (the
reason why the check was added) had `libdir` and `includedir` in its
generated pkg-config file
https://www.github.com/mesonbuild/meson/issues/5438#issuecomment-498761454

If there's no return then boost isn't found for some reason, further
logic is unnecessary in any case if direct paths are passed.

`roots += [Path(boost_lib_dir), Path(boost_inc_dir)]` did not work
2024-06-23 12:30:34 +03:00
Campbell Jones 24cddb6901 create_test_serialisation: Dedup deps before joining ld_lib paths
In large monolithic codebases with many intertwined shared libraries, test
serialization can cause configuration times to balloon massively from a single
test() invocation due to concatenating the same paths many times over.

This commit adds an initial set in which all dependencies on a test target are
stored before their paths are constructed to form the test target's
LD_LIB_PATH. In testing on a particularly large codebase, this commit reduced
total configuration time by a factor of almost 8x.
2024-06-23 12:13:36 +03:00
Matt Jolly 410bdf8c6c `configure_file`: update \@ escape logic
When configuring a 'meson' or 'cmake@' style file,
add a case for escaped variables using matched pairs of
`\@` i.e. `\@foo\@ -> @foo@`.

The match for @var@ has been amended with a negative lookbehind
to ensure that any occurrances of `\@foo@` are not evaluated to
`\bar`.

The previous behaviour, matching `\@` and escaping only that character,
had undesirable side effects including mangling valid perl when
configuring files.

Closes: https://github.com/mesonbuild/meson/issues/7165
2024-06-23 11:58:36 +03:00
Charles Brunet 8967090149 mformat: fix else token not correctly indented
fixes #13316
2024-06-19 00:09:29 -04:00
Charles Brunet bef2fbf75b Fix crash in meson format
There was a case where a trailing comma was missing a whitespaces attribute

Fixes #13242
2024-06-19 00:07:01 -04:00
Charles Brunet 9f4253164a Catch format configuration parse error 2024-06-19 00:07:01 -04:00
Ralf Gommers bcbf068549 Improve `nm` usage in symbolextractor script on macOS
This fixes the unit test `TestAllPlatformTests.test_noop_changes_cause_no_rebuilds`,
when run with an `nm` binary from `cctools-port` (as shipped by conda-forge, see
https://github.com/conda-forge/cctools-and-ld64-feedstock).

It also addresses the issue discussed in https://github.com/mesonbuild/meson/discussions/11131,
and this build warning:
```
[48/1383] Generating symbol file scipy/special/libsf_error_state.dylib.p/libsf_error_state.dylib.symbols
WARNING: ['arm64-apple-darwin20.0.0-nm'] does not work. Relinking will always happen on source changes.
error: arm64-apple-darwin20.0.0-nm: invalid argument --
```
as reported in scipy#20740.

The unit test traceback was:
```
>       self.assertBuildRelinkedOnlyTarget('mylib')
E       AssertionError: Lists differ: ['mylib', 'prog'] != ['mylib']
E
E       First list contains 1 additional elements.
E       First extra element 1:
E       'prog'
E
E       - ['mylib', 'prog']
E       + ['mylib']

unittests/allplatformstests.py:1292: AssertionError
```

The `nm` shipped by Apple yields the exact same results either way; the man page for `nm`
only lists the single-character form so this seems preferred either way.
2024-06-18 12:43:07 -04:00
Daan De Meyer a3d3efd3cf Add meson test --max-lines
Let's allow users to configure how many lines are shown at most when
a test fails.
2024-06-17 19:30:10 +03:00
Sebastian Wick c199faf980 cargo: Fall back to the checksum in Cargo.lock metadata table
In ansi_term-0.12.1 the packages do not have a checksum entry but it can
be found in the global metadata table.
2024-06-17 11:00:22 -04:00
Rohit Goswami 2058f63b4e BUG: Use an F77 snippet for sanity testing Fortran
Closes gh-13319
2024-06-16 11:58:37 -07:00
Xavier Claessens 9b8378985d cargo: Load Cargo.lock
Cargo.lock is essentially identical to subprojects/*.wrap files. When a
(sub)project has a Cargo.lock file this allows automatic fallback for
its cargo dependencies.
2024-06-14 15:59:42 -04:00
Xavier Claessens c0de2e1264 wrap: Clarify PackageDefinition API
This will simplify creating PackageDefinition objects from Cargo.lock
file. It contains basically the same information.
2024-06-14 15:01:30 -04:00
Jussi Pakkanen ce889d6870
Merge pull request #13307 from mesonbuild/optstorerefactor
Convert OptionStore from a dict to a full class with named methods
2024-06-14 19:25:18 +03:00
Jussi Pakkanen 181c3499fd Fix mypy. 2024-06-14 17:19:53 +03:00
Jussi Pakkanen 9a6fcd4d9a Replace direct indexing with named methods. 2024-06-14 17:19:53 +03:00
Jussi Pakkanen c0d86024f5 Rename option variable to optstore to make it unique. 2024-06-14 17:19:53 +03:00
Jussi Pakkanen 0352c900bc
Merge pull request #13171 from amcn/mingw-python-limited-api
Python: Fix limited API under mingw
2024-06-12 00:23:14 +03:00
Andrew McNulty 328011f77a Python: link correct limited API lib on mingw
This commit fixes GH issue #13167 by linking to the correct
library under MINGW when the 'limited_api' kwarg is specified.
2024-06-11 19:47:31 +02:00
Andrew McNulty fea7f94b67 Python: fix limited API logic under mingw
The Python Limited API support that was added in 1.2 had
special handling of Windows, but the condition to check for
Windows was not correct: it checked for MSVC and not for
the target's OS. This causes mingw installations to not have
the special handling applied.

This commit fixes this to check explicitly for Windows.
2024-06-11 19:47:31 +02:00
Andrew McNulty f66a527a7c Python: move Windows functions to dependency base
This is in preparation for a future commit which makes it
possible for a PythonPkgConfigDependency to be used in a
context where previously only a PythonSystemDependency would
be used.
2024-06-11 19:47:31 +02:00
Andrew McNulty 4023bbfc36 unittests: Add Python unittest for limited API
This new unittest runs the existing Python limited API
test case, and checks that the resulting library was linked to
the correct library.
2024-06-11 19:47:31 +02:00
Andrew McNulty d1abdce88f Python: add load test to limited API test
Based on the example in GH issue #13167, the limited API test has been
extended with a test to load the compiled module to ensure it can be
loaded correctly.
2024-06-11 19:47:31 +02:00
Jussi Pakkanen 1d4c031111
Merge pull request #13303 from jwieleRH/man
Update the meson man page.
2024-06-11 20:02:39 +03:00
John Wiele 1b36bf3f3c Add help for meson format to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-11 11:36:22 -04:00
Emil Melnikov 141100e482 Add note about meson-python and installation path
New people that want to use Meson for building Python extensions most
probably will read Python module docs first. Direct them to meson-python
and suggest to set `python.install_env=auto`.
2024-06-10 18:12:56 -04:00
Mis012 9694f9fefe java: use single javac invocation per jar
Instead of invoking javac for every .java file, pass all of the sources
for a jar target to a single javac invocation. This massively improves
first compilation time and doesn't meaningfully affect incremental builds
(it can even be faster in some cases).

The old approach also had issues where files would not always get recompiled
even though they should, necessitating a clean rebuild in order to see changes
reflected in the build output.

Multiple invocations seem to only make sense if:
- issues with files not getting flagged for rebuild are investigated and fixed
- something like the javaserver buildtool from openjdk sources is used
instead of directly spawning javac processes
- the amount of java files per jar is so large that it is faster to compile
several files one by one than to compile all the files at once (batching may
still make sense to get a reasonable balance)
2024-06-10 01:48:53 +03:00
Jussi Pakkanen 2b1510d706 Convert option from a plain dictionary into a named class. 2024-06-08 22:58:06 +03:00
Jussi Pakkanen 374fa7f0da Use helper method in remaining compiler classes. 2024-06-08 21:12:56 +03:00
Jussi Pakkanen 4eb1eb3c4a Use helper method in Rust compiler class. 2024-06-08 21:12:56 +03:00
Jussi Pakkanen 53acb50052 Use helper method in Fortran compiler classes. 2024-06-08 21:12:56 +03:00
Jussi Pakkanen fbb8b09379 Use helper method in C++ compiler classes. 2024-06-08 21:12:56 +03:00
Jussi Pakkanen 03f0551091 Create helper method for lang opts and use in C compiler classes. 2024-06-08 21:12:56 +03:00
Ruben Gonzalez ee479ded3f wrap: default values for netrc are empty string from python 3.11
From python 3.11 [1]:

> The entry in the netrc file no longer needs to contain all tokens.  The missing
> tokens' value default to an empty string.  All the tokens and their values now
> can contain arbitrary characters, like whitespace and non-ASCII characters.
> If the login name is anonymous, it won't trigger the security check.

[1] 15409c720b
2024-06-07 17:02:25 -04:00
John Wiele fd6a6e8b90 Add help for meson env2mfile to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:15:40 -04:00
John Wiele bce9b44c0b Add help for meson devenv to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:15:27 -04:00
John Wiele 2e6f5c8bf2 Add help for meson compile to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:15:13 -04:00
John Wiele caa32abf45 Add help for meson rewrite to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:14:55 -04:00
John Wiele 559341bb2f Add help for meson subprojects to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:14:34 -04:00
John Wiele 80a4b4a2ec Add help for meson init to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:14:14 -04:00
John Wiele 762262856a Add help for meson install to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:13:49 -04:00
John Wiele 31d8074727 Add help for meson dist to the man page.
The added help text was derived from the output of the meson help
command much like the markdown online help is derived.
2024-06-06 09:13:10 -04:00