Commit Graph

23 Commits

Author SHA1 Message Date
Dylan Baker e7f20efc8b modules/rust: allow setting a version constraint on bindgen
This allows us to ensure that the bindgen we're using is suitable for
our purpose.
2024-02-23 09:48:32 -08:00
Dylan Baker 05d49c6990 modules/rust: Allow explicitly setting the language to bind
This may be of particular use when a header is .h but should be treated
as a C++ header instead of a C header.
2024-02-23 09:48:32 -08:00
Alyssa Ross 9aa1393fdb docs: fix bindgen_clang_arguments example
> error: unsupported option '--target'; did you mean '-target'?
2023-11-22 22:13:39 +02:00
Dylan Baker 8ccdb88137 Rust: Add a rust.proc_macro() method 2023-09-19 13:54:49 -04:00
Peter Hutterer 1502b90f3a docs: improve formatting of the Rust module
This brings the formatting more in line with other modules, in
particular the headers do not include the full function signature for
readability, keyword arguments are listed one-by-one, etc.
2023-07-18 19:49:08 -04:00
Peter Hutterer f9debd3ae2 docs: fix typos and keyword markdown for the Rust module page
Two typos and mark the keyword arguments with backticks so they render
nicely.
2023-07-18 19:49:08 -04:00
Dylan Baker 5d16bd5308 modules/rust: Add a keyword argument to pass extra args to the rust compiler
This may be necessary to, for example, stop rustc complaining about
unused functions
2023-06-27 11:53:18 -07:00
Dylan Baker c5b16ab8b9 modules/rust: Add a machine file property for extra clang args with bindgen
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-27 11:53:18 -07:00
Dylan Baker 43f24060f3 modules/rust: Add a `link_with` kwarg to the test method
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-27 11:53:18 -07:00
Dylan Baker 474e3ea8af docs: update the Rust bindgen docs to talk about assertions
Since we now guarantee that Rust and C/C++ will have assertions both on
or both off, we can give guidance about using `cfg(debug_assertions)` to
wrap code using `#ifdef NDEBUG`.
2023-04-21 15:18:56 +05:30
Josh Soref cf9fd56bc9 fix various spelling issues
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11 19:21:05 -04:00
Ewout ter Hoeven 9c1bf2bf4c DOCS: Rust-module: Remove note about unstable API
Remove the note about the unstable API of the Rust module, since it's no longer unstable as of Meson 1.0.0.
2022-12-11 16:34:00 -05:00
Dylan Baker d49e6bc038 modules/rust: Add support for dependencies in bindgen
This is needed for cases where we need external C headers, which are
passed to clang.
2022-12-05 12:23:55 -08:00
Dylan Baker bb875280b6 modules/rust: Add support for string include_directories
Which we support for basically every other case, but not this one.
2022-12-05 15:20:09 -05:00
Dylan Baker c642a7693e modules/rust: stabilize
Mesa is using the rust module in production, so we should stabilize
it.
2022-11-19 23:00:53 +02:00
Dylan Baker e77582b251 docs: fix rust module bindgen arguments
Fixes: 9795
2022-01-10 15:34:03 -08:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Daniel Mensinger 2327cb5eb3
docs: Fix broken links 2021-10-03 12:19:45 +02:00
Tim McNamara a6e9b54b1d doc: Fix array syntax [skip ci]
Adds a square bracket to create a valid array.
2021-05-18 19:12:17 -07:00
Dylan Baker b28235428d rust: Add a module wrapper for bindgen
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-06 10:27:04 -08:00
Jussi Pakkanen 474f4813c4 Capitalize "Meson" consistently as it is a proper name. [skip ci] 2021-01-31 19:49:20 +00:00
Jussi Pakkanen f72ee8e742 Rewrap long text lines in docs. [skip ci] 2021-01-30 16:19:59 +00:00
Dylan Baker 3d80a88bd3 modules: Add an unstable-rust module
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-05 15:10:50 -08:00