aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend
AgeCommit message (Collapse)AuthorFilesLines
2022-11-17backend/ninja: replace ` ` with `_` in rust crate-namesDylan Baker1-2/+2
Because spaces aren't allowed and result in compilation failures
2022-11-10Fix options overrides for vsbackendDenis Fortin1-1/+1
Use OptionOverrideProxy instead of pure options. Closes #10393
2022-11-02backends: Try guessing install tag for all installed filesXavier Claessens1-3/+11
It was only trying to guess install tag, and log missing tags, for files installed by install_data(). Do it also for all other files, especially custom_taget() that commonly installs generated headers.
2022-10-31Revert "backends/ninja: run `ranlib -c $out` when using the apple ar"Eli Schwartz1-13/+2
This reverts commit bdc6f243e9f95246b5801d2c0ccf64173fb280f3. This is part of #10628 and needs to be reverted, as it breaks other things. See https://github.com/mesonbuild/meson/pull/10628#issuecomment-1230560772
2022-10-24Not all compilers support depfileXavier Claessens1-1/+2
2022-10-23vs backend: Add support for CompileTargetXavier Claessens2-0/+46
Since vs backend only support the C compiler, everything else are custom targets. Convert CompileTarget into a Generator to reuse existing code. This will be useful in the future to support transpilers, and assemblers.
2022-10-23Add cc.preprocess() method for c-like compilersXavier Claessens2-0/+5
This introduce a new type of BuildTarget: CompileTarget. From ninja backend POV it is the same thing as any other build target, except that it skips the final link step. It could be used in the future for transpilers too.
2022-10-23Compilers: Add a preprocessor mode for clike compilersXavier Claessens1-1/+3
A compiler object can now return a list of "modes", they are new compiler object specialized for a specific task.
2022-10-18ninja: Simplify getting rule name from compiler objectXavier Claessens1-17/+11
2022-10-13fix: don't set FavorSizeOrSpeed in vs backend if optimization disabled (/Od ↔Luke Elliott1-1/+2
set). Debugging is broken with clang-cl when FavorSizeOrSpeed is set.
2022-10-13Add b_thinlto_cache for automatically configuring incremental ThinLTOTatsuyuki Ishi1-1/+2
2022-10-09run wrapped-due-to-env commands on unix via the env programEli Schwartz1-1/+18
First, check if the env program exists. If it does, it is faster than doing it via a python script `basically-env.py` that maybe imports all of mesonbuild.* as a side effect of project structure. We do not, however, use env for setting up PATH additions, since env can override an environment variable but not extend it. So in that case we still need to wrap the command via python. By default, all run_targets (at least) are wrapped and now wrap via the `env` program as they export e.g. MESONINTROSPECT='/usr/bin/meson introspect'
2022-10-09compilers: Add optimization=plain optionJan Tojnar1-2/+5
https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
2022-10-04pylint: enable consider-merging-isinstanceDylan Baker1-1/+1
2022-10-03pylint: enable unnecessary-lambdaDylan Baker1-1/+1
2022-09-29Add cross-compile support for Microsoft GDK platformsCaleb Cornett1-2/+9
2022-09-28Move classes used by scripts to their own moduleXavier Claessens1-22/+2
Those classes are used by wrapper scripts and we should not have to import the rest of mesonlib, build.py, and all their dependencies for that. This renames mesonlib/ directory to utils/ and add a mesonlib.py module that imports everything from utils/ to not have to change `import mesonlib` everywhere. It allows to import utils.core without importing the rest of mesonlib.
2022-09-28Automatically tag systemtap filesXavier Claessens1-0/+2
2022-09-28Automaticall tag installed testsXavier Claessens1-0/+2
It is common, at least in GNOME projects, to install tests. Files goes into various locations, including: - /usr/lib/x86_64-linux-gnu/installed-tests - /usr/share/installed-tests - /usr/libexec/installed-tests It is safe to assume that everything that goes into a "installed-tests" subdir should be tagged as "tests" by default.
2022-09-27compilers: Cleanup a bit languages/suffixes listsXavier Claessens3-4/+4
Use set where order does not matter, fix is_source() to really mean only source suffixes.
2022-09-26ninjabackend: Fix get_target_generated_sources() return typeXavier Claessens1-10/+7
Type annotation, documentation string, and implementation were doing 3 different things. Change implementation to match type annotation which makes the most sense because it match what get_target_sources() does. All callers only use keys from the returned dictionary any way, but that's going to change in next commits.
2022-09-20Fix including headers from another drive on VS backendVili VÀinölÀ1-2/+6
Include paths to different drives as absolute paths fixes #8329
2022-09-19pylint: enable consider-using-inDylan Baker3-6/+6
2022-09-19pylint: enable use-maxsplit-argDylan Baker1-1/+1
This finds a bunch of places where we can do more efficient string splitting.
2022-09-19pylint: enable consider-using-dict-itemsDylan Baker1-5/+4
Which found a couple of places where we could write better code.
2022-09-19compilers: perform targeted imports for detectEli Schwartz1-1/+1
Only import the ones we need for the language we are detecting, once we actually detect that language. This will allow finally dropping the main imports of these files in a followup commit.
2022-09-19compilers: don't use instance checks to determine propertiesEli Schwartz1-16/+12
In various situations we want to figure out what type of compiler we have, because we want to know stuff like "is it the pgi one", or "does it use msvc style". The compiler object has this property already, via an API specifically designed to communicate this info, but instead we performed isinstance checks on a compiler class. This is confusing and indirect, and has the side effect of requiring more imports everywhere. We should do away with it.
2022-09-12rust: Generate a rust-project.json file when rust targets are presentDylan Baker1-1/+111
When at least one Rust target is present, we now generate a rust-project.json file, which can be consumed by rust-analyzer. This is placed in the build directory, and the editor must be configured to look for this (as it is not a default search path).
2022-09-11backends: limit maximum path of generated filenamesEli Schwartz1-1/+9
When calculating the output filename for a compiled object, we sanitize the whole input path, more or less. In cases where the input path is very long, this can overflow the max length of an individual filename component. At the same time, we do want unique names so people can recognize what these outputs actually are. Compromise: - for filepaths with >5 components (which are a lot more likely to cause problems, and simultanously less likely to have crucial information that far back in the filepath) - if an sha1 hash of the full path, replacing all *but* those last 5 components, produces a path that is *shorter* than the original path ... then use that modified path canonicalization via a hash. Due to the use of hashes, it's unique enough to guarantee correct builds. Because we keep the last 5 components intact, it's easy to tell what the output file is compiled from. Fixes building in ecosystems such as spack, where the build environment is a very long path containing repetitions of `__spack_path_placeholder__/` for... reasons of making the path long.
2022-09-09vs: Fix CustomBuild contents.Andres Freund1-9/+9
%% survived into the output since 038b31e72bc02f0a9b. That failed to fail, at least in the common cases, because the whole command sequence is unnecessary / redundant - it appears to come from cmake, which executes multiple commands within a single CustomBuild element.
2022-09-06Fix install_subdirs not showing up in intro-install_plan.jsonThomas Li1-1/+3
2022-09-02backend/ninja: omit --backend when regenerating build dirKonstantin Kharlamov1-3/+1
Currently a cosmetic bug is present: once a build dir was regenerated, meson would start showing: User defined options backend: ninja This is not true as user have not defined the option, it is default. Fix this by omitting the `--backend ninja` parameter from "regenerate" In my tests this does not affect the situation when one specifies `--backend ninja` explicitly, it still shows the backend as user-defined after reconfiguration. Fixes: https://github.com/mesonbuild/meson/issues/10632
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge1-1/+1
2022-08-24backend/ninja: properly track objects extracted from fortran sourcesDylan Baker3-17/+41
We need this to ensure that .mod files are created before we start compiling, and to ensure that the proper include directory arguments are generated.
2022-08-22introspection: untangle install_plan implemetation, fix a bunch of wrong onesEli Schwartz1-10/+12
Generally plumb through the values of get_option() passed to install_dir, and use this to establish the install plan name. Fixes several odd cases, such as: - {datadir} being prepended to "share" or "include" - dissociating custom install directories and writing them out as {prefix}/share/foo or {prefix}/lib/python3.10/site-packages This is the second half of #9478 Fixes #10601
2022-08-18build: Add a Union alias for all build targetsDylan Baker1-1/+1
2022-07-25backends/ninja: run `ranlib -c $out` when using the apple arDylan Baker1-2/+13
Apple's AR is old, and doesn't add externed symbols to the symbol table, instead relying on the user calling ranlib with -c. We need to do that for the user
2022-07-25ninja depscanner: handle C++ sources named capital CEli Schwartz1-2/+6
In commit 4ca9a16288f51cce99624a2ef595d879acdc02d8 we added unreliable support (it warns you if you try it) for gcc-compatible treatment of uppercase-C files being C++ instead of C. In order to handle it correctly, we needed to evaluate can-compile by special-casing "C" to avoid lowercasing it for comparisons. This didn't cover all cases where we check if "C" is a C++ language file. We also straight-up check the language of a file (rather than working backwards to see if a C++ compiler can compile it) when doing module scanning, and this needs to special-case "C" as well. We also had one case where we only checked lowercase fortran extensions, but not lowercase C++ extensions. While we are at it, use lowercase for C++ as well, except the "C" special case. Fixes #10629
2022-07-21ar linker: detect the "osx ld" case (where generating thin archives won't ↔Justin Blanchard1-1/+1
work) based on host OS, not build OS.
2022-07-16Fix finding of Visual studio path in mingw64Ty1-2/+2
Ninja backend will fail to find the vs dep dependency prefix string in a mingw64 environment. This change simply updates the regex to be able to capture mingw64's unique file separation pattern.
2022-07-15backends: Remove /Zi arg if requested to use /Z7Christian Wendt1-5/+5
Change the order of testing flags and get_external_args() to handle flags set by get_external_args() correctly.
2022-06-26add missing lower() to fix msvc backend platform detectionTad Young1-1/+1
Regardless of which MachineChoice we base the platform on, we compare its value to lowercased identifiers. So we need to lowercase the targetplatform too... but we only did so sometimes. This broke e.g. on "Win32", but only when *not* doing a cross build. Fixes #10539
2022-06-19Merge pull request #10464 from rtbo/fix_generated_depsJussi Pakkanen1-2/+9
add D generated files to order-only deps
2022-06-17fix parameter expansion in several error messagesMichael Mera1-3/+3
At several points in the code base, f-strings are not correctly expanded due to missing 'f' string prefix. This fixes all the occurrences I could find.
2022-06-14backend: always use the same code to compute the files in ExtractedObjectsPaolo Bonzini2-11/+8
Instead of asking the ExtractedObjects, but with a hook back into the backend, use the existing function in the backend itself. This fixes using the extract_objects(...) of a generated source file in a custom_target. It should also fix recursive extract_all_objects with the Xcode backend. Fixes: #10394
2022-06-14take override_option('unity=...') into account when allowing extract_objects()Paolo Bonzini3-8/+4
A single target could be picked for unity build, and in that case extract_objects() should not be allowed. Likewise for the opposite case, where extract_objects() should be allowed if unity build is disabled for a single target. A test that covers that case is added later.
2022-06-13ninja backend: generate additional meta-rules for test/benchmarks targetsEli Schwartz3-12/+24
'meson-test-prereq' now depends on any targets that were formerly added directly to 'all'. Behavior is not changed -- the all target still depends on this other meta-rule, and thus indirectly depends on all targets it used to depend on. It is now possible to build just the targets needed for the testsuite and then e.g. run `meson test --no-rebuild`.
2022-06-13flake8: fix various whitespace nitsEli Schwartz1-3/+3
2022-06-10treewide: various cleanups to move imports for mypy into typechecking blocksEli Schwartz9-21/+44
Along the way, add __future__ annotations where lacking.
2022-06-10flake8: remove import that was never usedEli Schwartz1-1/+0
Introduced via commit 0d0a4fa0fe02ca8297743a5a8e64ee72060cc990, probably in the course of heavy rebasing.