aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
AgeCommit message (Collapse)AuthorFilesLines
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`.
2020-04-10compilers: Move things out of clikeDylan Baker1-0/+3
One method belongs in the base Compiler class, the other belongs in the GnuLikeCompiler class.
2020-03-29compilers: disable ccache when using temporary source filesLoïc Yhuel1-0/+5
When doing a compile test with a testfile.c, ccache fails since the path is random. So it's better to disable it, to avoid reporting this as a cache miss.
2020-03-28Only split linker args with D compilers. Closes: #6845Jussi Pakkanen1-4/+8
2020-03-23Fix legacy env var support with crossJohn Ericson1-32/+30
Fix #3969
2020-03-19compilers: Link D runtime/libphobs dynamically on !WindowsDylan Baker1-1/+1
Fixes: #6786
2020-03-12Merge pull request #6356 from dcbaker/fix-d-compiler-abstractionsJussi Pakkanen1-0/+19
Fix d compiler abstractions
2020-03-11compilers: Don't put split soname args in start groupsDylan Baker1-0/+10
Some compilers that act as linker drivers (dmd and ldc) need to split arguments that GCC combines with , (ie, -Wl,-foo,bar -> -L=-foo -L=bar). As such we need to detect that the previous argument contained -soname, and not wrap that in a --start-group/--end-group This modifies the shared library test to demonstrate the problem, with a test case. Fixes #6359
2020-03-09Merge pull request #6532 from jon-turney/languages-native-kwargJussi Pakkanen1-0/+9
Add add_languages(native:)
2020-03-06compilers: Don't deduplicate -L= argumentsDylan Baker1-0/+9
This breaks LDC and DMD, so just don't do it.
2020-03-05mesonlib: Replace unholder argument to listifyDylan Baker1-0/+2
listify shouldn't be unholdering, it's a function to turn scalar values into lists, or flatten lists. Having a separate function is clearer, easier to understand, and can be run recursively if necessary.
2020-03-01meson: cache the results of can_compileMarcel Hollerbach1-0/+1
the check for which files can be compiled are called again and again on the same files over and over again. Caching this here shaves off 11s of the build time of efl (which has grown in the last 3 versions to over 40 sec. again)
2020-03-01CompilerArgs: make lookup fasterMarcel Hollerbach1-7/+26
in order to deduplicate arguments as much as possible, we need to check if a argument is already part of the list. Which is quite slow because we are checking 3 lists for that. In smaller projects this might be not of interested. However, in efl things are quite "heavy", alone generating the ninja file took 40 sec.. 16 sec. are spent in __iadd__ of CompilerArgs. What this patch does to speed this all up is: 1. We only check if a element is in post when we know that it must be in post same for pre. 2. the checks for if we already do contain a specific value are now done via a dict, and not via the list. This overall brings the time from 16 sec. spent in __iadd__ to 9 sec. in __iadd__. Another possible solution for all this is to have a internal structure of CompileArgs of trees, so you have the "basic" layer of arguments where the position does not matter. Additionally, you have two stacks of lists, the pre stack and the post stack, duplicates can then be checked when itereting, which would safe another ~4s in terms of efl. However, i do not have time for this undertaking right now.
2020-02-23Merge pull request #6637 from ↵Jussi Pakkanen1-0/+3
mesonbuild/nirbheek/implement-symbolextractor-windows Implement symbolextractor on windows + some cleanups/fixes
2020-02-22ninjabackend: List PDBs in output list for targetsNirbheek Chauhan1-0/+3
This is more correct, and forces the target(s) to be rebuilt if the PDB files are missing. Increases the minimum required Ninja to 1.7, which is available in Ubuntu 16.04 under backports. We can't do the same for import libraries, because it is impossible for us to know at configure time whether or not an import library will be generated for a given DLL.
2020-02-21Merge pull request #6668 from ↵Jussi Pakkanen1-1/+19
mesonbuild/nirbheek/strip-more-unused-linkerlike-args macOS: Remove more unused linkerlike args
2020-02-21macOS: Remove more unused linkerlike argsNirbheek Chauhan1-1/+19
`-L` and `-headerpad_max_install_names` are both linker arguments that are commonly passed in CFLAGS too. Closes https://github.com/mesonbuild/meson/issues/6294
2020-02-21compilers/compilers: Fix get_linker_idDylan Baker1-1/+7
Which could raise an AttributeError when used on languages like Java and C# that don't have separate compilers and linkers.
2020-02-12Improve error reported when language has no compilerJon Turney1-0/+9
This gives consistent reporting of this error for all platforms. Also, reporting this error when constructing the BuildTarget, rather than discovering the problem during backend generation means that the error is reported against with a location.
2020-01-24compilers: Derive CompilerArgs from collections instead of typingNirbheek Chauhan1-1/+1
Deriving from typing.MutableSequence does not give us a usable sequence type on Python 3.5.2.
2020-01-24typing: Fix compatibility with Python 3.5.2Nirbheek Chauhan1-1/+1
Explicitly use the type instead of the string 'NotImplemented' which still works with Python 3.5.2 Fixes https://github.com/mesonbuild/meson/issues/6427
2020-01-08types: Fix/ignore flake8 B014/F811Daniel Mensinger1-11/+11
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-69/+69