aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
AgeCommit message (Collapse)AuthorFilesLines
2020-11-14Add prelinking support for static libraries.prelinkJussi Pakkanen1-0/+2
2020-11-08Fix "generator doesn't stop" on WindowsChristoph Reiter1-1/+1
When TemporaryDirectory() cleans up on __exit__ it sometimes throws OSError noting that the dir isn't empty. This happens after the first yield in this generator and leads to the exception being handled which leads to a second yield. contextlib.contextmanager() fails then since the function it wraps is only allowed to yield once. Fix this by not yielding again in the error case. Fixes #7947
2020-11-08Add thinlto support. Closes #7493.Jussi Pakkanen1-8/+8
2020-10-16Refactor handling of machine file optionsXavier Claessens1-8/+3
It is much easier to not try to parse options into complicated structures until we actually collected all options: machine files, command line, project()'s default_options, environment.
2020-10-14vs: add static_from_buildtype to b_vscrtPeter Harris1-1/+1
2020-10-07Add win_subsystem kwarg. Closes #7765.Jussi Pakkanen1-0/+7
2020-10-01compilers: make get_optimization_args abstractDylan Baker1-1/+2
2020-10-01compilers/d: add type annotationsDylan Baker1-0/+5
2020-10-01compilers: move _build_wrapper out of clike into CompilerDylan Baker1-14/+74
This abstraction is really useful, and most compilers could use it (including D). It also will allow the Gnu mixins to work properly without the CLikeCompiler in their mro.
2020-10-01compilers: move get_compile_check_args() to CompilerDylan Baker1-4/+30
This is groundwork to put _build_wrapper in the base Compiler, which is needed to make the D compilers truly type safe.
2020-10-01compilers/fortran: add type annotationsDylan Baker1-0/+9
2020-10-01Compilers/vala: Add type annotationsDylan Baker1-0/+9
2020-10-01compilers/cuda: make type safeDylan Baker1-0/+10
2020-10-01compilres: move depfile_for_object to compilerDylan Baker1-0/+5
2020-10-01compilers/cs: Add type annotationsDylan Baker1-0/+8
2020-10-01compilers: move get_dependency_gen_args to base CompilerDylan Baker1-0/+3
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-01compilers: move split_shlib_to_parts to the base compilerDylan Baker1-0/+3
Only the GnuLikeCompiler overrides this, and it's implemented multiple places
2020-10-01compilers/cpp: Add type annotationsDylan Baker1-0/+11
2020-10-01compilers: fully type annotate the C compilersDylan Baker1-0/+1
2020-09-24compilers: Tell mypy that the compiler mixins are just thatDylan Baker1-12/+11
We do this by making the mixins inherit the Compiler class only when mypy is examining the code (using some clever inheritance shenanigans). This caught a bunch of issues, and also lets us delete a ton of code.
2020-09-24compilers: make is_cross part of the base Compiler classDylan Baker1-1/+2
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-24compilers: put name_string method in base compilerDylan Baker1-0/+3
Every language had the exact same implementation
2020-09-24compilers/mixins/intel: Use the has_func_attribute_extra_args functionDylan Baker1-0/+3
Instead of putting that extra argument in the base compiles() class
2020-09-24compilers/mixins/clang: Make type safeDylan Baker1-0/+8
2020-09-24compilers/mixins/clike: fix mypy issuesDylan Baker1-33/+50
2020-09-24compilers/compilers: Fully type annotateDylan Baker1-163/+254
2020-09-24compilers: Use a distinct type for compile/link resultsDylan Baker1-19/+33
Currently we do some crazy hackery where we add extra properties to a Popen object and return that. That's crazy. Especially since some of our hackery is to delete attributes off of the Popen we don't want. Instead, let's just have a discrete type that has exactly the properties we want.
2020-09-13external-project: New module to build configure/make projectsXavier Claessens1-0/+3
This adds an experimental meson module to build projects with other build systems. Closes: #4316
2020-09-08typing: get rid of most T.castDaniel Mensinger1-1/+1
2020-07-13Fix native builds on Windows ARM64 machinesNirbheek Chauhan1-3/+0
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-06-22compilers: Return CompilerArgs from compiler instanceDylan Baker1-2/+7
Since the CompileArgs class already needs to know about the compiler, and we really need at least per-lanaguage if not per-compiler CompilerArgs classes, let's get the CompilerArgs instance from the compiler using a method.
2020-06-22compilers: Split CompilerArgs into a separate moduleDylan Baker1-370/+2
I've also moved this out of the compilers pacakge because we're soon going to need it in linkers, and that creates some serious spagetti
2020-06-22compilers: Add missing annotations to CompilerArgs classDylan Baker1-16/+14
2020-06-22compilers: Use enum for for deupdlication returns in CompilerArgsDylan Baker1-27/+36
2020-06-11apple: -headerpad args are ignored when bitcode is enabledNirbheek Chauhan1-2/+6
Causes spammy warnings from the linker: ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
2020-06-11compilers: corretify deduplication directionMarcel Hollerbach1-2/+2
so: when building compile args, meson is deduplicating flags. When a compiler argument is appended, a later appearance of a dedup'ed is going to remove a earlier one. If the argument is prepended, the element *before* the new one is going to be removed. And that is where the problem reported in https://github.com/mesonbuild/meson/pull/7119 is coming in. In the revision linked there, the order of replacement in the prepend case was revesered. With this patch, we restore this behaviour again.
2020-06-09compilers: Add UNIX large file support for MinGWSeungha Yang1-3/+3
MinGW gcc supports _FILE_OFFSET_BITS=64 and we need to set it for MinGW as well
2020-06-07Merge pull request #7119 from marcelhollerbach/masterJussi Pakkanen1-37/+68
Performance optimize ninja backend
2020-06-06msvc: Avoid spurious openmp link warningsPeter Harris1-0/+3
The linker that comes with MSVC does not understand the /openmp flag. This results in a string of LINK : warning LNK4044: unrecognized option '/openmp'; ignored warnings, one for each static_library linked with an executable. Avoid this by only setting the linker openmp flag when the compiler is not MSVC.
2020-06-05CompilerArgs: refactor __iadd__Marcel Hollerbach1-18/+64
the previous optimizations from 4524088d386d2e2315d8fef6ffedc11d8e9a394a were not relaly good, and not really scaleable, since only the lookup was improved. However, the really heavy calls to remove have not been improved. With this commit we are refactoring CompilerArgs into a data structure which does not use remove at all. This works that we are building a pre and post list, which gets flushed into __container at some point. However, we build pre and post by deduplicating forward. Later on, when we are flushing pre and post into __container, we are deduplicating backwards the list, so we are not changing behaviour here. This overall cuts off 10s of the efl configuration time. Further more this improves configure times on arm devices a lot more, since remove does seem to be a lot slower there. In general this results in the fact that __iadd__ is not within the top 5 of costly functions in generate_single_complie.
2020-06-05Revert "CompilerArgs: make lookup faster"Marcel Hollerbach1-26/+7
This was a not so nice solution, and should be replaced with something better. This reverts commit 4524088d386d2e2315d8fef6ffedc11d8e9a394a.
2020-06-05cache up regex mathingsMarcel Hollerbach1-2/+6
the names passed in here are often the same. We should ensure that we cache the regex match, as this will speed up our runtime a lot.
2020-05-27add type anno: compilers/clikeMichael Hirsch, Ph.D1-3/+3
2020-05-27Recognize Arduino .ino files as C++Phillip Johnston1-1/+1
Renaming .ino files is not an option when working with the IDE. Meson should recognize it as C++ however.
2020-05-20compilers/d: Add b_ndebug supportDylan Baker1-3/+3
D lang compilers have an option -release (or similar) which turns off asserts, contracts, and other runtime type checking. This patch wires that up to the b_ndebug flag. Fixes #7082
2020-05-20compilers: Move b_ndebug into the compiler classesDylan Baker1-1/+4
Right now we hardcode -DNDEBUG as the value to be added for b_ndebug. Which is a not the correct behavior for non C/C++ languages. By pushing this back into the compiler classes we can change this for other languages.
2020-05-18Merge pull request #7103 from dankegel/bug4027-rpath-rememberJussi Pakkanen1-1/+1
Let .pc files and LDFLAGS provide rpaths.
2020-05-16Let .pc files specify rpath.Dan Kegel1-1/+1
Fixes #4027
2020-05-13macos: Remove framwork linkerlike argsEric Lemanissier1-1/+1
fixes-up 33fbc548ab74e79280d2f57b2cd499d14c1f1e91
2020-04-20Compiler options per langJohn Ericson1-6/+7
A current rather untyped storage of options is one of the things that contributes to the options code being so complex. This takes a small step in synching down by storing the compiler options in dicts per language. Future work might be replacing the langauge strings with an enum, and defaultdict with a custom struct, just like `PerMachine` and `MachineChoice`.