aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)AuthorFilesLines
2023-09-25rust: apply global, project, and environment C args to bindgenDylan Baker1-0/+6
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 Claessens1-1/+1
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 Baker1-3/+20
2023-09-18pkgconfig: Set PKG_CONFIG in env for devenv and g-ir-scannerXavier Claessens3-8/+9
2023-09-09gnome.mkenum_simple(): Fix include path when header is in subdirXavier Claessens1-9/+18
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 Claessens1-13/+31
It was not always using the pkg-config file.
2023-09-06qt module: add include_directories to moc compileCharles Brunet1-2/+5
Fixes #12182
2023-09-06qt module: fix substitution for depfile in mocCharles Brunet1-1/+1
2023-08-29gnome: Fix crash in gtkdoc and generate_gir in C++ projectsXavier Claessens2-0/+8
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 Claessens1-1/+2
Fixes: #11797
2023-08-18Revert "Revert "Add fs.relative_to()""Tristan Partin1-7/+22
This reverts commit 84c8905d527893bedc673e8a036b8b2ec89368b4. Fixed the cygwin failure...
2023-08-18Add more descriptive description to CustomTargetCharles Brunet7-0/+20
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 Schwartz1-22/+7
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 Schwartz1-8/+2
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 Partin1-1/+22
Returns a relative path from arg 2 to arg 1 similar to os.path.relpath().
2023-08-16fs.read(): Catch FileNotFoundErrorXavier Claessens1-1/+3
2023-08-14Python: Add 'limited_api' kwarg to extension_moduleAndrew McNulty1-8/+75
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 Schwartz1-1/+1
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 Schwartz1-51/+74
2023-08-10hotdoc module: avoid monkeypatch crime by properly subclassing ExternalProgramEli Schwartz1-7/+8
2023-08-10python module: add a few more type annotationsEli Schwartz1-5/+8
2023-08-10allow some ObjectHolder subclasses to continue to be genericEli Schwartz2-7/+7
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 Claessens3-7/+7
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 Baker1-5/+1
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 Baker1-4/+9
2023-07-28modules/python3: use typed_kwargs for extension_moduleDylan Baker1-3/+12
Just like python, but for the python3 module
2023-07-28modules/python: use typed_pos_args for extension_moduleDylan Baker1-5/+7
2023-07-28modules/python: typed_kwargs for subdirDylan Baker1-8/+9
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 Baker1-3/+10
2023-07-26Fix install_data() default install pathDaniele Nicolodi1-1/+0
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 Baker1-1/+2
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 Schwartz2-4/+4
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 Schwartz1-56/+56
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 Schwartz6-15/+15
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 Schwartz2-2/+3
2023-07-13cmake: fix directory separators in generated packageConfig.cmake filesMatthieu Rogez1-1/+2
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ö1-0/+1
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 Pakkanen1-1/+1
Fix niche cases when linking static libs
2023-06-27modules/rust: Add a keyword argument to pass extra args to the rust compilerDylan Baker1-1/+10
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 Baker1-1/+4
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 Baker1-3/+10
This was requested by Mesa, where a bunch of `declare_dependency` objects are being created as a workaround for the lack of this keyword
2023-06-26Revert "modules: move gnome targets into gnome module"Eli Schwartz2-19/+20
This reverts commit a2def550c586aeba4269588e79a1a308467f2582. This results in a 2k line file being unconditionally imported at startup, and transitively loading two more (for a total cost of 2759 lines of code), and it's not clear it was ever needed to begin with...
2023-06-26dependencies: defer importing a custom dependency until it is usedEli Schwartz2-2/+4
This lessens the amount of code imported at Meson startup by mapping each dependency to a dictionary entry and using a programmable import to dynamically return it. Minus 16 files and 6399 lines of code imported at startup.
2023-06-26dependencies: move dub to a hidden package internal detailEli Schwartz1-4/+5
Do not import it and expose it at the package scope, it's never used elsewhere except inside the dub module.
2023-06-26tree-wide: reduce unneeded imports on specific Dependency implsEli Schwartz1-3/+2
We can check something's subtype using properties, without importing the module up front and doing isinstance checks on specific subclasses of the interface -- or worse, solving cyclic imports by doing the import inside the function. ;)
2023-06-26pkgconfig: move uninstalled devenv handling from setup to the module hookEli Schwartz1-2/+9
msetup.py doesn't need to know the gory details of PkgConfigDependency, or directly import it at program startup. It's also slightly wasteful to generate a devenv for the -uninstalled directory when a project doesn't even, in the end, use the pkgconfig module anyway.
2023-06-20interpreter: allow default_options and override_options as a dictDylan Baker1-1/+1
2023-06-15windows: Fix windres detection for Microsoft shipped ClangL. E. Segovia1-1/+2
Clang, clang-cl, and MSVC all rely on RC.EXE to build resource files. Fixes #11845
2023-06-01pkgconfig: Add include directories from internal deps in -uninstalled.pcXavier Claessens1-23/+18
Fixes: #8651
2023-06-01python: Use detect.find_external_dependency() for log consistencyXavier Claessens1-7/+3
py.find_installation().dependency() was not logging whether it is found or not. Use find_external_dependency() for consistency.