aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
AgeCommit message (Collapse)AuthorFilesLines
2021-02-09backends: Fix custom_target() with configure_file() exeXavier Claessens1-0/+3
2021-02-09backends: Always use the command returned by as_meson_exe_cmdline()Xavier Claessens1-4/+4
Even if the command is not wrapped by meson, it could have been modified to add java/mono interpreters. This fix potential inconsistency between wrapped and unwrapped commands.
2021-02-08Fix exe wrapper detection for run targets.Jussi Pakkanen1-1/+11
2021-02-07Merge pull request #8305 from xclaesse/run-target-envJussi Pakkanen1-23/+22
run_target: Add env kwarg
2021-02-05vala: Disable unity buildsDylan Baker1-1/+1
Our approach to unity builds with vala is broken, you cannot unify the generated C files, as they contain duplicate symbols. We would need to instead combine the files while they are still in their vala form, then convert that to C and compile the unified C file. This does not fix the linked issue, as this removed the ability to do vala unity builds, but it does allow running vala with `--unity=on`. Related: #5280
2021-02-05ninjabackend: Remove useless call to replace_paths()Xavier Claessens1-4/+4
Replacements are already done by eval_custom_target_command() and must be done BEFORE calling as_meson_exe_cmdline() anyway. replace_paths() is still used by generators. Make eval_custom_target_command() more readable by handling error in the final else case instead of in the middle of elif.
2021-02-05backend: Do not check for exe wrapper twiceXavier Claessens1-15/+2
It is already checked by as_meson_exe_cmdline().
2021-02-05run_target: Add env kwargXavier Claessens1-4/+16
Re-implement it in backend using the same code path as for custom_target(). This for example handle setting PATH on Windows when command is an executable.
2021-02-04xcode-backend: add implicit includesJeff Moguillansky1-0/+11
Move helper functions get_source_dir_include_args and get_build_dir_include_args to backend base class
2021-01-30add_install_script: add skip_if_destdir kwargXavier Claessens1-0/+1
It is common, at least in GNOME projects, to have scripts that must be run only in the final destination, to update system icon cache, etc. Skipping them from Meson ensures we can properly log that they have not been run instead of relying on such scripts to to it (they don't always).
2021-01-30Fix executable as script on WindowsXavier Claessens1-31/+38
On Windows this would fail because of missing DLL: ``` mylib = library(...) exe = executable(..., link_with: mylib) meson.add_install_script(exe) ``` The reason is on Windows we cannot rely on rpath to find libraries from build directory, they are searched in $PATH. We already have all that mechanism in place for custom_target() using ExecutableSerialisation class, so reuse it for install/dist/postconf scripts too. This has bonus side effect to also use exe_wrapper for those scripts. Fixes: #8187
2021-01-27custom_target: Add env kwargXavier Claessens1-5/+8
2021-01-21Unity build reverts to normal for fortran fixJonas Lundholm Bertelsen1-0/+8
The `determine_ext_objs` function did not take into account that fortran (and d) does not support unity builds. This caused failures in some cases.
2021-01-20When iterating link_targets, include link_whole_targets too (fortran)Jonas Lundholm Bertelsen1-1/+2
This fixes fortran includes and fortran orderdeps for libraries that were under link_whole_targets.
2021-01-17Removal of /ZI on MSVC DebugMarios Staikopoulos1-4/+5
The /ZI flag adds in "Edit and Continue" debug information, which will cause massive slowdown. It is not a flag that we should be adding by default to debug builds. /Zi will still be added.
2021-01-13backends/backends: Add type annotations for InstallDataDylan Baker1-27/+36
This adds enough type annotations for InstallData and friends to make minstall happy. There is also a small change in that I've replaced the List[List] with List[Tuple], as tuples are more appropraite data types for the information (fixed length, position matters, different types at different indexes)
2021-01-11use PEP8 style naming for LANGUAGES_USING_* as wellDylan Baker1-2/+2
2021-01-05mtest: Add support for rust unit testsDylan Baker1-0/+5
Rust has it's own built in unit test format, which is invoked by compiling a rust executable with the `--test` flag to rustc. The tests are then run by simply invoking that binary. They output a custom test format, which this patch adds parsing support for. This means that we can report each subtest in the junit we generate correctly, which should be helpful for orchestration systems like gitlab and jenkins which can parse junit XML.
2021-01-04Use a single coredata dictionary for optionsDylan Baker1-8/+8
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
2021-01-04use OptionKey for builtin and base optionsDylan Baker1-14/+15
I would have prefered to do these seperatately, but they are combined in some cases, so it was much easier to convert them together. this eliminates the builtins_per_machine dict, as it's duplicated with the OptionKey's machine parameter.
2021-01-04use OptionKey for compiler_optionsDylan Baker1-8/+7
2020-11-20use real pathlib moduleDylan Baker1-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
2020-10-18build: use PIE objects for static libraries if b_staticpic=false but b_pie=truePaolo Bonzini1-1/+1
If static_library is used as a convenience library (e.g. for link_whole) it should in principle not need position independent code. However, if the executables that the libraries is linked to are PIE, the non-PIC objects in the static library will cause linker errors. To avoid this, obey b_pie for static libraries if either b_staticpic=false or they use "pic: false". Without this patch, QEMU cannot use b_staticpic, which causes a slowdown on some QEMU benchmarks up to 20%.
2020-10-15intro: Add extra_files key to intro output (fixes #7310)Daniel Mensinger1-1/+1
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-2/+2
2020-09-29Merge pull request #7762 from jon-turney/meson-exe-output-improveJussi Pakkanen1-6/+25
Improve the output for meson wrapped commands
2020-09-29compilers/VS: fix build to use optimization and debug flagsVili Väinölä1-0/+4
- Fixed using debug and optimization built-in options in MSVC. - Fixed that VS backend does not create pdb files in release mode. VS implicitly adds the debug fields if left out. - Fix that it is possible to add debug info with ninja backend with optimizations.
2020-09-20Make meson_exe report pickled command when it failsJon Turney1-0/+1
Make 'meson --internal exe --unpickle' report the actual command executed when it fails, which is otherwise invisible.
2020-09-20Improve description of meson wrapped custom commandsJon Turney1-6/+24
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.
2020-09-17backends: Treat build target as generator only when it's the first argNirbheek Chauhan1-3/+5
Otherwise it might be an argument to a script that just inspects the binary itself.
2020-09-13Allow installing dir from build dirXavier Claessens1-1/+5
2020-09-11Revert "Do not automatically set warning flags if buildtype is 'plain'"Eli Schwartz1-1/+1
This reverts commit 8ee1c9a07a3a35e3ed262fbc358fd86c257a966e. No rationale was given for this change prior to merging. After the fact it was described as desired by distro packagers, however as a distro packager I believe this commit hurts me. From a distro packaging perspective, we primarily care about one thing: previously building code should still build. Hence, -Werror is bad for our use case. meson handles this via -D werror which is different from -D warning_level and as long as the former is disabled, warnings in the build do not cause harm (but may attract review attention for upstream to fix). buildtype is a completely unrelated concern, and the intention for =plain is to disable debug or optimization settings that result in codegen differences and thus different built artifacts. This must not happen in distro builds because the *distributed programs* should conform to policy settings. Unfortunately, completely disabling warnings happens silently, and cannot be overridden even if you really, really believe you know what you're doing. It is thematically broken, since use of add_project_arguments() to add more -W flags is not likewise ignored. But if you try to add -Wall in that manner, meson will lecture you to use warning_level which you cannot do. And if you have custom warning flags which depend on options enabled by judicious use of -Wall via default_options: 'warning_level=1', then you end up with generated warnings complaining about your command line rather than your code, such as: cc1: warning: ‘-Wformat-y2k’ ignored without ‘-Wformat’ [-Wformat-y2k] cc1: warning: ‘-Wformat-extra-args’ ignored without ‘-Wformat’ [-Wformat-extra-args] cc1: warning: ‘-Wformat-zero-length’ ignored without ‘-Wformat’ [-Wformat-zero-length] cc1: warning: ‘-Wformat-contains-nul’ ignored without ‘-Wformat’ [-Wformat-contains-nul] cc1: warning: ‘-Wformat-security’ ignored without ‘-Wformat’ [-Wformat-security] which then break the build with -Werror. Throughout all this, a buildtype of "plain" does *not* disable -D werror=true, which is the part where distro builds actually break down! Users who both wish to disable debug/optimization codegen, *and* disable warning commentary, are encouraged to do so by doing both, not by doing one and having the other be assumed. Fixes #7399
2020-09-10minstall: Add version field to install dataNirbheek Chauhan1-2/+4
And check the install data in the same way that mtest checks serialisation data. Fixes https://github.com/mesonbuild/meson/issues/2354
2020-09-10mtest: Check version in the test data after loadingNirbheek Chauhan1-3/+4
Same as coredata.dat and build.dat loading. Also, do not assert if things change. Raise the appropriate exception. Fixes https://github.com/mesonbuild/meson/issues/7613
2020-09-08typing: more fixesDaniel Mensinger1-7/+11
2020-09-06backends: check external rpaths for all languages using ldflagsJames Hilliard1-2/+2
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-09-04introspect: add test dependencies info to test/benchmark JSONPaolo Bonzini1-2/+10
Add the ids of any target that needs to be rebuilt before running the tests as computed by the backend, to the introspection data for tests and benchmarks. This also includes anything that appears on the test's command line. Without this information, IDEs must update the entire build before running any test. They can now instead selectively build the test executable itself and anything that is needed to run it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-08-31backends: do not look for extra paths unnecessarilyPaolo Bonzini1-7/+6
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>
2020-08-18Interpreter: Fix c_stdlib usageXavier Claessens1-1/+1
- 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.
2020-07-30Merge pull request #7494 from keszybz/fix-two-warningsJussi Pakkanen1-3/+3
Fix two warnings
2020-07-30backends: fix rpath match patternJames Hilliard1-2/+28
Since -Wl,-rpath= is not the only valid rpath ldflags syntax we need to try and match all valid rpath ldflags. In addition we should prevent -Wl,--just-symbols from being used to set rpath due to inconsistent compiler support. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-07-28Avoid warning about multiple outputs when building private directory nameZbigniew Jędrzejewski-Szmek1-3/+3
Fixup for b4b1a2c5a145c1459fc4563a289e164e23bd6a02. A warning would be printed for any rule with multiple outputs, for example: WARNING: custom_target 'coredump.conf.5' has more than one output! Using the first one. WARNING: custom_target 'dnssec-trust-anchors.d.5' has more than one output! Using the first one. WARNING: custom_target 'halt.8' has more than one output! Using the first one. Fixes https://github.com/systemd/systemd/issues/16461.
2020-06-22compilers: Return CompilerArgs from compiler instanceDylan Baker1-2/+1
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-1/+1
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-14windows: Canonicalize `:` in filenamesNirbheek Chauhan1-1/+7
Fixes https://github.com/mesonbuild/meson/issues/7265
2020-06-13Include the dep itself in extra_paths for WindowsJon Turney1-0/+1
This is needed in the case where a custom_target directly depends on a shared library, and somehow loads it. (Specifically this can be the case with gtkdoc, when it invokes gtkdoc-scangobj, which will build and run it's own code to load a shared library, to introspect it)
2020-06-13Handle multiple substitutions in eval_custom_target_command()Jon Turney1-29/+30
Handle command arguments which contain multiple substitutions correctly in Backend.eval_custom_target_command() In particular, gnome.gtkdoc() makes arguments of the form '--cflags -I@SOURCE_ROOT@ -I@BUILD_ROOT' (where these arguments are then passed down to a compiler invocation) Normally, these are subsequently made right by NinjaBackend.replace_paths(), but if Backend.as_meson_exe_cmdline() decides that the command needs to be pickled, that doesn't happen. (Although having two places where this substitution might happen smells really bad)
2020-06-05backend: There is no need for 'compiler-specific escaping' anymoreJon Turney1-23/+7
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.
2020-05-19Merge pull request #5986 from dcbaker/fix-tests-with-cross-binary-argumentsJussi Pakkanen1-2/+21
Fix tests with cross binary arguments
2020-05-19Build private directory name from output file name.Jussi Pakkanen1-1/+1