summaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
Commit message (Collapse)AuthorAgeFilesLines
* Add mypy annotations.cppmodulesJussi Pakkanen2020-12-131-1/+1
|
* Scan all C++ sources and ignore everything else.Jussi Pakkanen2020-12-131-5/+33
|
* C++ module compilation works for a simple project.Jussi Pakkanen2020-12-131-5/+21
|
* Generate dependency scanning hooks in the Ninja file.Jussi Pakkanen2020-12-121-9/+45
|
* Generate scanning rules for C++ modules.Jussi Pakkanen2020-12-111-0/+24
|
* Add prelinking support for static libraries.Jussi Pakkanen2020-12-031-1/+20
|
* Bump Ninja requirement to 1.8.Jussi Pakkanen2020-11-261-2/+2
|
* use real pathlib moduleDylan Baker2020-11-201-1/+1
| | | | | We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
* ninjabackend: stabilize order of dependencies and order-only dependenciesPaolo Bonzini2020-11-151-2/+2
| | | | | | | | | | | These do not go into the command line, and therefore do not matter for the purpose of avoiding unnecessary rebuilds after meson is rerun. However, they complicate the task of finding differences between build lines across meson reruns. So take the easy way out and sort everything after | and ||. With this change, there is absolutely no change in QEMU's 40000-line build.ninja file after meson is rerun.
* ninjabackend: Fix a couple of rust bugsDylan Baker2020-11-131-2/+3
| | | | | | There are two bugs here, first is that we open coded the output args, instead of using the compiler method. The second is that rust args are not passed down to the backend invocation.
* ninjabackend: fix matching of empty stringsAlexander Neumann2020-11-131-1/+1
| | | closes #7977
* ninjabackend: apply base compile_args to rust targetsDylan Baker2020-11-101-2/+5
|
* rust: implement support for --editionDylan Baker2020-11-051-0/+3
| | | | | | | | | Using the std option, so now `rust_std=..` will work. I've chosen to use "std" even though rust calls these "editions", as meson refers to language versions as "standards", which makes meson feel more uniform, and be less surprising. Fixes: #5100
* Add win_subsystem kwarg. Closes #7765.Jussi Pakkanen2020-10-071-1/+4
|
* pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger2020-10-041-1/+1
|
* compilers/swift: Add type annotationsDylan Baker2020-10-011-2/+2
|
* Merge pull request #7762 from jon-turney/meson-exe-output-improveJussi Pakkanen2020-09-291-11/+16
|\ | | | | Improve the output for meson wrapped commands
| * Improve description of meson wrapped custom commandsJon Turney2020-09-201-11/+16
| | | | | | | | | | | | I've always found ninja reporting 'a meson_exe.py custom command' unclear and confusing. Instead say we are invoking a custom command, wrapped by meson, and why.
* | compilers/mixins/clike: fix mypy issuesDylan Baker2020-09-241-2/+5
|/
* pylint: Catch cases of `if len(container)` which should be replaced by `if ↵Dylan Baker2020-09-181-1/+1
| | | | | | | container` Unfortunately this doesn't catch other abuses of len(continauer) like, `len(container) <comparator> 0`, see: https://github.com/PyCQA/pylint/issues/3751
* Support identifying msvc dependency prefix with a path starting with a backslashMartin Storsjö2020-09-181-2/+7
|
* backends: Treat build target as generator only when it's the first argNirbheek Chauhan2020-09-171-1/+1
| | | | | Otherwise it might be an argument to a script that just inspects the binary itself.
* minstall: Add version field to install dataNirbheek Chauhan2020-09-101-6/+0
| | | | | | | And check the install data in the same way that mtest checks serialisation data. Fixes https://github.com/mesonbuild/meson/issues/2354
* ninja: Generate all STATIC_LINKER rulesJon Turney2020-09-101-2/+5
| | | | | | | | | Don't stop generating STATIC_LINKER rules at the first MachineChoice which isn't available (i.e. generate a STATIC_LINKER rule, even if STATIC_LINKER_FOR_BUILD isn't needed) Also warn about internal errors which lead to non-existent rule references, rather than exploding with a KeyError.
* typing: more fixesDaniel Mensinger2020-09-081-1/+1
|
* Merge pull request #7689 from scivision/fortran_incJussi Pakkanen2020-09-061-20/+22
|\ | | | | correct Fortran include algorithm
| * fortran: make include scanning also work for CMake subprojectsMichael Hirsch2020-09-021-20/+22
| | | | | | | | | | | | | | also fixed PEP8 I originally implemented the "include" scanning, but hadn't made a test for this case
* | environment: use ExternalProgram to find ninjaPaolo Bonzini2020-09-041-2/+2
|/ | | | | | | | | | | This allows the NINJA environment variable to support all the Windows special cases, especially allowing an absolute path without extension. Based on a patch by Yonggang Luo. Fixes: #7659 Suggested-by: Nirbheek Chauhan <nirbheek@centricular.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* backends: do not look for extra paths unnecessarilyPaolo Bonzini2020-08-311-1/+0
| | | | | | | | | | | | | extra_paths only matter for the host machine if using an exe_wrapper. However, because CustomTarget.for_machine is always MachineChoice.HOST, they were computed unnecessarily in as_meson_exe_cmdline. Defer computation of extra_paths until after we have found out if the custom target executable is really for the host or the build machine, so that we can use exe_for_machine; for_machine then becomes unused and can be removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Merge pull request #7607 from bonzini/speedupJussi Pakkanen2020-08-221-18/+23
|\ | | | | Various speedups from profiling QEMU's meson.build
| * ninjabackend: avoid lambdasPaolo Bonzini2020-08-181-3/+2
| | | | | | | | | | | | | | | | | | The lambda in NinjaBuildElement.write is quite expensive, totalling 0.3s just to do a couple function calls. Since it is used just once, simply inline it. On a QEMU build, the total time spent in write from this series goes from 5.321s to 3.238s, though part of it can be attributed to previous patches.
| * ninjabackend: optimize length_estimatePaolo Bonzini2020-08-181-10/+12
| | | | | | | | | | | | | | | | | | | | | | Optimize the regular expression so that the variable expansion part always ends up in group 1, and the trailer after the variable is discarded in the same match. Do not use re.sub to remove braces, and do not bother building the expanded command, just adjust the estimated length on the fly. functools.reduce is extremely slow, so I am keeping ' '.join(chunk). On a QEMU build the time spend in the function goes from 1.072s to 0.757s.
| * ninjabackend: optimize ninja_quotePaolo Bonzini2020-08-181-5/+9
| | | | | | | | | | | | Use regular expressions to quickly weed out strings that require quoting On a QEMU build the time spent in ninja_quote goes from 1.978s to 1.281s, with str.replace being kicked completely out of the profile.
* | Interpreter: Fix c_stdlib usageXavier Claessens2020-08-181-15/+10
|/ | | | | | | - Exceptions raised during subproject setup were ignored. - Allow c_stdlib in native file, was already half supported. - Eliminate usage of subproject variable name by overriding '<lang>_stdlib' dependency name.
* ninjabackend: Fix coverage rule generationNirbheek Chauhan2020-08-151-1/+1
| | | | | | | | | | Without the parenthesis, the command evaluates to `[]` if `use_llvm_cov` is `False`. Also fix tests to actually check whether or not coverage reports are generated. Fixes https://github.com/mesonbuild/meson/issues/7553
* ninjabackend: check if target has compiler attributeMarcel Hollerbach2020-07-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | otherwise we are getting errors like: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mesonbuild/mesonmain.py", line 131, in run return options.run_func(options) File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 245, in run app.generate() File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 215, in _generate intr.backend.generate() File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 518, in generate self.generate_coverage_rules() File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 991, in generate_coverage_rules self.generate_coverage_command(e, []) File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 975, in generate_coverage_command for compiler in target.compilers.values(): AttributeError: 'RunTarget' object has no attribute 'compilers' This extends the 109 generatecode test case to also define a test, so coverage can really detect something.
* Don't spam about usage of rspfiles to stdoutNirbheek Chauhan2020-07-221-1/+1
| | | | | Put it in the log file if necessary. Users don't need to know this. It's very spammy.
* Fix a comment about cross compilation with clang-cl [skip ci]Martin Storsjö2020-07-191-1/+1
| | | | | This comment was added in 0fbd09609f4, where the case of a forward slash was added for the case when cross compiling.
* Enable target override_options for llvm-irNirbheek Chauhan2020-07-131-2/+2
| | | | This was missed somehow when the feature was added a few years ago.
* compilers: Return CompilerArgs from compiler instanceDylan Baker2020-06-221-5/+5
| | | | | | | 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-1/+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
* coverage: llvm-cov supportCary Converse2020-06-171-1/+9
|
* windows: Canonicalize `:` in filenamesNirbheek Chauhan2020-06-141-1/+1
| | | | Fixes https://github.com/mesonbuild/meson/issues/7265
* Merge pull request #7245 from dankegel/response-files-when-needed-tidiedJussi Pakkanen2020-06-081-86/+270
|\ | | | | Make ninja backend only use response files when needed, on linux too
| * ninja: response file threshold now more accurate, overridable, portable.Dan Kegel2020-06-051-2/+20
| |
| * ninja: Add ninja variable DEPFILE_UNQUOTED with unquoted DEPFILE valueJon Turney2020-06-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's assumed that where we use DEPFILE in command or rspfile_content, it can be quoted by quoting the ninja variable (e.g. $DEPFILE -> '$DEPFILE') This is nearly always true, but not for gcc response files, where backslash is always an escape, even inside single quotes. So this fails if the value of DEPFILE contains backslashes (e.g. a Windows path) Do some special casing, adding DEPFILE_UNQUOTED, so that the value of depfile is not shell quoted (so ninja can use it to locate the depfile to read), but the value of DEPFILE used in command or rspfile_content is shell/response file quoted) (It would seem this also exists as a more general problem with built-in ninja variables: '$out' appearing in command is fine, unless one of the output filenames contains a single quote. Although forbidding shell metacharacters in filenames seems a reasonable way to solve that.) (How does this even work, currently? Backslashes in the value of all ninja variables, including DEPFILE were escaped, which protected them against being treated as escapes in the gcc response file. And fortunately, the empty path elements indicated by a double backslash in the value of depfile are ignored when ninja opens that file to read it.)
| * ninja: Specifically implement gcc rspfile style quotingJon Turney2020-06-051-8/+18
| | | | | | | | | | | | | | This differs from sh-quoting in that a backslash *always* escapes the following character, even inside single quotes. Yes, really. https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libiberty/argv.c#l176
| * backend: There is no need for 'compiler-specific escaping' anymoreJon Turney2020-06-051-1/+0
| | | | | | | | | | | | | | | | | | | | Now that all command-line escaping for ninja is dealt with in the ninja backend, escape_extra_args() shouldn't need to do anything. But tests of existing behaviour rely on all backslashes in defines being C escaped: This means that Windows-style paths including backslashes can be safely used, but makes it impossible to have a define containing a C escape.
| * ninja: Implement Windows-style command line quotingJon Turney2020-06-051-4/+11
| | | | | | | | | | | | | | | | | | We avoided having to get this right previously, as we'd always use a response file if possible. But this is so insane, I can't imagine it's right. See also: subprocess.list2cmdline() internal method
| * ninja: Quoting in rspfile depends on the compiler, not the shellJon Turney2020-06-051-17/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In certain exotic configurations, the style of quoting expected in the response file may not match that expected by the shell. e.g. under MSYS2, ninja invokes commands via CreateProcess (which results in cmd-style quoting processed by parse_cmdline or CommandLineToArgvW), but gcc will use sh-style quoting in any response file it reads. Future work: The rspfile quoting style should be a method of the compiler or linker object, rather than hardcoded in ninjabackend. (In fact, can_linker_accept_rsp() should be extended to do this, since if we can accept rsp, we should know the quoting style)