summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'upstream/master' into lang-enumlang-enumJohn Ericson2020-08-031-356/+38
|\
| * Fix native builds on Windows ARM64 machinesNirbheek Chauhan2020-07-131-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.
| * compilers: Return CompilerArgs from compiler instanceDylan Baker2020-06-221-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.
| * compilers: Split CompilerArgs into a separate moduleDylan Baker2020-06-221-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
| * compilers: Add missing annotations to CompilerArgs classDylan Baker2020-06-221-16/+14
| |
| * compilers: Use enum for for deupdlication returns in CompilerArgsDylan Baker2020-06-221-27/+36
| |
| * apple: -headerpad args are ignored when bitcode is enabledNirbheek Chauhan2020-06-111-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)
| * compilers: corretify deduplication directionMarcel Hollerbach2020-06-111-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.
| * compilers: Add UNIX large file support for MinGWSeungha Yang2020-06-091-3/+3
| | | | | | | | | | MinGW gcc supports _FILE_OFFSET_BITS=64 and we need to set it for MinGW as well
| * Merge pull request #7119 from marcelhollerbach/masterJussi Pakkanen2020-06-071-37/+68
| |\ | | | | | | Performance optimize ninja backend
| | * CompilerArgs: refactor __iadd__Marcel Hollerbach2020-06-051-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.
| | * Revert "CompilerArgs: make lookup faster"Marcel Hollerbach2020-06-051-26/+7
| | | | | | | | | | | | | | | | | | | | | This was a not so nice solution, and should be replaced with something better. This reverts commit 4524088d386d2e2315d8fef6ffedc11d8e9a394a.
| | * cache up regex mathingsMarcel Hollerbach2020-06-051-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.
| * | msvc: Avoid spurious openmp link warningsPeter Harris2020-06-061-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.
| * add type anno: compilers/clikeMichael Hirsch, Ph.D2020-05-271-3/+3
| |
| * Recognize Arduino .ino files as C++Phillip Johnston2020-05-271-1/+1
| | | | | | | | Renaming .ino files is not an option when working with the IDE. Meson should recognize it as C++ however.
| * compilers/d: Add b_ndebug supportDylan Baker2020-05-201-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
| * compilers: Move b_ndebug into the compiler classesDylan Baker2020-05-201-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.
| * Merge pull request #7103 from dankegel/bug4027-rpath-rememberJussi Pakkanen2020-05-181-1/+1
| |\ | | | | | | Let .pc files and LDFLAGS provide rpaths.
| | * Let .pc files specify rpath.Dan Kegel2020-05-161-1/+1
| | | | | | | | | | | | Fixes #4027
| * | macos: Remove framwork linkerlike argsEric Lemanissier2020-05-131-1/+1
| |/ | | | | | | fixes-up 33fbc548ab74e79280d2f57b2cd499d14c1f1e91
* | More progressJohn Ericson2020-04-211-1/+1
| |
* | WIP: Create enum to use instead of strings for languageJohn Ericson2020-04-211-33/+48
|/
* Compiler options per langJohn Ericson2020-04-201-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`.
* compilers: Move things out of clikeDylan Baker2020-04-101-0/+3
| | | | | One method belongs in the base Compiler class, the other belongs in the GnuLikeCompiler class.
* compilers: disable ccache when using temporary source filesLoïc Yhuel2020-03-291-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.
* Only split linker args with D compilers. Closes: #6845Jussi Pakkanen2020-03-281-4/+8
|
* Fix legacy env var support with crossJohn Ericson2020-03-231-32/+30
| | | | Fix #3969
* compilers: Link D runtime/libphobs dynamically on !WindowsDylan Baker2020-03-191-1/+1
| | | | Fixes: #6786
* Merge pull request #6356 from dcbaker/fix-d-compiler-abstractionsJussi Pakkanen2020-03-121-0/+19
|\ | | | | Fix d compiler abstractions
| * compilers: Don't put split soname args in start groupsDylan Baker2020-03-111-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
| * compilers: Don't deduplicate -L= argumentsDylan Baker2020-03-061-0/+9
| | | | | | | | This breaks LDC and DMD, so just don't do it.
* | Merge pull request #6532 from jon-turney/languages-native-kwargJussi Pakkanen2020-03-091-0/+9
|\ \ | | | | | | Add add_languages(native:)
| * | Improve error reported when language has no compilerJon Turney2020-02-121-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.
* | | mesonlib: Replace unholder argument to listifyDylan Baker2020-03-051-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.
* | meson: cache the results of can_compileMarcel Hollerbach2020-03-011-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)
* | CompilerArgs: make lookup fasterMarcel Hollerbach2020-03-011-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.
* | Merge pull request #6637 from ↵Jussi Pakkanen2020-02-231-0/+3
|\ \ | | | | | | | | | | | | mesonbuild/nirbheek/implement-symbolextractor-windows Implement symbolextractor on windows + some cleanups/fixes
| * | ninjabackend: List PDBs in output list for targetsNirbheek Chauhan2020-02-221-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.
* | Merge pull request #6668 from ↵Jussi Pakkanen2020-02-211-1/+19
|\ \ | | | | | | | | | | | | mesonbuild/nirbheek/strip-more-unused-linkerlike-args macOS: Remove more unused linkerlike args
| * | macOS: Remove more unused linkerlike argsnirbheek/strip-more-unused-linkerlike-argsNirbheek Chauhan2020-02-211-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
* | compilers/compilers: Fix get_linker_idDylan Baker2020-02-211-1/+7
|/ | | | | Which could raise an AttributeError when used on languages like Java and C# that don't have separate compilers and linkers.
* compilers: Derive CompilerArgs from collections instead of typingNirbheek Chauhan2020-01-241-1/+1
| | | | | Deriving from typing.MutableSequence does not give us a usable sequence type on Python 3.5.2.
* typing: Fix compatibility with Python 3.5.2Nirbheek Chauhan2020-01-241-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
* types: Fix/ignore flake8 B014/F811Daniel Mensinger2020-01-081-11/+11
|
* types: import typing as T (fixes #6333)Daniel Mensinger2020-01-081-69/+69
|
* add compiler.get_linker_id() methodMichael Hirsch, Ph.D2019-12-191-0/+3
| | | | | | | | | | | | | | | this can be useful for if/elif where linker behaviors must be considered. For example, clang with "link" vs gcc with "ld.bfd" etc. ci for compiler.get_linker_id() method doc add @FeatureNew check Co-Authored-By: Daniel Mensinger <daniel@mensinger-ka.de>
* Consider compiler arguments in linker detection logicDylan Baker2019-12-121-2/+4
| | | | | | | | | | | | | If a user passes -fuse-ld=gold to gcc or clang, they expect that they'll get ld.gold, not whatever the default is. Meson currently doesn't do that, because it doesn't pass these arguments to the linker detection logic. This patch fixes that. Another case that this is needed is with clang's --target option This is a bad solution, honestly, and it would be better to use $LD or a cross/native file but this is needed for backwards compatability. Fixes #6057
* Allow setting <lang>_args before the compiler is detectedDylan Baker2019-12-121-97/+82
| | | | | This is required to be able to pass compiler and linker arguments to the methods that try to guess what linker to use.
* compilers: Make get_display_language a class or static methodDylan Baker2019-12-121-2/+3
| | | | | | | | Currently this is done at the instance level, but we need it at the class level to allow compiler "lang" args to be gotten early enough. This patch also removes a couple of instance of branch/leaf classes providing their own implementation that is identical to the Compiler version.