summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)Author
2023-10-09build: Use typed_kwargs for language argsDylan Baker
This also moves the repacking into the interpreter, making the build implementation simpler and removing a layering violation. This also makes use a defaultdict to remove the need to call `.get()`
2023-10-09Clean up some of the code in simd.check()Tristan Partin
2023-10-09Finish typing the simd moduleTristan Partin
2023-10-09Port simd.check() to typed_pos_args/typed_kwargsTristan Partin
2023-10-04Move modtest to the new extension module APITristan Partin
2023-10-04Remove unnecessary isinstance callTristan Partin
This code predated typed_pos_args/typed_kwargs.
2023-10-04interpreter: rename SOURCE_KW to DEPENDENCY_SOURCES_KWDylan Baker
Since that's what this actually is.
2023-09-30find_tool: don't assume the pkgconfig variable is a valid commandChristoph Reiter
ExternalProgram currently assumes that if a command is passed it exists and can be used as is. In case we extract the path from pkgconfig the path might not exist, on Windows it might be missing the ".exe" suffix. By passing the variables as a name ExternalProgram will validate that the command exists at configure time and will fail if not, and it will try to fixup the command by appending .exe etc. Fixes #12271
2023-09-27interpreter: annotate build_target functionDylan Baker
This uses an overload to try to get more accurate information from the function.
2023-09-25rust: apply global, project, and environment C args to bindgenDylan Baker
This means that arguments set via `add_global_arguments`, `add_project_arguments` and by either the `-Dc_args` or `CFLAGS` are applied to bindgen as well. This can be important when, among other things, #defines are set via these mechanisms. Fixes: #12065
2023-09-22Allow to fallback to cmake subprojectXavier Claessens
The method can be overridden by setting the `method` key in the wrap file and always defaults to 'meson'. cmake.subproject() is still needed in case specific cmake options need to be passed. This also makes it easier to extend to other methods in the future e.g. cargo.
2023-09-19Rust: Add a rust.proc_macro() methodDylan Baker
2023-09-18pkgconfig: Set PKG_CONFIG in env for devenv and g-ir-scannerXavier Claessens
2023-09-09gnome.mkenum_simple(): Fix include path when header is in subdirXavier Claessens
It was generating #include with the basename of every header file. That assumes that every directory where there are headers are also included into search path when compiling the .c file. Change to use path relative to current subdir, which can be both in build or source directory. That means that we assume that when the .c file is compiled, the target has a include_directories pointing to the directory where gnome.mkenum_simple() has been called, which is generally '.' and added automatically. Also fix type annotation to only allow str and File sources, other types have never been working, it would require to iterate over custom target outputs, etc. Fixes: #7582
2023-09-07gnome: Fix glib tool lookup consistencyXavier Claessens
It was not always using the pkg-config file.
2023-09-06qt module: add include_directories to moc compileCharles Brunet
Fixes #12182
2023-09-06qt module: fix substitution for depfile in mocCharles Brunet
2023-08-29gnome: Fix crash in gtkdoc and generate_gir in C++ projectsXavier Claessens
gtkdoc() and generate_gir() methods assumes there is a C compiler, but pure C++ projects might not add it explicitly. Fixes: #12162
2023-08-24find_program: Fallback if version mismatchXavier Claessens
Fixes: #11797
2023-08-18Revert "Revert "Add fs.relative_to()""Tristan Partin
This reverts commit 84c8905d527893bedc673e8a036b8b2ec89368b4. Fixed the cygwin failure...
2023-08-18Add more descriptive description to CustomTargetCharles Brunet
Allow modules using CustomTarget to modify the command description used by ninja backend. This result in more precise logs when building a project.
2023-08-17Revert "Add fs.relative_to()"Eli Schwartz
This reverts commit f52bcaa27fc125ab9ae583af466ba99c164169f3. It did not pass CI, and was merged anyway because there were two CI errors in the same cygwin job. The other error was not the fault of this commit, and since cygwin errors were glossed over because they were "expected", the presence of a new error *added* by this commit was overlooked. Per the meson development policy, PRs which result in CI errors can/should be reverted at will, no questions asked.
2023-08-17fix style errors in fs.relative_to implementationEli Schwartz
In commit f52bcaa27fc125ab9ae583af466ba99c164169f3 a few issues were added: - doc typo - imports for utils.universal are not intended to be directly used, it's an internal wrapper that exists solely to make mesonlib work well as it always did while simultaneously allowing `meson --internal` codepaths to avoid importing anything other than an extremely stripped down core - type annotation specific import was imported at runtime scope
2023-08-17Add fs.relative_to()Tristan Partin
Returns a relative path from arg 2 to arg 1 similar to os.path.relpath().
2023-08-16fs.read(): Catch FileNotFoundErrorXavier Claessens
2023-08-14Python: Add 'limited_api' kwarg to extension_moduleAndrew McNulty
This commit adds a new keyword arg to extension_module() that enables a user to target the Python Limited API, declaring the version of the limited API that they wish to target. Two new unittests have been added to test this functionality.
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-08-10hotdoc module: add a bunch more type annotationsEli Schwartz
2023-08-10hotdoc module: avoid monkeypatch crime by properly subclassing ExternalProgramEli Schwartz
2023-08-10python module: add a few more type annotationsEli Schwartz
2023-08-10allow some ObjectHolder subclasses to continue to be genericEli Schwartz
ExternalProgram and CustomTarget have some use cases for producing subclassed interpreter holders with more specific types and methods. In order for those subclasses to properly refer to their held_object, we need a shared base class that is still generic, though bound. For the derived held objects, inherit from the base class and specify the final types as the module-specific type.
2023-08-03PkgConfigDependency: Move CLI handling into its own abstractionXavier Claessens
This makes the code cleaner and will allow to have other implementations in the future.
2023-07-28modules/python3: exclude name_prefix and name_suffixDylan Baker
We can remove these from `permittedKwargs` (like we've already done for `typed_kwargs`) and then remove the in body checks.
2023-07-28modules/python3: use typed_pos_args for extension_moduleDylan Baker
2023-07-28modules/python3: use typed_kwargs for extension_moduleDylan Baker
Just like python, but for the python3 module
2023-07-28modules/python: use typed_pos_args for extension_moduleDylan Baker
2023-07-28modules/python: typed_kwargs for subdirDylan Baker
We cannot re-use the existing KwargInfo, since we need to know if the keyword was set explicitly or not, since it conflicts with `install_dir`
2023-07-28modules/python: use the SHARED_MOD_KWS for extension methodDylan Baker
2023-07-26Fix install_data() default install pathDaniele Nicolodi
This fixes two issues in constructing the default installation path when install_dir is not specified: - inside a subproject, install_data() would construct the destination path using the parent project name instead than the current project name, - when specifying preserve_path, install_data() would construct the destination path omitting the project name. Fixes #11910.
2023-07-25modules/pkgconfig: Don't insert None into devenv listDylan Baker
When the pkgconfig module is imported, but not used, it will insert None on the end of the devenv list. This list is not expected to contain None, and causes Meson to crash. This can happen in complex build setups (reported from mesa), where pkgconfig is only used in some configurations Fixes: #12032
2023-07-19move various bits of type-checking only code to TYPE_CHECKING blocksEli Schwartz
Mostly detected with flake8-type-checking. Also quote T.cast() first arguments, since those are not affected by future annotations.
2023-07-19avoid module indirection in name resolution for imported objectsEli Schwartz
We already import a bunch of objects directly from ..build but don't use them nearly as much as we can. This resulted both in longer lines and s minor performance difference since python has to resolve the name binding the long way. There's no reason not to rewrite these names to use the direct imports. Found while investigating the fact that Executable was imported but never used. It's easier to just use it.
2023-07-19fix implicit_reexport issues and enforce them going forwardEli Schwartz
This detects cases where module A imports a function from B, and C imports that same function from A instead of B. It's not part of the API contract of A, and causes innocent refactoring to break things.
2023-07-19add better comments for mypy suppressionsEli Schwartz
2023-07-13cmake: fix directory separators in generated packageConfig.cmake filesMatthieu Rogez
On windows, meson would mix posix and windows dir separators in the computed PACKAGE_RELATIVE_PATH. Here we force posix directory separator even on Windows. This matches the CMake behavior and fixes interpretation of the resulting path. Fixes #6955 Fixes #9702
2023-07-10windows: Fix detection of the llvm-rc resource compilerMartin Storsjö
By default, clang-cl based environments use rc.exe as resource compiler. However, when cross compiling with clang-cl, one might want to use llvm-rc instead. Try to detect llvm-rc based on the output from "$CMD /?". This requires a very recent llvm-rc; previosly, the output of "/?" with llvm-rc was very generic and didn't explicitly indicate that it actually was llvm-rc. This was changed in https://github.com/llvm/llvm-project/commit/bab6902eba55026a829d232629f99ac276936ef0 which will be included in the upcoming LLVM 17.0.0 release. Contrary to the other regexes, don't include the preceding parts of the line in the log printout, as it includes an unhelpful "OVERVIEW:" prefix.
2023-07-05Merge pull request #11742 from xclaesse/link-whole-casesJussi Pakkanen
Fix niche cases when linking static libs
2023-06-27modules/rust: Add a keyword argument to pass extra args to the rust compilerDylan Baker
This may be necessary to, for example, stop rustc complaining about unused functions
2023-06-27modules/rust: Add a machine file property for extra clang args with bindgenDylan Baker
It's currently impossible to inject extra clang arguments when using bindgen, which is problematic when cross compiling since you may need critical arguments like `--target=...`. Because such arguments must be passed after the `--` it's impossible to inject them currently without going to something like a wrapper script. Fixes: #11805
2023-06-27modules/rust: Add a `link_with` kwarg to the test methodDylan Baker
This was requested by Mesa, where a bunch of `declare_dependency` objects are being created as a workaround for the lack of this keyword