Commit Graph

14558 Commits

Author SHA1 Message Date
Marina.Kalashina 4351f56f13 Add CLion to the list of IDE integrations
CLion was not mentioned in the list of IDE integrations. This commit adds it, also
adds a “3rd party" prefix to the Meson Syntax Highlighter plugin to indicate that it doesn't come from JetBrains, and sorts the list alphabetically.
2023-12-27 16:25:15 +02:00
wrvsrx d4fb2d693d ninja backend: manually escape cuda target name
Nvcc doesn't support `-MQ` flag, so we have to manually escape cuda
target name.
This commit escape `$out` to `$CUDA_ESCAPED_TARGET`, so now we can just
use `-MT` flag in nvcc to generate header dependencies.
2023-12-26 23:37:27 -05:00
wrvsrx e2458c6f94 nvcc compiler: support find dependency header files
This commit supersedes PR #11229 and #10993.

It also adds version check according to [comments](https://github.com/mesonbuild/meson/pull/11229#issuecomment-1370287546)
2023-12-26 23:37:27 -05:00
Eli Schwartz 2fbc7b5ce3
Revert "clike: Deduplicate rpath linker flags"
This reverts commit 53ea59ad84.

This breaks at least:
- frameworks/17 mpi
- frameworks/30 scalapack

The problem is that openmpi's pkg-config emitted link arguments
includes:

```
-Wl,-rpath -Wl,/path/to/libdir
```

The deduplication logic in meson doesn't contain sufficient information
to tell when the compiler is passing an argument that requires values,
and definitely cannot tell when that argument is split across argv. But
for arguments that *can* do this, it is not possible to deduplicate a
single argument as standalone, because it is not standalone.

The argument for deduplicating rpath here was that if you have multiple
dependencies that all add the same rpath, the Apple ld64 emits a
non-fatal warning "duplicate -rpath ignored". Since this is non-fatal,
it's not a major issue. A major issue is when builds fatally error out
with:

```
FAILED: scalapack_c
cc  -o scalapack_c scalapack_c.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib64/libscalapack.so /usr/lib64/liblapack.so /usr/lib64/libblas.so -Wl,-rpath -Wl,/usr/lib64 -Wl,/usr/lib64 -Wl,--enable-new-dtags /usr/lib64/libmpi.so -Wl,--end-group
/usr/libexec/gcc/x86_64-pc-linux-gnu/ld: error: /usr/lib64: read: Is a directory
```
2023-12-26 18:09:34 -05:00
Sergey Vlasov 5ff6049945 swift: Support swift_args
Fixes #12533
2023-12-26 10:33:08 -08:00
Eli Schwartz f1035e0cd0 run_project_tests: fix assertion that crashes if you have git worktrees
git worktrees are frequently a handy tool to use. This glob pattern
asserts an error if the same named directory appears more than once,
which it will -- once per worktree -- but only because it is globbing
the entire project root, even though it should always only exclusively
care about files in `test cases/`. So just glob correctly, and then I
can run the testsuite locally again.
2023-12-24 07:55:30 -08:00
Eli Schwartz 7d652a6138 project tests: handle code internally fetching the meson command
Fixes crash when running the tests and yasm is installed, but nasm is
not. When printing the compilers at early startup in
run_project_tests.py, we try to detect the nasm compiler, which in this
case turns out to be yasm, and its exelist assumes that the meson
command is set.

Fixes #12662
2023-12-24 07:55:30 -08:00
Charles Brunet 4761e4cad9 Remove `get_buildtype_args` function
This is a first step to make `buildtype` a true alias of `debug` and
`optimization` options.

See #10808.

Relates to:
- #11645
- #12096
- #5920
- #5814
- #8220
- #8493
- #9540
- #10487
- #12265
- #8308
- #8214
- #7194
- #11732
2023-12-23 13:32:49 +02:00
Denis Drakhnia 360d81e4aa compilers/elbrus: wrap get_default_include_dirs with lru_cache 2023-12-23 00:31:53 -08:00
Dylan Baker 6ccd708f30 modules: get rid of the .*machine variables
They're hardly used, and can be gotten directly from the Environment
instead
2023-12-22 11:31:48 -08:00
Dylan Baker 7cbaa6613a backend/vs: use the host machine instead of the target machine
This could lead to subtle bugs if you happened to be building a project
that is some sort of toolchain (compiler, linker, etc)
2023-12-22 11:31:48 -08:00
Dylan Baker c37cd4fe9a stop using the interpreter holders for the MachineInfo
Anywhere we have that, we also have the Environment object, which is
just wrapped by the Interpreter methods anyway. This avoids inderections
that are unnecessary.
2023-12-22 11:31:48 -08:00
Charles Brunet 35d89301a9 tests: skip symlink creation when not supported 2023-12-22 09:46:04 -08:00
Dylan Baker 8bc8f93436 cmake/interperter: Add missing type annotation
Which mypy is suddenly complaining about.
2023-12-21 13:15:23 -08:00
Nirbheek Chauhan 191449f608 ci: Don't auto-update brew when installing
We're getting errors that we don't care about on the CI like:

```
==> Pouring node@18--18.19.0.monterey.bottle.tar.gz
The formula built, but is not symlinked into /usr/local
Error: The `brew link` step did not complete successfully
Could not symlink lib/node_modules/npm/docs/content/commands/npm-sbom.md
Target /usr/local/lib/node_modules/npm/docs/content/commands/npm-sbom.md
already exists. You may want to remove it:
  rm '/usr/local/lib/node_modules/npm/docs/content/commands/npm-sbom.md'
```

We don't care about node, the only reason it's getting updated is
because it's already installed on the image and brew is auto-updating
it. So let's disable auto-update.
2023-12-20 14:03:34 -08:00
Dylan Baker 730cce09bd
interpreter: Also check for msvc style /fsanitize 2023-12-20 14:17:09 -05:00
Dylan Baker 8db1ca1766
interpreter: Don't warn on -fsanitze-*
We really only want to warn on `-fsanitize=foo` or `-fsanitize foo`, but
not things like `-fsanitize-recover=...`

Fixes #9822
Fixes #7192
2023-12-20 14:17:09 -05:00
Dylan Baker 67c51820b7
compilers: Add partial docstrings for a couple of Compiler methods 2023-12-20 14:15:45 -05:00
Karol Herbst 0c3e84bbaf dependencies/llvm: strip default include dirs also for config-tool version
This should have been done in my earlier fix, but kinda forgot to test and
fix it there as well.

See https://github.com/mesonbuild/meson/pull/11733 for the discussion.

Fixes: 8284be813 ("dependencies/llvm: strip default include dirs")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
2023-12-20 13:36:23 +05:30
Michael Gene Brockus (Dreamer) 059b9e048d
Update Users.md (#12634)
* Update Users.md
2023-12-18 00:13:23 +02:00
Alyssa Ross 9322a29d7f Skip pkg-config-dependent tests if it's missing 2023-12-17 16:21:11 -05:00
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.

This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.

SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
2023-12-13 15:19:21 -05:00
Vincent Torri 1f82afe899 add the EFL, Enlightenment, libdwarf and ThorVG as users of meson 2023-12-13 08:29:55 -08:00
Nicolas Werner ebf5757c59 cmake: parse project version
This properly sets the project version in projects meson generates from
cmake projects. This allows dependency fallbacks to properly check the
version constraints in dependency calls when falling back to a cmake
subproject. Before this would fail, because the project version was
undefined.
2023-12-12 20:14:26 -05:00
Andres Freund f6f46173c4 macos: Fix test_pkgconfig_parse_libs() test on arm
The unit test infrastructure hardcodes the architecture as x86_64. On
macos, the test_pkgconfig_parse_libs() test creates a few libraries
for testing using clang. This leads to the test failing on arm based
macs, as darwin_get_object_archs() will skip over these libraries,
which then leads to the test failing because of using -l instead of
referencing the libraries by their full path.

I am not at all sure this is the best approach.

I am also somewhat confused why nobody else has encountered this? CI
apparently just runs on x86_64 macs?

CC: @tristan957
2023-12-13 00:44:59 +02:00
Charles Brunet c168687439 do not trigger workflows on dev branches 2023-12-13 00:13:15 +02:00
H. Vetinari cc5a95a56a detect windows linkers for flang in detect_fortran_compiler 2023-12-11 21:54:47 +02:00
Eli Schwartz fbb8030b27 xcode backend: sundry type annotations
Down from 120 to 44 mypy errors.
2023-12-11 21:13:20 +02:00
Eli Schwartz ff7a997f48 xcode backend: make the type of get_target_dir align with parent class
mypy will complain if backends.Backend has a lru_cache wrapped method,
but it is overridden in XCodeBackend with a method that isn't cached.

This is almost certainly a sign that we should be caching it here too
anyway. The generic backend cache was added years ago via an
intimidating commit f39d2cc3bf which
claims that it reduced call time from 60s to 0.000435s and that this was
specifically due to getting a coredata option every single time. This is
probably workload dependent, but getting an option is *not* nearly as
cheap as a throwaway function call.
2023-12-11 21:13:20 +02:00
Eli Schwartz d8a6bf9352 xcode backend: delete unused code 2023-12-11 21:13:20 +02:00
Eli Schwartz 78e23e48f2 backends: correct nonebackend return annotation and check in run_mypy
The only backend that can return values in generate() is ninja, so this
was useless cruft.
2023-12-11 21:13:20 +02:00
Eli Schwartz c341900d45 coredata: add a few more type annotations
89 erros down to 34. Most of them are from getting the `BUILTIN_*`
variables correct.
2023-12-11 21:13:20 +02:00
Albert Tang b1d2282078
xcode: Filter out targets not built by default 2023-12-10 22:01:23 -05:00
Albert Tang 2915ab31af
xcode: Override determine_swift_deps_dir()
Xcode does not recognize our private directories, nor does it ever
try to generate them. Instead, just import the build directories
for each swift dependency.

This fixes linking between swift targets when they are in their own
subdirectories, as they will have different build directories in that
case.
2023-12-10 22:01:23 -05:00
Albert Tang 354843c428
xcode: Enclose work directory in shell scripts 2023-12-10 22:01:23 -05:00
Albert Tang 1de398a377
xcode: Wrap custom target output paths in quotes
Without this, any build directory with a space in it was enough to
make Xcode fail to open the project due to parsing errors.
2023-12-10 22:01:23 -05:00
Albert Tang 0914f1739b
xcode: Fix generating single generator phase 2023-12-10 22:01:23 -05:00
Albert Tang 1b09cac252
xcode: Search for dependencies for custom targets
When generating aggregated targets, custom targets were not being
checked for dependencies when they should have.

Fixes passing swift test case 4 (generate).
2023-12-10 22:01:23 -05:00
Albert Tang 3836deeed2
xcode: Classify metal and glsl files correctly
This fixes syntax highlighting on Xcode when viewing those files.
2023-12-10 22:01:23 -05:00
Albert Tang 5bf99afe1a
xcode: Set bridging header for mixed swift targets
This must be explicitly set in Xcode or it will not be able to compile
mixed targets successfully. This is not needed for pure Swift targets.

Set a new variable "is_swift" so finding the bridging header does not
take O(n^2) time.

Fixes passing swift test case 5 (mixed) with Xcode backend.
2023-12-10 22:01:23 -05:00
Albert Tang 9d8f69a16f
xcode: Add support for extra files
Fixes #10903
2023-12-10 22:01:23 -05:00
arch1t3cht af0464352a vs: Manually link generated .o files
Fixes #12550 .

VS automatically links CustomBuild outputs ending in .obj or .res,
but others need to be included explicitly.
2023-12-10 22:01:03 -05:00
Eli Schwartz 17c6d5eb47
unittests: migrate from jsonschema to fastjsonschema
The former has rust dependencies, which lead to max capping on Cygwin
since there is no rust compiler there. But it turns out there are other
disadvantages of jsonschema:

- it involves installing 5 wheels, instead of just 1
- it is much slower

To give some perspective to the latter issue, this is what it looks like
when I test with jsonschema:

```
===== 1 passed, 509 deselected in 3.07s =====
Total time: 3.341 seconds
```

And here's what it looks like when I test with fastjsonschema:
```
===== 1 passed, 509 deselected, 1 warning in 0.28s =====
Total time: 0.550 seconds
```

I cannot think of a good reason to use the former. Although in order to
work on old CI images, we'll support it as a fallback mechanism
2023-12-10 19:02:39 -05:00
Daniele Nicolodi 5883089f6c ninja backend: Remove outdated comment
Generation of both C and C++ from Cython is supported via the
cython_language option.
2023-12-09 23:45:05 -08:00
Daniele Nicolodi 76ab2db086 ninja backend: Adjust naming and comments
Meson supports other transpilers generating source code for which
compilation rules need to be generated other than Vala. Reflect this
in variable names and comments to avoid confusion.
2023-12-09 23:45:05 -08:00
Daniele Nicolodi c2ea14fbd2 ninja backend: Make values passed to bool argument consistent 2023-12-09 23:45:05 -08:00
Daniele Nicolodi 7fbadfdeab ninja backend: Remove always true check 2023-12-09 23:45:05 -08:00
Stas Sergeev be04234c85 external_project.py: fix --host value
Currently in cross-compilation mode the --host is set to x86-linux-linux,
which results in an error.
Change the code so that for x86 and x86_64 the second part is 'pc',
and 'unknown' for the rest.
Use cpu model instead of cpu family for the first part, as suggested
by @dcbaker
As the result, we get: i386-pc-linux on my setup.

Fixes #12608
2023-12-08 12:31:01 -05:00
Erwin Jansen 5de09cbe88 Always use posix paths when retrieving link name
This commit modifies the get_target_filename_for_linking function to
always return POSIX-style paths, even on Windows systems. This is
necessary because the Ninja generator can have issues with Windows-style
paths when using the `/WHOLEARCHIVE:` flag.

This is consistent with the syntax accepted by the cl and clang-cl
compilers, as documented in the Microsoft documentation:
https: //learn.microsoft.com/en-us/cpp/build/reference/cl-filename-syntax?view=msvc-170

Fixes: 12534
2023-12-07 11:59:40 +02:00
David Robillard 254abb999f Fix coverage with lcov 2.0 and uncovered subprojects
Version 2.0 of lcov triggers an error when an exclude pattern is unused.  This
can happen when the project has subprojects, but no code in them ends up
covered:

lcov: ERROR: 'exclude' pattern '/[...]/subprojects/*' is unused.
	(use "lcov --ignore-errors unused ..." to bypass this error)

So, simply do as it says.  Unused patterns doesn't seem problematic (or even
interesting) here, so I don't think there's any risk in simply turning this
off, which matches what happened with earlier versions of lcov anyway.
2023-12-06 23:54:42 +02:00