Commit Graph

9163 Commits

Author SHA1 Message Date
Jussi Pakkanen c0d86024f5 Rename option variable to optstore to make it unique. 2024-06-14 17:19: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
Wolfgang Walther dfd22db4be Add -export_dynamic flag for AppleDynamicLinker
The apple linker uses -export_dynamic instead of --export-dynamic [1].
This should be set when setting export_dynamic: true.

Resolves #13290

[1]:
https://opensource.apple.com/source/ld64/ld64-609/doc/man/man1/ld.1.auto.html
2024-06-05 02:26:04 +03:00
Jussi Pakkanen 560c032a4b
Merge pull request #13286 from mesonbuild/machinerefactor
Extract MachineFile code to its own file
2024-06-05 00:01:19 +03:00
Jussi Pakkanen 41a445c228 Extract native file parser to machinefile source file. 2024-06-04 22:45:41 +03:00
Albert Tang f70de5885c xcode: Skip generating PBXBuildStyle on Xcode 9 and above
This was removed on Xcode 9, so only generate it for Xcode 8.3.3
and lower.
2024-06-03 20:06:57 +03:00
Albert Tang da20ea01ca xcode: Generate files for highest detected version
Some settings require "objectVersion" to be set to a certain value or
Xcode will not use it. To fix this, we set it to the highest possible
value, determined by the detected version of Xcode. We also set
"compatibilityVersion", but mainly so it lines up with "objectVersion".

At the same time, we should not be generating Xcode 3.2-compatible
projects by default anyway.
2024-06-03 20:06:57 +03:00
Albert Tang 8499e4535b xcode: Detect installed version of Xcode
This will allow for generating project files more specific to certain
versions of Xcode without breaking compatibility.
2024-06-03 20:06:57 +03:00
Jussi Pakkanen daa058e907 Start moving machine files to their own store. 2024-06-02 17:43:50 +03:00
Filipe Laíns e5aed6ac8f mintro: write humman-readable JSON
Signed-off-by: Filipe Laíns <lains@riseup.net>
2024-06-01 13:34:01 +03:00
David Seifert 7f2c6f644b cuda: disable thin archives when cuda is added through `add_languages('cuda')` later 2024-05-29 19:13:14 -04:00
Marc Durdin 0c802d260c remove deprecation warning for `configure_file` kwarg 'copy'
`configure_file` kwarg `copy` runs at configure time, whereas
`fs.copyfile` runs at build time. Both have use cases, so this
undeprecates the `configure_file` version.

Fixes: #12792
2024-05-24 18:27:59 -04:00
Eli Schwartz d57ca7d2a2
compilers: improve a comment describing why we add a silly clang workaround
Clang is such a great compiler! Not.

Compilers have enhanced diagnostics for some kinds of "well known"
undeclared identifiers, telling you exactly which header you might have
forgotten to include. The reason why clang needs an option GCC doesn't
need is because clang's fixit suggestions, unlike GCC's actually
*changes the type of the error*, as a result of a fixit of all things.

After the fixit suggestion grants this error the right to be ignored,
we start having to add clang-specific options.

Follow-up to https://github.com/mesonbuild/meson/issues/9140

Upstream clang bug, which appears to be going nowhere:
https://github.com/llvm/llvm-project/issues/33905
2024-05-24 17:10:32 -04:00
Sam James a66cb97e8c
Revert "rust: recursively pull proc-macro dependencies as well"
This reverts commit aee941559c.

The commit being reverted breaks compilation of a major Meson consumer
(Mesa). As a result, various distros are either pinning to <1.4.0 (before
the commit) or performing this same revert downstream.

Fixing a regression takes priority, so let's revert.

Fixes: https://github.com/mesonbuild/meson/issues/12973
2024-05-24 17:10:20 -04:00
Jussi Pakkanen 5365d9a842 Refactor option classes to their own file. 2024-05-23 21:26:45 +03:00
David Seifert 4861079360 cuda: fix `cuda.find_library()` hardcoded to yield true
* Previously, cuda would just plainly prepend `-l` to the libname.
* By relying on the host compiler to find libraries, we now get
  more subtle failures, such as CUDA modules not being found
  anymore.
* We need to simplify these CUDA modules when nvcc is used for
  linking, since this may have side-effects from the cuda toolchain.

Closes: #13240
2024-05-22 23:54:30 +03:00
Axel Ricard 4c6d370a0e add cross-compile argument for ldc linker guessing 2024-05-22 23:53:09 +03:00
Axel Ricard 8d7ffe6e86 fix sanity check for d cross-compilation 2024-05-22 23:53:09 +03:00
Eli Schwartz aa9b7b9445
pylint: fix useless-return
A bare return at the end of a function doesn't do anything. And in the
case of a try/except, it's really just an elaborate "pass" anyway.
2024-05-19 15:49:45 -04:00
Eli Schwartz 125d3344ec
pylint: fix false positive for variable defined in different copies of conditional
We do:

```
if is_thing:
    assignme = value

if_is_thing:
    ...
else:
    assignme = []
```

It is always defined on both sides, but there was no particular reason
we had to assign it in the later copy. pylint reported it as a false
positive, and it may prove confusing in general, and it's harmless to
move, so do so.
2024-05-19 15:49:45 -04:00
Eli Schwartz 29a62ff794
pylint: fix false positive for missing else branch
We cover every case as if/elif/elif. mypy can handle this fine, but
pylint doesn't do control flow or type checking and thinks in the
missing else case, the variable might not be defined.

For mypy as well, doing this instance check is unnecessary as it can be
inferred. So just micro-optimize the check and allow pylint to safely
analyze the logic.
2024-05-19 14:40:28 -04:00
Jussi Pakkanen 128f0e828e
Pass wrapmode value around as a string. (#13229) 2024-05-19 20:58:46 +03:00
Ralf Gommers 77db04ffa6 Fix handling of C standard support for Emscripten.
Emscripten version numbers are unrelated to Clang version numbers,
so it is necessary to change the version checks for `c_std=c17` & co.
Without that, no project that defaults to C17 or newer will build with
Emscripten.

See https://github.com/pyodide/pyodide/discussions/4762 for more
context. Also note that this bug caused defaulting to C17 in
scikit-learn to be reverted (scikit-learn#29015), and it may be a
problem for SciPy 1.14.0 too since that release will upgrade from C99
to C17.

Co-authored-by: Loic Esteve <loic.esteve@ymail.com>
2024-05-19 11:36:45 -04:00
Jussi Pakkanen f24307e559
Merge pull request #11421 from mon/ti-armclang
Basic support for TI Arm Clang toolchain
2024-05-15 22:53:58 +03:00
Stas Sergeev cfd57180ee implement @PLAINNAME0@ and @BASENAME0@
@PLAINNAME@ and @BASENAME@ cannot be used in custom_target()
with multiple inputs. For those, similar macros are needed
with an index.

Fixes #13164
2024-05-09 12:27:35 -07:00
Daan De Meyer bcaab91bf6 mtest: Set MESON_TEST_ITERATION to the current iteration of the test
When running our integration tests in systemd we depend on each test
having a unique name. This is always the case unless --repeat is used,
in which case multiple tests with the same name run concurrently which
causes issues when allocating resources that use the test name as the
identifier.

Let's set MESON_TEST_ITERATION to the current iteration of the test so
we can use $TEST_NAME-$TEST_ITERATION as our test identifiers which will
avoid these issues.
2024-05-08 08:05:44 -04:00
David Seifert b6e5683764 cuda: disable thin archives when 'cuda' is enabled globally
Bug: mesonbuild/meson/pull/9453
Bug: mesonbuild/meson/issues/9479#issuecomment-953485040
2024-05-07 22:32:35 -07:00
David Seifert 89a5bde9d9 cuda: pass static archives to nvcc without -Xlinker= prefix 2024-05-07 22:32:35 -07:00
David Seifert 33adc420f3 cuda: pull in libdir when linking C/C++
* In `CudaDependency._detect_language`, the first detected language is
  considered the linking one. Since `nvcc`/`cuda` implicitly know where the
  cuda dependency lives, this leads to situations where `cpp` as linking
  language is erroneously detected as `cuda` and then misses the `-L` argument.
2024-05-07 22:32:35 -07:00
Tristan Partin 8cb16b2d6a Add support for GCC's null_terminated_string_arg function attribute
This is new as of 14.1.
2024-05-07 15:33:32 -07:00
Tristan Partin 23eb7ba700 Use correct subdir when generating processed file path
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.

Fixes: #13168
2024-05-07 13:20:39 -07:00
Tristan Partin a0ff145512 Add required kwarg to compiler.{compiles,links,run}
This is a similar commit to the one that added required to all the
compiler.has* functions.
2024-05-01 11:20:27 -07:00
matyalatte f1f24816a9 use a for loop, check more linker options 2024-05-01 09:45:53 -07:00
matyalatte e3db7af0ea vs2010backend: fix an error when using /MANIFEST:NO 2024-05-01 09:45:53 -07:00
Ben Corby bd149f8bca Fix dependencies for vala.links #13158
Using the keyword argument dependencies with compiler.links() for vala doesn't work as the library being linked to needs to be prefixed with --pkg= before being passed to valac.
2024-04-30 11:07:57 -07:00
Eli Schwartz e5f32b7414 catch build files that cannot be opened in utf8 mode and emit useful error
Previously, if a junked meson.build or native.ini was used we got a
lengthy traceback ending in UnicodeDecodeError.

Fixes: #13154
Fixes: #13156
2024-04-28 22:51:08 +03:00
kkz 4f3a3e2efe add punctuation mark to make log more understandable 2024-04-28 18:10:03 +03:00
Jonathan Schleifer 6c6529337e Add support for depending on ObjFW
This uses objfw-config to get to the flags, however, there's still
several todos that can only be addressed once dependencies can have
per-language flags.
2024-04-28 03:14:29 -04:00
Jonathan Schleifer 205f09e1b0 Prefer Clang over GCC for Objective-C(++)
GCC only has very limited support for Objective-C and doesn't support
any of the modern features, so whenever Clang is available, it should be
used instead. Essentially, the only reason to ever use GCC for
Objective-C is that Clang simply does not support the target system.
2024-04-28 03:14:29 -04:00
Benjamin Gilbert c9aa4aff66 mdist: gracefully handle stale Git index
Running `touch` on a tracked file in Git, to update its timestamp, and
then running `meson dist` would cause dist to fail:

    ERROR: Repository has uncommitted changes that will not be included in the dist tarball
    Use --allow-dirty to ignore the warning and proceed anyway

Unlike `git status` and `git diff`, `git diff-index` doesn't refresh the
index before comparing, so stat changes are assumed to imply content
changes.  Run `git update-index -q --refresh` first to refresh the index.

Fixes: #12985
2024-04-27 21:58:41 -04:00
Benjamin Gilbert 2004b7c24d compilers/fortran: fix werror options for Intel compilers
Unlike in the Intel C compiler, -Werror and /WX are not accepted.
2024-04-27 08:09:03 -07:00
Benjamin Gilbert 1684259f10 backend/ninja: use generate_basic_compiler_args() for C#, Java, Swift
C#, Java, and Swift targets were manually collecting compiler arguments
rather than using the helper function for this purpose.  This caused each
target type to add arguments in a different order, and to forget to add
some arguments respectively:

C#:    /nologo, -warnaserror
Java:  warning level (-nowarn, -Xlint:all, -Xdoclint:all), debug arguments
       (-g, -g:none), -Werror
Swift: -warnings-as-errors

Fix this.  Also fix up some no-longer-unused argument processing in the
Compiler implementations.
2024-04-27 08:09:03 -07:00
Xavier Claessens 6a1732a29d nasm: Fallback to native compiler when cross compiling
If nasm is not defined in cross file binaries we can fallback to build
machine nasm.

When cross compiling C code we need a different gcc binary for native
and cross targets, e.g. `gcc` and `x86_64-w64-mingw32-gcc`. But when
cross compiling NASM code the compiler is the same, it is the source
code that has to be made for the target platform. We can thus use nasm
from build machine's PATH to cross compile for Windows on Linux for
example. The difference is the arguments Meson will pass when invoking
nasm e.g. `-fwin64`. That is already handled by NasmCompiler class.
2024-04-26 23:09:30 +05:30
Tristan Partin cb1068a288 Catch Python exception in the event alignment can't be converted to int
The user almost certainly has to be using a compiler wrapper script that
doesn't actually work if we land here.

Fixes: #12982
2024-04-25 18:49:57 -04:00