summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
Commit message (Collapse)AuthorAgeFilesLines
* compilers: split code for deciding if debug is needed into a helperDylan Baker2023-04-211-4/+12
|
* compilers: convert method to get assert control to a booleanDylan Baker2023-04-211-5/+10
| | | | | | | | C like compilers only off `-DNDEBUG` to disable asserts. This is not a universal paradigm however. Rust, for example has an argument that takes a boolean. To better represent this, we allow passing a `disable` boolean. `disable` was chosen rather than `enable` because it allowed all existing logic to be left in place
* intro: add more details to generated json filesCharles Brunet2023-04-201-1/+1
| | | | | | | | | | | | | | This will help with the writing of tools to generate VisualStudio project and solution files, and possibly for other IDEs as well. - Used compilers a about `host`, `build` and `target` machines arere listed in `intro-compilers.json` - Informations lister in `intro-machines.json` - `intro-dependencies.json` now includes internal dependencies, and relations between dependencies. - `intro-targets.json` now includes dependencies, `vs_module_defs`, `win_subsystem`, and linker parameters.
* fix various spelling issuesJosh Soref2023-04-111-3/+3
| | | | Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
* asm: Add sx extensionRenan Lavarec2023-03-231-1/+1
| | | | | | | | | | docs: gcc https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html scons: https://scons.org/doc/3.0.5/HTML/scons-user/apb.html .S Windows: assembly language file ARM: CodeSourcery Sourcery Lite .sx assembly language file + C pre-processor POSIX: assembly language file + C pre-processor
* prevent lib prefix warning from pkg-configCharles Brunet2023-03-161-1/+1
|
* Use caching in Compiler.sizeof() and Compiler.alignment()Andres Freund2023-02-271-2/+2
|
* Add Compiler.cached_run()Andres Freund2023-02-271-1/+29
| | | | | | | | Caching Compiler.run() seems likely to cause problems, but some users, like .sizeof(), we know enough about the program run to make it safe. This commit just adds the Compiler.cached_run(), a subsequent commit makes use of it.
* Misleading comment mtribiere2023-02-251-1/+1
| | | Code moved to detect.py in recent version
* nasm: Link with windows CRT libs when nasm is used as linker languageXavier Claessens2023-02-201-1/+1
|
* remove unneeded type commentEli Schwartz2023-02-011-1/+1
|
* compilers: Make sure to not use ccache in compiler checksXavier Claessens2022-10-251-3/+4
| | | | | | | | | | 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.
* Compilers: Keep ccache and exelist separatedXavier Claessens2022-10-251-2/+2
| | | | | Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
* Add MASM compilerXavier Claessens2022-10-241-1/+2
| | | | ml and armasm are Microsoft's Macro Assembler, part of MSVC.
* Not all compilers support depfileXavier Claessens2022-10-241-1/+1
|
* Add NASM compilerXavier Claessens2022-10-241-1/+2
|
* Compilers: Add a preprocessor mode for clike compilersXavier Claessens2022-10-231-0/+12
| | | | | A compiler object can now return a list of "modes", they are new compiler object specialized for a specific task.
* Add b_thinlto_cache for automatically configuring incremental ThinLTOTatsuyuki Ishi2022-10-131-4/+12
|
* compilers: Add optimization=plain optionJan Tojnar2022-10-091-2/+4
| | | | | | | | | | | | | | 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`.
* compilers: Cleanup a bit languages/suffixes listsXavier Claessens2022-09-271-18/+22
| | | | | Use set where order does not matter, fix is_source() to really mean only source suffixes.
* compilers: drop some useless info from CompileResultEli Schwartz2022-09-091-5/+2
| | | | text_mode was never set, nor used, and pid was set but never used.
* compilers: fix regression in logging cached compile commandsEli Schwartz2022-09-091-4/+3
| | | | | | | | | | | | | 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.
* env2mfile: reuse logical lists of interesting facts from meson itselfEli Schwartz2022-09-011-0/+1
| | | | | | | | | 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.
* fix linker regression for compilers that don't accept LDFLAGS directlyEli Schwartz2022-08-241-1/+5
| | | | | | e.g. ldc -- the compiler needs to process args before consuming them. Fixes #10693
* move various unused typing-only imports into type-checking blocksEli Schwartz2022-07-031-1/+3
|
* compilers: Add support for stand-alone leak sanitizerMarco Trevisan (TreviƱo)2022-06-061-1/+1
| | | | | | | | | 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
* compiler: Add missing needs_static_linker to base Compiler classDylan Baker2022-06-011-0/+3
|
* linkers: Add support for mold linkerFini Jastrow2022-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | [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>
* OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens2022-03-221-2/+2
| | | | | | 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.
* flake8: fix various whitespace errors with badly aligned codeEli Schwartz2022-02-161-1/+1
|
* fix type annotations for compiler toolchain rpathsEli Schwartz2021-12-301-1/+1
| | | | | 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.
* migrate python 3.5 compatible superclass variable annotations to 3.6Eli Schwartz2021-11-011-5/+3
| | | | | As we now require python 3.6, we can declare their types without initializing them.
* Remove duplicated CEXE_MAPPING tableXavier Claessens2021-10-291-5/+0
|
* Fix typos discovered by codespellChristian Clauss2021-10-101-1/+1
|
* Merge pull request #9014 from bonzini/mixed-language-linkJussi Pakkanen2021-09-281-8/+20
|\ | | | | Use appropriate compiler for the source file for "links" tests with file argument
| * interpreter: detect and pass compiler to be used for linker testsPaolo Bonzini2021-09-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * compilers: allow link tests to use objects from a different compilerPaolo Bonzini2021-09-071-2/+12
| | | | | | | | | | | | | | | | | | | | | | 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.
| * compilers: do accept None in Compiler.compile extra_argsPaolo Bonzini2021-09-071-1/+2
| | | | | | | | The type information allows it, but it is not actually handled.
| * compilers: fix flake8 issuesPaolo Bonzini2021-09-071-7/+6
| |
* | compilers: Add default search path stdlib_only_link_flagsDylan Baker2021-09-251-1/+1
| | | | | | | | | | | | | | | | | | 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.
* | apply flake8 fixes for unused imports and missing importsEli Schwartz2021-09-141-2/+2
|/
* Clang should error for all implicit function checks (#9165)Dylan Baker2021-09-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * 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
* compilers: Add get_no_warn_args to the base Compiler classDylan Baker2021-08-201-0/+4
| | | | Because it should be defined there.
* compilers/compilers: Fix some potential issues spotted by pyrightDylan Baker2021-08-161-2/+4
| | | | | | | 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.
* compilers: Fix extra_args parameterDylan Baker2021-08-161-13/+15
| | | | | which can also be a callable taking a CompileChekcMode as an argumetn and returning a list of strings.
* compilers: Fix annotations for run and cached_compileDylan Baker2021-08-161-5/+5
| | | | | Which absolutely should accept `str | File`, but the annotations claim that only strings are accepted.
* Add support for finding Javascript source libraries with Emscripten.Jussi Pakkanen2021-08-081-1/+2
|
* linkers: remove is_shared_module argument to get_soname_argsPaolo Bonzini2021-07-141-3/+2
| | | | The argument is now unused, drop it.
* fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger2021-06-291-2/+2
|
* Fixed style issue as per comments on PR 8911.Justin Handville2021-06-221-2/+1
|