Commit Graph

47 Commits

Author SHA1 Message Date
Xavier Claessens e68fcac919 compilers: Make sure to not use ccache in compiler checks
ccache was used in all command lines but disabled using CCACHE_DISABLE
in Compiler.compile() method. Wrapping invokations still has a cost,
especially on Windows.

With sccache things are even worse because CCACHE_DISABLE was not
respected at all, making configure *extremely* slow on Windows when
sccache is installed.
2022-10-25 17:24:56 -04:00
Xavier Claessens 2961adb8c8 Compilers: Keep ccache and exelist separated
Only combine them in the Compiler base class, this will make easier to
run compiler without ccache.
2022-10-25 17:24:56 -04:00
Jan Tojnar a590cfde0c compilers: Add optimization=plain option
https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0`
to pass `-O0` to the compiler. This change is reasonable by itself
but unfortunately, it breaks `buildtype=plain`, which promises
that “no extra build flags are used”.

`buildtype=plain` is important for distros like NixOS,
which manage compiler flags for optimization and hardening
themselves.

Let’s introduce a new optimization level that does nothing
and set it as the default for `buildtype=plain`.
2022-10-09 14:43:18 +03:00
Dylan Baker 188c552dcf pylint: enable use-maxsplit-arg
This finds a bunch of places where we can do more efficient string
splitting.
2022-09-19 20:57:52 -04:00
Eli Schwartz a49cd00d64 treewide: various cleanups to move imports for mypy into typechecking blocks
Along the way, add __future__ annotations where lacking.
2022-06-10 09:15:48 -04:00
Fini Jastrow c16fdaeeca linkers: Add support for mold linker
[why]
Support for the relatively new mold linker is missing. If someone wants
to use mold as linker `LDFLAGS="-B/path/to/mold"` has to be added instead
of the usual `CC_LD=mold meson ...` or `CXX_LD=mold meson ...`.

[how]
Allow `mold' as linker for clang and newer GCC versions (that versions
that have support).

The error message can be a bit off, because it is generic for all GNU
like compilers, but I guess that is ok. (i.e. 'mold' is not listed as
possible linker, even if it would be possible for the given compiler.)

[note]
GCC Version 12.0.1 is not sufficient to say `mold` is supported. The
expected release with support will be 12.1.0.
On the other hand people that use the un-released 12.0.1 will probably
have built it from trunk. Allowing 12.0.1 is helping bleeding edge
developers to use mold in Meson already now.

Fixes: #9072

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-04-30 10:06:22 -04:00
Xavier Claessens 06d12064d0 OptionOverrideProxy: Make it immutable to avoid copies
It is always used as an immutable view so there is no point in doing
copies. However, mypy insist it must implement the same APIs as
Dict[OptionKey, UserOption[Any]] so keep faking it.
2022-03-22 17:20:48 -04: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
Dylan Baker 034b3a92d9 compilers/rust: fix typo in standard description 2021-10-21 13:48:01 -04:00
Dylan Baker 841dc2a4e7 compilers/rust: add support for the 2021 edition 2021-10-21 13:48:01 -04:00
Dylan Baker 30202a2402 compilers/rust: Add support for clippy
Clippy is a compiler wrapper for rust that provides an extra layer of
linting. It's quite popular, but unfortunately doesn't provide the
output of the compiler that it's wrapping in it's output, so we don't
detect that clippy is rustc. This small patch adds a new compiler class
(that is the Rustc class with a different id) and the necessary logic to
detect that clippy is in fact rustc)

Fixes: #8767
2021-09-24 18:48:48 -07:00
Dylan Baker 6514abf681 rustc: implement pic args 2021-09-24 18:48:48 -07:00
Dylan Baker d32fc0563d compilers/rust: Implement warning levels
Currently this implements 3 warning levels, 1 and 2 are just the
"default" set by rustc, 3, is "everything is a warning", and 0 is
"nothign is a warning".
2021-09-24 18:48:48 -07:00
Dylan Baker e2260650a0 rust: Add werror arguments 2021-09-24 18:48:48 -07:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Dylan Baker b1b8e777a2 rust: override get_linker_always_args
instead of opencoding what should be there in the rust compile rule
2021-05-19 23:28:17 +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
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.

this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
2021-01-04 12:20:40 -08: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 5afd608a75 compilers/rust: add and use an implementation of use_linker_args 2020-11-13 09:00:35 -08:00
Dylan Baker ce46070b4e compilers/rust: Add color output
Rust has color output, although it's help doesn't document it. It uses
the same values as cargo (and everything else), auto, never, always.
2020-11-10 12:09:21 -08:00
Dylan Baker e430c01ef5 compilers/rust: Add vs_crt support
As far as I can Tell, rust just handles this for us (it's always worked
with no special arguments from us). However, since we're going to add
support for base options for rust, we need to add the method.
2020-11-10 12:09:03 -08:00
Dylan Baker 7860a6aeab rust: implement support for --edition
Using the std option, so now `rust_std=..` will work. I've chosen to use
"std" even though rust calls these "editions", as meson refers to
language versions as "standards", which makes meson feel more uniform,
and be less surprising.

Fixes: #5100
2020-11-05 21:24:20 +02:00
Dylan Baker 4430269d4e compilers/rust: add type annotations 2020-10-01 15:05:01 -07:00
Dylan Baker d3a059b55f compilers/cuda: make type safe 2020-10-01 15:05:00 -07:00
Dylan Baker 2c0fbe161d compilers: make is_cross part of the base Compiler class
Every class needs to set this, so it should be part of the base. For
classes that require is_cross, the positional argument remains in their
signature. For those that don't, they just allow the base class to set
their value to it's default of False.
2020-09-24 12:14:13 -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
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01: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
Dylan Baker ef9aeb188e Allow selecting the dynamic linker
This uses the normal meson mechanisms, an LD environment variable or via
cross/native files.

Fixes: #6057
2019-12-02 16:39:06 -08: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
Jussi Pakkanen 1ea3ddc6ad
Merge pull request #5681 from dcbaker/dynamic-linker-split
split dynamic linker representations from compilers
2019-08-20 23:14:05 +03:00
Jussi Pakkanen 80ef6fd69f Pass optimization flags to rustc properly. Closes: #5788. 2019-08-17 21:14:16 +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 b0f4ee2f94 compilers/rust: Proxy extra kwargs to Compiler.__init__ 2019-08-14 13:13:23 -07:00
Jussi Pakkanen d1dd6df37b Increase logging for Rust CI failures. 2019-06-22 00:56:29 +03:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
Jussi Pakkanen 8361da5c52 Fix setup so test suite runs with rustc + MSVC. Closes: 5099 2019-03-24 20:56:06 +02:00
Daniel Mensinger 9eca2e46a0
Added more compiler option support 2019-01-06 12:19:33 +01:00
Daniel Mensinger 9742927903
Absolute path generation refactoring 2019-01-06 12:19:32 +01:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Adam C. Foltzer 1d81efb03d Add cross-compilation support for `rustc`
This patch is largely modeled on the relatively-straightforward code
for Fortran cross-compilation, so there might be some intricacies
missing.
2018-01-29 15:47:05 -08:00
Jussi Pakkanen 2269b7f60b Add build_rpath as new property allowing people to specify rpath entries that are used in the build tree but will be removed on install. 2017-07-21 19:40:54 +03:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00