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
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.
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
This reverts commit f52bcaa27f.
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.
In commit f52bcaa27f 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
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.
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/
```
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.
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.
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
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.
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.
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#6955Fixes#9702
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
bab6902eba
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.
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
This reverts commit a2def550c5.
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...
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.
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. ;)
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.