aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)AuthorFilesLines
2021-03-05Port CUDA module to new API.Olexa Bilaniuk1-11/+23
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz14-81/+81
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz5-8/+8
All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
2021-03-04Simplify module APIXavier Claessens4-16/+54
- ModuleState is now a real class that will have methods in the future for actions modules needs, instead of using interpreter internal API. - New ModuleObject base class, similar to InterpreterObject, that should be used by all objects returned by modules. Its methods gets the ModuleState passed as first argument. It has a `methods` dictionary to define what is public API that can be called from build definition. - Method return value is not required to be a ModuleReturnValue any more, it can be any type that interpreter can holderify, including ModuleObject. - Legacy module API is maintained until we port all modules. In the future modules should be updated: - Use methods dict. - Remove snippets. - Custom objects returned by modules should all be subclass of ModuleObject to get the state iface in their methods. - Modules should never call into interpreter directly and instead state object should have wrapper API. - Stop using ModuleReturnValue in methods that just return simple objects like strings. Possibly remove ModuleReturnValue completely since all objects that needs to be processed by interpreter (e.g. CustomTarget) should be created through ModuleState API.
2021-03-03pkgconfig: Add missing permitted kwargsXavier Claessens1-1/+1
Fixes #8462
2021-03-02exernal_project: Fix default cross compile parametersLeif Middelschulte1-1/+1
The variable `{host}` cannot be successfully expanded. Using the `@HOST@` parameter, as suggested by the documentation, works.
2021-02-27install_man locale supportJason Woodward1-1/+4
Rather than having to manually build the locale aware man paths with `install_data('foo.fr.1', install_dir: join_paths(get_option('mandir'), 'fr', 'man1'), rename: 'foo.1')` Support doing `install_man('foo.fr.1', locale: 'fr')`
2021-02-26modules/fs: Use typed_pos_argsDylan Baker1-75/+40
2021-02-22minstall: Add --skip-subprojects optionXavier Claessens4-7/+8
By default all subprojects are installed. If --skip-subprojects is given with no value only the main project is installed. If --skip-subprojects is given with a value, it should be a coma separated list of subprojects to skip and all others will be installed. Fixes: #2550.
2021-02-16CUDA Toolkit 11.2.1 has been released, update version tableOlexa Bilaniuk1-1/+2
Strangely, the minimum version of CUDA Toolkit 11.2.0 has also been updated - downwards. We pick up this change as well.
2021-02-07Add Qt6 moduleLuca Weiss2-2/+28
2021-02-07Merge pull request #8162 from dcbaker/wip/2021-01/rust-module-bindgenJussi Pakkanen1-3/+77
Add a wrapper to the rust module for bindgen
2021-02-07Merge pull request #8305 from xclaesse/run-target-envJussi Pakkanen2-7/+7
run_target: Add env kwarg
2021-02-06rust: Add a module wrapper for bindgenDylan Baker1-3/+77
This has a couple of advantages over rolling it by hand: 1. it correctly handles include_directories objects, which is always handy 2. it correctly generates a depfile for you, which makes it more reliable 3. it requires less typing
2021-02-06modules/rust: use typed_pos_argsDylan Baker1-10/+5
2021-02-05run_target: Add env kwargXavier Claessens2-7/+7
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-05gnome: Add post_install() methodXavier Claessens1-18/+67
Various GNOME projects have scripts that does similar task, better do it directly in meson. This ensures it's done correctly regarding usage of subprojects and pkg-config. See for example this gtk bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/3626. Fixes: #8268
2021-02-04Introduce `fs.read` to read a file as a stringLuke Drummond1-1/+64
Following #7890, this patch introduces the ability to read the contents of a file to the fs module. This patch introduces the ability to read files at configure time, but has some restrictions: - binary files are not supported (I don't think this will prove a problem, and if people are wanting to do something with binary files, they should probably be shelling out to their own script). - Only files outside the build directory allowed. This limitation should prevent build loops. Given that reading an arbitrary file at configure time can affect the configuration in almost arbitrary ways, meson should force a reconfigure when the given file changes. This is non-configurable, but this can easily be changed with a future keyword argument.
2021-02-02Quick update of table of CUDA Toolkit vs. NVIDIA driver versions.Olexa Bilaniuk1-0/+2
2021-01-30Merge pull request #8264 from xclaesse/ep-miscJussi Pakkanen1-14/+19
external_project: misc improvements
2021-01-30Fix executable as script on WindowsXavier Claessens3-9/+4
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-29external_project: Add default configure optionsXavier Claessens1-12/+12
2021-01-29external_project: Do not set LD in the envXavier Claessens1-1/+4
This was breaking some autotools projects such as libyaml.
2021-01-29external_project: Improve loggingXavier Claessens1-1/+3
Write output of 'make' and 'make install' into log files as well when not verbose.
2021-01-20external_project: Log configure commandXavier Claessens1-0/+4
2021-01-19Replace NinjaBackend is_rust_target with build.uses_rustDylan Baker1-1/+1
we have two functions to do the exact same thing, and they're basically implemented the same way. Instead, let's just use the BuildTarget one, as it's more generally available.
2021-01-17external_project: Write output in log files when not verboseXavier Claessens1-2/+7
2021-01-14Merge pull request #8192 from dcbaker/submit/minstall-type-annotationsJussi Pakkanen4-13/+13
Add type annotations to minstall (and some related cleanups)
2021-01-13build/interpreter: Split InstallDir to fix layering violationDylan Baker1-9/+9
Currently InstallDir is part of the interpreter, and is an Interpreter object, which is then put in the Build object. This is a layering violation, the interperter should have a Holder for build data. This patch fixes that.
2021-01-13build/interperter: Add annotations and move input validation to interpreterDylan Baker3-4/+4
This moves the user input validation to the interpreter, instead of being in the build module, and adds type annotations.
2021-01-13Fix misspellsAntonin Décimo3-4/+4
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-11rename cflags_mapping to CFLAGS_MAPPINGDylan Baker1-4/+4
This is PEP8 convention for a const variable. Also, make the type Mapping, which doesn't have mutation methods. This means mypy will warn us if someone tries to change this.
2021-01-05modules: Add an unstable-rust moduleDylan Baker1-0/+137
Like other language specific modules this module is module for holding rust specific helpers. This commit adds a test() function, which simplifies using rust's internal unittest mechanism. Rust tests are generally placed in the same code files as they are testing, in contrast to languages like C/C++ and python which generally place the tests in separate translation units. For meson this is somewhat problematic from a repetition point of view, as the only changes are generally adding --test, and possibly some dependencies. The rustmod.test() method provides a mechanism to remove the repatition: it takes a rust target, copies it, and then addes the `--test` option, then creates a Test() target with the `rust` protocol. You can pass additional dependencies via the `dependencies` keyword. This all makes for a nice, DRY, test definition.
2021-01-04Use a single coredata dictionary for optionsDylan Baker7-20/+21
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-5/+9
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.
2020-11-20use real pathlib moduleDylan Baker4-4/+4
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-11-18Merge pull request #7894 from obilaniu/cudaupdatesJussi Pakkanen1-41/+105
Update unstable CUDA Module to support newest toolkits and drivers.
2020-11-18Merge pull request #7900 from bonzini/stabilize-hashJussi Pakkanen1-2/+2
Avoid build.ninja changes due to order of hash table iteration
2020-11-17gnome: Drop use of volatile in GLib type functionsPhilip Withnall1-1/+1
See https://gitlab.gnome.org/GNOME/glib/-/issues/600 `volatile` was previously mistakenly used in GLib to indicate that a variable was accessed atomically or otherwise multi-threaded. It’s not meant for that, and up to date compilers (like gcc-11) will rightly warn about it. Drop the `volatile` qualifiers. Based on a patch by Jeff Law. See also http://isvolatileusefulwiththreads.in/c/. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-15stabilize sets that are converted to listsPaolo Bonzini1-2/+2
The order of elements in sets cannot be relied upon, because the hash values are randomized by Python. Whenever sets are converted to lists we need to keep their order stable, or random changes in the command line cause ninja to rebuild a lot of files unnecessarily. To stabilize them, use either sort or OrderedSet. Sorting is not always applicable, but it can be faster because it's done in C and it can produce slightly nicer output.
2020-11-13gnome: Handle libraries that are not in the current build dirSam Thursfield1-5/+6
The generate_gir() function previously assumed all library inputs were in the current build dir. This would fail if they weren't.
2020-11-05Update CUDA module's nvcc_arch_flags() and nvcc_arch_readable() for newOlexa Bilaniuk1-35/+96
CUDA Toolkits. Also harden internal logic and add several asserts in the testcase.
2020-11-05Add newer CUDA Toolkit version entries.Olexa Bilaniuk1-6/+9
Also, remove the possibility of passing in a compiler instance to min_driver_version. This is because the NVCC compiler instance is, as of CUDA Toolkit 11.0, no longer guaranteed to be versioned identically to the toolkit itself.
2020-11-04pkgconfig: Make external deps of static library publicXavier Claessens1-3/+6
This fix a regression caused by https://github.com/mesonbuild/meson/pull/7837, it wanted to make InternalDependency's external_deps private but has side effect of making StatisLibrary's external_deps private too. It is technically correct to make them private, but Meson used to make StaticLibrary deps public so they are usable without `pkg-config --static` when we know there is only a static library available. Fixes: #7929.
2020-11-04qt module: fix error message typo, translation qresource accepts qm not tsEli Schwartz1-1/+1
Fixes #7925
2020-11-01gnome: Tweak error messageSam Thursfield1-1/+2
It's an easy mistake to do this: gir1 = gnome.generate_gir(...) gir2 = gnome.generate_gir(... includes: ['GObject-2.0', gir1]) This fails with an error: ERROR: Gir includes must be str, GirTarget, or list of them. The issue is that the 'gir1[0]' should be passed instead of 'gir1'. To make the problem slightly clearly, tweak the error message to be: ERROR: Gir includes must be str, GirTarget, or list of them. Got TypelibTarget.
2020-10-22pkgconfig: Define libdir and includedir in -uninstalled.pc filesXavier Claessens1-6/+5
This fixes glib-2.0-uninstalled.pc file. GLib does `extra_cflags : ['-I${libdir}/glib-2.0/include']` because some of its headers gets installed there. But when used uninstalled that path makes no sense and pkg-config aborts because ${libdir} is not defined. This cannot be worked around by GLib because Meson does not allow setting different `extra_cflags` for -uninstalled.pc, and does not allow setting libdir in `uninstalled_variables`.
2020-10-17Fix gnome.compile_resources() when glib is a subprojectXavier Claessens1-33/+38
When glib is a subproject we should use glib-compile-resources it overrides using find_program() in the case it is not installed on the build machine. With old glib version we have to run glib-compile-resources at configure time to generate the list of dependencies, but not when glib is recent enough.
2020-10-17pkgconfig: InternalDependency's ext_deps should be private by defaultXavier Claessens1-1/+1
This fixes a regression introduced by https://github.com/mesonbuild/meson/pull/7488. InternalDependency's ext_deps previously where simply ignored, but that PR has effect to add many more public Requires in generated pc files.
2020-10-16Fix consistency in variables kwargXavier Claessens1-19/+7
Share common code to extract the `variables` kwarg in declare_dependency() and pkg.generate().