Commit Graph

64 Commits

Author SHA1 Message Date
Eli Schwartz 07d9c72e17
flake8: fix wrong numbers of blank line separators 2022-02-16 18:19:13 -05:00
Dylan Baker 1209b8820b compilers: push the compiler id to a class variable
It really is a per class value, and shouldn't be set per instance. It
also allows us to get rid of useless constructors, including those
breaking mypy
2022-01-10 15:53:26 -05:00
Eli Schwartz 9f384e9207
fix type annotations for compiler toolchain rpaths
We pass around a tuple of rpaths, because rpaths *can* be more than one.
But all the annotations said it would be a str instead.
2021-12-30 15:15:25 -05:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Xavier Claessens a3f3ddf581 cuda: Override std=none to avoid host_compiler to emit -std argument 2021-10-14 14:17:50 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
Dylan Baker e3c72ad7c7 compilers: Fix extra_args parameter
which can also be a callable taking a CompileChekcMode as an argumetn
and returning a list of strings.
2021-08-16 16:21:51 -07:00
David Seifert 28d13f4bfe
Cuda: Enable PGO 2021-07-18 23:14:38 +02:00
David Seifert d648f3497e
Cuda: Filter -isystem with system paths 2021-07-18 23:14:36 +02:00
David Seifert 631abce82f
Cuda: Pass -DNDEBUG through 2021-07-18 23:14:34 +02:00
Paolo Bonzini 3efed376c3 linkers: remove is_shared_module argument to get_soname_args
The argument is now unused, drop it.
2021-07-14 22:53:04 +02:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Olexa Bilaniuk 2579420a72 Strip host-compiler -std flag from NVCC line.
Closes #8523.
2021-03-28 20:12:45 +03:00
Olexa Bilaniuk 5941e94ff8 Retract "DQSQ" merging in NVCC arguments handling.
No coverage, no tests, unreadable, unused, likely premature
optimization.
2021-03-28 20:12:45 +03:00
Olexa Bilaniuk 3dbd493de2 Canonicalize and merge consecutive -Xcompiler flags together.
Makes command-line more readable.
2021-03-28 20:12:45 +03:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only --keep-percent-format"

and committing the results. I have not touched string formatting for
now.

- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
2021-03-04 17:11:26 -05:00
Eli Schwartz 76df995ba6
raw string literals are next to godliness
Invalid escape sequences are deprecated and will be removed from a
future version of python. Use r"" to define them so they remain
readable.
2021-03-04 17:09:00 -05:00
Olexa Bilaniuk 4c1a0c400f [CUDA] Bugfix: Forward sanitizer_*_args() methods to host compiler.
Enables -Db_sanitize=undefined and company.

Also serves as a testcase for NVCC comma-shielding: Because the test-
case declares `b_sanitize=address,undefined`, the host GCC compiler
needs `-fsanitize=address,undefined`, but this stands a danger of being
split by NVCC when wrapped with `-Xcompiler=args,args`. Special,
already-existing comma-shielding codepaths activate to prevent this
splitting.

Closes #8394.
2021-02-22 23:56:55 +02:00
Olexa Bilaniuk d1e945f442 Add optional -Dcuda_ccbindir= option and -ccbin flag to CUDA compiler.
Closes #8110.
2021-02-16 15:10:21 -05:00
Olexa Bilaniuk cc09d984f1 Armour-grade quoting to account for NVCC's -Xcompiler peculiarities. 2021-02-16 15:10:11 -05:00
Olexa Bilaniuk 3669be30aa Extensive rewrite of GCC/MVSC flag translation to NVCC flags. 2021-02-16 15:00:31 -05:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker a28a34c684 compilers: Standardize the names of compiler options
Most options don't use language prefaced options (std vs c_std)
internally, as we don't need that due to namespacing. Let's do that
across the board
2020-11-12 10:03:14 -08:00
Carlos Bederian c3b3dc598e compilers/cuda: Use format_map(mapping) instead of format(**mapping) 2020-10-16 18:18:46 +02:00
Carlos Bederian f09457a1e8 compilers/cuda: Fix has_header_symbol check 2020-10-16 18:18:46 +02:00
Dylan Baker d3a059b55f compilers/cuda: make type safe 2020-10-01 15:05:00 -07:00
Dylan Baker 224a752489 compilres: move depfile_for_object to compiler 2020-10-01 15:05:00 -07:00
Dylan Baker e7f0890cb9 compilers: move get_dependency_gen_args to base Compiler
So that every subclass doesn't have to reimplement it. Especially since
the Gnu implementation moved out of the CCompiler and into the
GnuLikeCompiler mixin
2020-10-01 15:05:00 -07:00
Dylan Baker fe97977b00 compilers/cpp: Add type annotations 2020-10-01 15:05:00 -07:00
Dylan Baker 98416e7f75 compilers: put name_string method in base compiler
Every language had the exact same implementation
2020-09-24 12:14:13 -07:00
Dylan Baker 79d1ecd5bc compilers/compilers: Fully type annotate 2020-09-24 12:14:13 -07:00
Nirbheek Chauhan 21da2c9040 Fix native builds on Windows ARM64 machines
I made the mistake of always selecting the debug CRT for compiler
checks on Windows 4 years ago:
https://github.com/mesonbuild/meson/pull/543
https://github.com/mesonbuild/meson/pull/614

The idea was to always build the tests with debugging enabled so that
the compiler doesn't optimize the tests away. But we stopped doing
that a while ago, and also the debug CRT has no relation to that.

We should select the CRT in the same way that we do for building
targets: based on the options.

On Windows ARM64, the debug CRT for ARM64 isn't always available, and
the release CRT is available only after installing the runtime
package. Without this, we will always try to pick the debug CRT even
when --buildtype=debugoptimized or release.
2020-07-13 15:28:38 +00:00
Dan Kegel d7235c5905 Let .pc files specify rpath.
Fixes #4027
2020-05-16 20:25:58 +00:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker 7460e4ccda compilers: Make get_display_language a class or static method
Currently this is done at the instance level, but we need it at the
class level to allow compiler "lang" args to be gotten early enough.
This patch also removes a couple of instance of branch/leaf classes
providing their own implementation that is identical to the Compiler
version.
2019-12-12 09:35:32 -08:00
Dylan Baker ee6e249f65 compilers: move language attribute to the class level
We know that if a compiler class inherits CCompiler it's language will
be C, so doing this at the class level makes more sense.
2019-12-12 09:35:30 -08:00
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Aleksey Gurtovoy f56ef583d3 dependency('cuda') 2019-11-05 22:17:44 +02:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00
Kramer Peace caec875fe1 Create CUDA linker with CUDA compiler
Since they are laways paired there is no need to "search" for the cuda
linker.
2019-09-05 08:38:56 -07:00
Kramer Peace fb9a5ce867 Add a CUDA linker object
Fixes issue #5870
2019-09-05 08:38:56 -07:00
Dylan Baker 0efab591da compilers: Move the compiler argument to proxy linker flags to the compiler class
Instead of the DynamicLinker returning a hardcoded value like
`-Wl,-foo`, it now is passed a value that could be '-Wl,', or could be
something '-Xlinker='

This makes a few things cleaner, and will make it possible to fix using
clang (not clang-cl) on windows, where it invokes either link.exe or
lld-link.exe instead of a gnu-ld compatible linker.
2019-08-30 00:01:32 +03:00
Dylan Baker 06dcbd50ee compilers: Dispatch to dynamic linker class
Most of the cuda code is from Olexa Bilaniuk.
Most of the PGI code is from Michael Hirsc
2019-08-14 13:13:23 -07:00
Dylan Baker 61255eca16 compilers/cuda: pass through extra kwargs 2019-08-14 13:13:23 -07:00