summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
AgeCommit message (Collapse)Author
2023-02-20nasm: Link with windows CRT libs when nasm is used as linker languageXavier Claessens
2023-02-01remove unneeded type commentEli Schwartz
2022-10-25compilers: Make sure to not use ccache in compiler checksXavier Claessens
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-25Compilers: Keep ccache and exelist separatedXavier Claessens
Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
2022-10-24Add MASM compilerXavier Claessens
ml and armasm are Microsoft's Macro Assembler, part of MSVC.
2022-10-24Not all compilers support depfileXavier Claessens
2022-10-24Add NASM compilerXavier Claessens
2022-10-23Compilers: Add a preprocessor mode for clike compilersXavier Claessens
A compiler object can now return a list of "modes", they are new compiler object specialized for a specific task.
2022-10-13Add b_thinlto_cache for automatically configuring incremental ThinLTOTatsuyuki Ishi
2022-10-09compilers: Add optimization=plain optionJan Tojnar
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-09-27compilers: Cleanup a bit languages/suffixes listsXavier Claessens
Use set where order does not matter, fix is_source() to really mean only source suffixes.
2022-09-09compilers: drop some useless info from CompileResultEli Schwartz
text_mode was never set, nor used, and pid was set but never used.
2022-09-09compilers: fix regression in logging cached compile commandsEli Schwartz
In commit d326c87fe22507b8c25078a7cd7ed88499ba7dc1 we added a special holder object for cached compilation results, with some broken attributes: - "command", that was never set, but used to print the log - "args", that was set to some, but not all, of the information a fresh compilation would log, but never used Remove the useless args attribute, call it command, and use it properly.
2022-09-01env2mfile: reuse logical lists of interesting facts from meson itselfEli Schwartz
Meson internally knows about many languages and tools, and *FLAGS variables, and which languages to use them for. Instead of duplicating this logic, import it from mesonbuild.* This logic was originally standalone, but now that it is merged into the Meson tree we can have a single source of truth.
2022-08-24fix linker regression for compilers that don't accept LDFLAGS directlyEli Schwartz
e.g. ldc -- the compiler needs to process args before consuming them. Fixes #10693
2022-07-03move various unused typing-only imports into type-checking blocksEli Schwartz
2022-06-06compilers: Add support for stand-alone leak sanitizerMarco Trevisan (Treviño)
Leak sanitizer can be enabled without the whole AddressSanitizer, this can be done by passing -fsanitize=leak as documented at [1]. Meson doesn't support this, so add support for it. [1] https://clang.llvm.org/docs/LeakSanitizer.html
2022-06-01compiler: Add missing needs_static_linker to base Compiler classDylan Baker
2022-04-30linkers: Add support for mold linkerFini Jastrow
[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-03-22OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens
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-02-16flake8: fix various whitespace errors with badly aligned codeEli Schwartz
2021-12-30fix type annotations for compiler toolchain rpathsEli Schwartz
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-11-01migrate python 3.5 compatible superclass variable annotations to 3.6Eli Schwartz
As we now require python 3.6, we can declare their types without initializing them.
2021-10-29Remove duplicated CEXE_MAPPING tableXavier Claessens
2021-10-10Fix typos discovered by codespellChristian Clauss
2021-09-28Merge pull request #9014 from bonzini/mixed-language-linkJussi Pakkanen
Use appropriate compiler for the source file for "links" tests with file argument
2021-09-25compilers: Add default search path stdlib_only_link_flagsDylan Baker
This should be done in all cases of language_stdlib_only_link_flags, but I don't have access to all of the compilers to test it. This is required in cases where object files created by gfortran are linked using another compiler with a differen default search path, such as gfortran and clang together.
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz
2021-09-07interpreter: detect and pass compiler to be used for linker testsPaolo Bonzini
Allow using the links method to test that the C++ driver (e.g. g++) can be used to link C objects. One usecase is that the C compiler's libsanitizer might not be compatible with the one included by the C++ driver. This is theoretically backwards-incompatible, but it should be treated as a bugfix in my opinion. There is no way in Meson to compile a .c file with the C++ driver as part of a build target, therefore there would be no reason to do something like meson.get_compiler(meson.get_compiler('cpp').links(files('main.c')). Fixes: #7703
2021-09-07compilers: allow link tests to use objects from a different compilerPaolo Bonzini
In some cases, link tests would like to use objects provided by a compiler for a different language, for example linking a C object file with a C++ compiler. This kind of scenario is what link_language is for, but it is impossible to test that it works with a linker test. This patch implements the required support in the Compiler class. The source code compiler is passed to the Compiler.links method as an argument.
2021-09-07compilers: do accept None in Compiler.compile extra_argsPaolo Bonzini
The type information allows it, but it is not actually handled.
2021-09-07compilers: fix flake8 issuesPaolo Bonzini
2021-09-01Clang should error for all implicit function checks (#9165)Dylan Baker
* compilers: improve docstring to `get_compiler_check_args()` There was an incomplete list, which wasn't useful as it now takes an enum anyway. Also add a new entry to the list of reasons to use this function. * clang: Add -Werror=implicit-function-declarations to check_args Unlike GCC, clang warns but doesn't error when an implicit function declaration happens. This means in checks like `compiler.has_header_symbol('string.h', 'strlcat')` (on Linux, at least) that GCC will fail, as there is no such function; clang will emit a warning, but since it exists with a 0 status Meson interprets that as success. To fix this, add `-Werror=implicit-function-declarations` to clang's check arguments. There seems to be something specific about functions that _may_ exist in a header on a given system, as `cc.has_header_symbol('string.h', 'foobar')` will return false with clang, but `strlcat` will return true, even though it's not defined. It is however, defined in some OSes, like Solaris and the BSDs. Fixes #9140
2021-08-20compilers: Add get_no_warn_args to the base Compiler classDylan Baker
Because it should be defined there.
2021-08-16compilers/compilers: Fix some potential issues spotted by pyrightDylan Baker
There are two changes here, one is to remove an `elif` that is effectively an `else`, that helps the type checker and provides a small speedup potentially. The second is a potentially unbound variable, that currently isn't hit, but very much could be.
2021-08-16compilers: Fix extra_args parameterDylan Baker
which can also be a callable taking a CompileChekcMode as an argumetn and returning a list of strings.
2021-08-16compilers: Fix annotations for run and cached_compileDylan Baker
Which absolutely should accept `str | File`, but the annotations claim that only strings are accepted.
2021-08-08Add support for finding Javascript source libraries with Emscripten.Jussi Pakkanen
2021-07-14linkers: remove is_shared_module argument to get_soname_argsPaolo Bonzini
The argument is now unused, drop it.
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger
2021-06-22Fixed style issue as per comments on PR 8911.Justin Handville
2021-06-22Fix for Issue 8910 (Meson filters CMake asm files)Justin Handville
2021-06-18holders: Introduce HoldableObjectDaniel Mensinger
2021-06-09compilers: Fix missing functions in Compiler base classDaniel Mensinger
2021-06-07compilers: Add cython file suffixesDylan Baker
2021-06-02use an immutable list for an lru_cached functionsDylan Baker
When mutable items are stored in an lru cache, changing the returned items changes the cached items as well. Therefore we want to ensure that we're not mutating them. Using the ImmutableListProtocol allows mypy to find mutations and reject them. This doesn't solve the problem of mutable values inside the values, so you could have to do things like: ```python ImmutableListProtocol[ImmutableListProtocol[str]] ``` or equally hacky. It can also be used for input types and acts a bit like C's const: ```python def foo(arg: ImmutableListProtocol[str]) -> T.List[str]: arg[1] = 'foo' # works while running, but mypy errors ```
2021-05-19compilers: Add `get_debug_args` to base CompilerDylan Baker
This was missed, there should be an implementation in the base Compiler class, if for nothing else to help mypy
2021-05-19.C files are now treated as C++ codeVolker-Weissmann
2021-04-01environment: get environment variables for both host and build machinesDylan Baker
Fixes #8605
2021-03-30Split environment variable and command line cflagsDylan Baker
They are supposed to have different behavior. The environment variables apply to both the compiler and linker when the compiler acts as a linker, but the command line ones do not. Fixes #8345