aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2023-06-27 23:57:13 +0300
committerGitHub <noreply@github.com>2023-06-27 23:57:13 +0300
commita4fb8dcc4111575c670c384e52bf1abb119879b9 (patch)
treebdf995d017f7452d7b96f17829d022a208243aba /docs/markdown
parent8946bc05f7f9cdd16dce3613c481a66f7835fc7f (diff)
parent6bfb47a455af60dc975e21dd82943d5baa2bea83 (diff)
downloadmeson-a4fb8dcc4111575c670c384e52bf1abb119879b9.zip
meson-a4fb8dcc4111575c670c384e52bf1abb119879b9.tar.gz
meson-a4fb8dcc4111575c670c384e52bf1abb119879b9.tar.bz2
Merge pull request #11902 from dcbaker/submit/rust-module-enhancements
Rust module enhancements for mesa
Diffstat (limited to 'docs/markdown')
-rw-r--r--docs/markdown/Machine-files.md2
-rw-r--r--docs/markdown/Rust-module.md16
-rw-r--r--docs/markdown/snippets/rust_bindegen_extra_args.md3
-rw-r--r--docs/markdown/snippets/rust_extra_clang_bindgen_arguments.md8
-rw-r--r--docs/markdown/snippets/rust_test_link_with.md4
5 files changed, 31 insertions, 2 deletions
diff --git a/docs/markdown/Machine-files.md b/docs/markdown/Machine-files.md
index ecdb8b4..9e4b0c2 100644
--- a/docs/markdown/Machine-files.md
+++ b/docs/markdown/Machine-files.md
@@ -237,6 +237,8 @@ section.
subprojects. This setting has no effect if the `exe_wrapper` was not specified.
The default value is `true`. (*new in 0.56.0*)
- `java_home` is an absolute path pointing to the root of a Java installation.
+- `bindgen_clang_arguments` an array of extra arguments to pass to clang when
+ calling bindgen
### CMake variables
diff --git a/docs/markdown/Rust-module.md b/docs/markdown/Rust-module.md
index 7617dbb..d3891bf 100644
--- a/docs/markdown/Rust-module.md
+++ b/docs/markdown/Rust-module.md
@@ -18,7 +18,7 @@ like Meson, rather than Meson work more like rust.
## Functions
-### test(name: string, target: library | executable, dependencies: []Dependency)
+### test(name: string, target: library | executable, dependencies: []Dependency, link_with: []targets, rust_args: []string)
This function creates a new rust unittest target from an existing rust
based target, which may be a library or executable. It does this by
@@ -33,6 +33,11 @@ that automatically.
Additional, test only dependencies may be passed via the dependencies
argument.
+*(since 1.2.0)* the link_with argument can be used to pass additional build
+targets to link with
+*(since 1.2.0)* the `rust_args` keyword argument can be ussed to pass extra
+arguments to the Rust compiler.
+
### bindgen(*, input: string | BuildTarget | [](string | BuildTarget), output: string, include_directories: [](include_directories | string), c_args: []string, args: []string, dependencies: []Dependency)
This function wraps bindgen to simplify creating rust bindings around C
@@ -83,10 +88,17 @@ r1 = rust.bindgen(
)
```
-
*Since 1.1.0* Meson will synchronize assertions for Rust and C/C++ when the
`b_ndebug` option is set (via `-DNDEBUG` for C/C++, and `-C
debug-assertions=on` for Rust), and will pass `-DNDEBUG` as an extra argument
to clang. This allows for reliable wrapping of `-DNDEBUG` controlled behavior
with `#[cfg(debug_asserions)]` and or `cfg!()`. Before 1.1.0, assertions for Rust
were never turned on by Meson.
+
+*Since 1.2.0* Additional arguments to pass to clang may be specified in a
+*machine file in the properties section:
+
+```ini
+[properties]
+bindgen_clang_arguments = ['--target', 'x86_64-linux-gnu']
+```
diff --git a/docs/markdown/snippets/rust_bindegen_extra_args.md b/docs/markdown/snippets/rust_bindegen_extra_args.md
new file mode 100644
index 0000000..209d0bc
--- /dev/null
+++ b/docs/markdown/snippets/rust_bindegen_extra_args.md
@@ -0,0 +1,3 @@
+## rust.bindgen allows passing extra arguments to rustc
+
+This may be necessary to pass extra `cfg`s or to change warning levels.
diff --git a/docs/markdown/snippets/rust_extra_clang_bindgen_arguments.md b/docs/markdown/snippets/rust_extra_clang_bindgen_arguments.md
new file mode 100644
index 0000000..71268d4
--- /dev/null
+++ b/docs/markdown/snippets/rust_extra_clang_bindgen_arguments.md
@@ -0,0 +1,8 @@
+## A machine file may be used to pass extra arguments to clang in a bindgen call
+
+Because of the way that bindgen proxies arguments to clang the only choice to
+add extra arguments currently is to wrap bindgen in a script, since the
+arguments must come after a `--`. This is inelegant, and not very portable. Now
+a `bindgen_clang_arguments` field may be placed in the machine file for the host
+machine, and these arguments will be added to every bindgen call for clang. This
+is intended to be useful for things like injecting `--target` arguments.
diff --git a/docs/markdown/snippets/rust_test_link_with.md b/docs/markdown/snippets/rust_test_link_with.md
new file mode 100644
index 0000000..9c2b7d6
--- /dev/null
+++ b/docs/markdown/snippets/rust_test_link_with.md
@@ -0,0 +1,4 @@
+## Add a `link_with` keyword to `rust.test()`
+
+This can already be be worked around by creating `declare_dependency()` objects
+to pass to the `dependencies` keyword, but this cuts out the middle man.