| Age | Commit message (Collapse) | Author |
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Move the logic for system dependencies outside Cargo.interpreter and
into the rust module, so that it can be reused by the workspace object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Add rustc_args(), env(), and rust_dependency_map() methods to the
RustPackage class. They simply delegate to PackageState and
PackageConfiguration.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Note that, as shown in the testcase, package() works in the subproject
as well. This means that in the future the Cargo code generator can be
changed to reduce the amount of generated code and instead rely on the
package object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Add features property to cargo.Interpreter to make default features configurable;
customization of which features are enabled by default is triggered by
rust.workspace().
Fixes: #14290
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
rust.workspace() is the entry point for global feature resolution.
It loads a Cargo.toml file and ensures that all dependencies will be
built with the correct set of features.
Fixes: #13404
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Give an user opportunities to mangle a custom short name for a DLL on
OS/2.
|
|
|
|
This reverts https://github.com/mesonbuild/meson/pull/15107
Explicit objections regarding the design were raised and not answered,
so it shouldn't have been merged. It needs to be discussed and
revisited.
|
|
|
|
This has the "processed" keyword arguments that the interpreter is
supposed to create for us, or that we expect internal users to build by
build.
This requires some hacking around in the rust module for the moment
because we suddenly have a type.
|
|
|
|
|
|
|
|
Meson sets 64-bit offsets as the default for all platforms but MSVC.
Lets do the same for bindgen, to ensure we get compatible definitions.
Do this by calling `get_always_args()` on the first C'ish host compiler
we can find.
Note that the `libc` crate does not expose 64-bit types as the default
and there is no intention to do so. Instead, it exposes 32-bit default
types, plus the 64-bit extended types with the `*64` suffix. This is
quite unfortunate, but it seems unlikely to change [1].
However, use of `bindgen` is usually not tied to the `libc` crate.
Instead, it is tied to whatever other C code in the same project does.
And Meson sets `_FILE_OFFSET_BITS=64` unconditionally for all this C
code. It thus seems much more plausible for Meson to also imply it for
bindgen.
Given that Rust code that uses the `libc` crate very likely already uses
the `*64` suffixed variants, they are unaffected by whether
`_FILE_OFFSET_BITS=64` is set. If they use `libc::off_t`, they already
explicitly state that they use the 32-bit variant on 32-bit platforms.
Hence, it is inherently incompatible to C code that uses
`_FILE_OFFSET_BITS=64`.
And lastly, if a Meson project is Rust-only, but generates its internal
code from its public C headers, then it is better suited to actually
call `add_language('c')` and ensure that Meson knows what the compiler
configuration for the target platform actually is. Otherwise, bindgen
cannot know what platform options to enable. Hence, warn loudly if
`rust.bindgen()` is used without a configured C compiler (even if the
compiler used by bindgen does not necessarily match the configured one).
[1] https://github.com/rust-lang/libc/issues/3223#issuecomment-2033298952
|
|
The two methods are identical.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Rust doctests implicitly use the base target as a crate. This is not
possible unless the target uses the Rust ABI.
If someone uses a C-ABI target with rust.doctest(), you get an unresolved
module error and it is not clear what's really going on, so add a more
specific error. Cargo does the same, though it only reports a warning.
Fixes: #14813
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
"rustdoc --test" relies on running host binaries, and has no way of wrapping
them with Meson's exe_wrapper. Just skip the doctests in that case.
Fixes: #14583
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
QEMU needs it in its integration tests (in order to run global constructors),
and therefore in rust.doctest too. With this change I could do:
# Rust executables do not support objects, so add an intermediate step.
rust_qemu_api_objs = static_library(
'rust_qemu_api_objs',
objects: [libqom.extract_all_objects(recursive: false),
libhwcore.extract_all_objects(recursive: false)])
rust.doctest('rust-qemu-api-doc', _qemu_api_rs,
dependencies: [qemu_api, qemu_api_macros],
link_with: libqemuutil,
link_whole: [rust_qemu_api_objs],
suite: ['doc', 'rust'])
followed by "meson test --suite doc".
For completeness, add it to rust.test as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
rust.doctest() will have to typecheck that to a list of strings,
no other argument types are allowed. Extract the field out of
BaseTest, placing it in FuncBenchmark and the rust modules's
FuncTest.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
A doctest target is a separate build target (with its own linker
arguments, including dependencies) that is built and added as a
unit test whenever the parent target is built. The doctest's
target is not accessible via ninja.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This adds tracking for both nightly and beta to the rust compiler.
|
|
But only if the user hasn't manually set it.
|
|
Which has both changed the error message and relaxed the check. In
theory we wouldn't hit this unless you have a very old bindgen and a
very new rustc.
|
|
|
|
bindgen by default may output code that an older rustc cannot
successfully consume. To avoid this, we check if bindgen supports the
rustc version we're using, if so, and if the user didn't set the
`--rust-target` option, we will supply it to ensure that bindgen writes
out code our rustc can use. If it does not support that version
explicitly, we leave it at the default, assuming that our compiler
version is newer than bindgen.
|
|
Any argument from the base target is copied to the test target, but some
keyword arguments for libraries are not available in executable.
Remove them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
These errors can make reading comments and documentation
unnecessarily confusing for users and contributors who
do not speak English as their first language.
|
|
|
|
|
|
Should be 1.4.0 but was 1.3.0
|
|
This way the `rust.bindgen` can generate a second output being a C file,
which contains wrapper functions for static inline ones.
This output file can then be compiled via C targets.
|
|
This allows us to ensure that the bindgen we're using is suitable for
our purpose.
|
|
Especially for C++ this is very important.
|
|
This may be of particular use when a header is .h but should be treated
as a C++ header instead of a C header.
|
|
Bindgen natively only considers .hpp to be C++ headers, but Meson
considers some additional extensions including .hh and .hxx to be C++.
|
|
Cargo does this by default, so it's reasonable that we do the same.
Fixes: #12758
|
|
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.
This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.
SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
|