Commit Graph

14001 Commits

Author SHA1 Message Date
Charles Brunet 1b1946c4e1 Disable failing test on cygwin due to broken cmake
See https://gitlab.kitware.com/cmake/cmake/-/issues/25200.
2023-08-30 19:30:00 -04:00
Xavier Claessens 8758e1353e ci: Skip gir test on cygwin 2023-08-30 15:46:00 -04:00
Jussi Pakkanen 08d83a4a97
Merge pull request #10332 from xclaesse/std-opt
c_std, cpp_std: Change to a list of desired versions in preference order
2023-08-30 12:04:09 -07:00
Xavier Claessens 494bdbd334 gnome: Fix crash in gtkdoc and generate_gir in C++ projects
gtkdoc() and generate_gir() methods assumes there is a C compiler, but
pure C++ projects might not add it explicitly.

Fixes: #12162
2023-08-29 13:34:23 -04:00
Xavier Claessens 4eb9c84cf9 include_directories: Always add both source and build dirs
Compiler checks were not adding build dir side, which prevents using
headers generated with configure_file().
2023-08-28 20:18:26 -04:00
Bruce Merry 83d3bf85cf Add CUDA id and flags to reference tables 2023-08-28 12:04:40 -04:00
Xavier Claessens 237b4c0f41 FAQ: MinGW UCRT are compatible with MSVC and also use libfoo.a
Prior to Windows 10, libfoo.a were usually not usable with MSVC. This is
not true any more since Autotools projects built with UCRT produce
libfoo.a that are compatible with MSVC.

This is another reason for using that naming convention in Meson.
2023-08-27 10:50:43 -04:00
Xavier Claessens e3a71a7b58 msetup: Update options when builddir is already configured
`meson setup -Dfoo=bar builddir` command was returning success ignoring
new option values.

This now also update options. It is useful because it means
`meson setup -Dfoo=bar builddir && ninja -C builddir` works regardless
whether builddir already exists or not, and when done in a script,
changing options in the script will automatically trigger a reconfigure
if needed. This was already possible by always passing --reconfigure
argument, but that triggers a reconfigure even when options did not
change.
2023-08-25 09:43:24 -04:00
Peter Hutterer 1bb29b1b32 minstall: move the "Installing foo to bar" message up
Move this message up before we attempt to change anything in the file
system (in this case creating the directory structure).
If an error occurs it will thus occur immediately after the message,
allowing us to debug what failed to install.
2023-08-24 21:29:10 -04:00
Xavier Claessens b4b1395ef5 Suggest using --reconfigure only when not already using it 2023-08-24 19:09:20 -04:00
Xavier Claessens f720105e24 find_program: Fallback if version mismatch
Fixes: #11797
2023-08-24 18:51:13 -04:00
Xavier Claessens 6f87215f1f build: Simplify import_filename handling
This removes deadcode, vs_import_filename and gcc_import_filename were
not needed.
2023-08-24 18:50:12 -04:00
David Seifert 10e8995fc8 Use `cudart_static` by default in dependency('cuda')
* Without this, using nvcc as the sole driver vs dependency('cuda') and
  host compiler driver yields differently linked binaries.
2023-08-23 18:39:30 -04:00
David Seifert 078dc2ca10 Fix completely broken support for `static: true` with dependency('cuda') 2023-08-23 18:39:30 -04:00
Xavier Claessens 18b96cd069 machine file: Add @GLOBAL_SOURCE_ROOT@ and @DIRNAME@ 2023-08-23 11:33:39 -04:00
Benoit Pierre bde690b06e compilers: fix checks handling of internal dependencies
The include directories were not passed to the compiler.
2023-08-22 09:40:30 -04:00
Eli Schwartz 253df6f9f8
CI: make linters emit colored output
Github Actions supports this fine, but is misdetected by flake8/mypy.
Even though pylint defaults to text instead of colorized, we might as
well do the right thing here though.
2023-08-18 15:38:13 -04:00
Eli Schwartz 1ed619d196
run_mypy: add option to run once for each supported version of python
This allows verifying that meson is type-safe under older versions of
Python, which it currently is. Different versions of Python sometimes
have different supported types for an API.

Verify this in CI.

(We flush output to ensure CI prints lines in the right order.)
2023-08-18 15:38:13 -04:00
Eli Schwartz 3ebd570bd5
consistently use Literal annotation from typing_extensions
This is our standard annotation policy, and makes mypy safe under python
3.7
2023-08-18 15:37:52 -04:00
Eli Schwartz 184277bb4a
docs: use future annotations for genrefman types in typing_extensions
And in fact *use* typing_extensions, which is sometimes the only way to
get access to TypedDict.

Mostly, reindent almost but not quite an entire file to only define
annotation classes under TYPE_CHECKING.
2023-08-18 11:16:15 -04:00
Eli Schwartz 2edcbb452e
CI: trigger website job when testing modifications to the website job 2023-08-18 11:16:15 -04:00
Eli Schwartz 9153b82cc2
CI: add pip caching to website job
On average, saves 20 seconds for a job that may take 1.5 or 2 minutes.
Mostly due to recompiling the same 3 wheels again and again, so that
avoids pointless CPU waste.
2023-08-18 11:16:15 -04:00
Eli Schwartz 5a827616b5 ninja backend: fix the automatic restat of outputs when reconfiguring
The most notable problem this causes is that when running `meson setup
--reconfigure` the build.ninja file is erroneously seen as out of date,
so ninja immediately tries to regenerate it again as it didn't see the
file get updated.

There are two problems.

The first problem is that we looked for the wrong file. Ninja creates a
few internal files, and one of them is the one we care about:
`.ninja_log`, which contains stat'ed timestamps for build outputs to aid
in checking when things are out of date. But the thing we actually
checked for is `.ninja_deps`, a file that contains a compressed database
of depfile outputs. If the latter exists, then the former surely exists
too.

Checking for the wrong file meant that we would restat outputs, but only
when some build edges were previously built that had depfile outputs.

The second problem is that we checked for this in os.getcwd() instead of
the configured build directory. This very easily fails to be correct,
except when reconfigure is triggered directly by ninja itself, in which
case we didn't need the restat to begin with.
2023-08-18 07:57:32 -04:00
Tristan Partin 946a3561c2 Revert "Revert "Add fs.relative_to()""
This reverts commit 84c8905d52.

Fixed the cygwin failure...
2023-08-18 07:46:08 -04:00
M Henning 22f90fd469
Suggest fix in MesonVersionMismatchException
Every time I update meson, I spend about 20 minutes on frustrated googling
to figure out how to update my build directory to work with the new version.
I'm forgetful, okay? Ease this pain point by suggesting a potential fix in
the error message.
2023-08-18 00:41:56 -04:00
Benoit Pierre 268276f7ac tests: fix assertion rewriting when pytest is used 2023-08-18 00:37:40 -04:00
Charles Brunet 7cbe37ebd9 Add more descriptive description to CustomTarget
Allow modules using CustomTarget to modify the command description used by ninja backend. This result in more precise logs when building a project.
2023-08-18 00:36:49 -04:00
Jan Janssen 88747b4f8d docs: Provide example for feature.disable_auto_if 2023-08-18 00:36:32 -04:00
Eli Schwartz 84c8905d52
Revert "Add fs.relative_to()"
This reverts commit f52bcaa27f.

It did not pass CI, and was merged anyway because there were two CI
errors in the same cygwin job. The other error was not the fault of this
commit, and since cygwin errors were glossed over because they were
"expected", the presence of a new error *added* by this commit was
overlooked.

Per the meson development policy, PRs which result in CI errors
can/should be reverted at will, no questions asked.
2023-08-17 23:56:51 -04:00
Eli Schwartz 1fd70a2a00
tests: consolidate MESON_SKIP_TEST reporting and use it in unittests
Previously, we only reported the skip reason when running project tests.
2023-08-17 21:30:32 -04:00
Eli Schwartz 98232eb036
skip test on pkgconf 2.0.1 that is broken there due to a reported bug 2023-08-17 20:43:14 -04:00
Eli Schwartz e313f78465
fix style errors in fs.relative_to implementation
In commit f52bcaa27f a few issues were
added:
- doc typo
- imports for utils.universal are not intended to be directly used, it's
  an internal wrapper that exists solely to make mesonlib work well as
  it always did while simultaneously allowing `meson --internal`
  codepaths to avoid importing anything other than an extremely stripped
  down core
- type annotation specific import was imported at runtime scope
2023-08-17 18:01:41 -04:00
Tristan Partin 7a2b673d40 Remove hacky setup for CustomTargetIndex tests in fs.relative_to() 2023-08-17 17:32:04 -04:00
Tristan Partin 543e9ca0cf Remove XML filter from testlog.{json,txt} and std streams
This was an unintended consequence of the original patch in #11977.

Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
2023-08-17 17:31:30 -04:00
Tristan Partin f52bcaa27f Add fs.relative_to()
Returns a relative path from arg 2 to arg 1 similar to
os.path.relpath().
2023-08-17 17:05:49 -04:00
Charlie Ringström cbf8e67f19 Replace deprecated GTK flag 2023-08-17 15:33:35 -04:00
Xavier Claessens 229757fe91 README: Document python requirement history
This documents useful to target Meson versions for projects that want to
support older Python versions.
2023-08-17 11:17:47 -04:00
Tristan Partin 14892eb849
Fix some random capitalization in feature.yaml 2023-08-16 21:56:31 -04:00
Xavier Claessens f88a9cd6b3 fs.read(): Catch FileNotFoundError 2023-08-16 14:48:09 -07:00
Xavier Claessens 8a7fdd9159 wasm: make generic cross file 2023-08-16 15:04:58 -04:00
Andrew McNulty c730807696 Python: Add 'limited_api' kwarg to extension_module
This commit adds a new keyword arg to extension_module() that enables
a user to target the Python Limited API, declaring the version of the
limited API that they wish to target.

Two new unittests have been added to test this functionality.
2023-08-14 20:02:09 -04:00
Dylan Baker 9d32302032 interpreter: use typed_kwargs for shared_library(darwin_versions) 2023-08-14 09:55:18 -07:00
Dylan Baker 09bc028c71 interpreter: use typed_kwargs for shared_library(soversion) 2023-08-14 09:55:18 -07:00
Dylan Baker cd676e229b interpreter: use typed_kwargs for shared_library(version) 2023-08-14 09:55:18 -07:00
Eli Schwartz 90ce084144
treewide: automatic rewriting of all comment-style type annotations
Performed using https://github.com/ilevkivskyi/com2ann

This has no actual effect on the codebase as type checkers (still)
support both and negligible effect on runtime performance since
__future__ annotations ameliorates that. Technically, the bytecode would
be bigger for non function-local annotations, of which we have many
either way.

So if it doesn't really matter, why do a large-scale refactor? Simple:
because people keep wanting to, but it's getting nickle-and-dimed. If
we're going to do this we might as well do it consistently in one shot,
using tooling that guarantees repeatability and correctness.

Repeat with:

```
com2ann mesonbuild/
```
2023-08-11 13:41:03 -04:00
Eli Schwartz de1cc0b02b
rewrite a couple comment-style type annotations for oddly indented dicts
Make them into real type annotations. These are the only ones that if
automatically rewritten, would cause flake8 to error out with the
message: "E128 continuation line under-indented for visual indent".
2023-08-11 13:39:07 -04:00
Eli Schwartz a01418db0a
remove useless type annotations
These annotations all had a default initializer of the correct type, or
a parent class annotation.
2023-08-11 13:37:17 -04:00
Jan Janssen 03a2a3a677 docs: Add more feature truth tables
These are much easier to understand at a glance than free-form text.
2023-08-11 08:33:00 -04:00
Eli Schwartz 32e7ebc821
hotdoc module: add a bunch more type annotations 2023-08-10 13:56:39 -04:00
Eli Schwartz bf0494fcc0
hotdoc module: avoid monkeypatch crime by properly subclassing ExternalProgram 2023-08-10 13:56:39 -04:00