aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-04-13 23:04:51 +0300
committerXavier Claessens <xclaesse@gmail.com>2023-04-21 15:35:06 -0400
commit01420bf8fc1ee6c1466e2fa4c9805267192dce26 (patch)
treec419d8b14d4a4144a4a3ce093f853e0c7d385875 /docs
parent474e3ea8afd170ae86cc5c3a547caee65f97ecb8 (diff)
downloadmeson-01420bf8fc1ee6c1466e2fa4c9805267192dce26.zip
meson-01420bf8fc1ee6c1466e2fa4c9805267192dce26.tar.gz
meson-01420bf8fc1ee6c1466e2fa4c9805267192dce26.tar.bz2
rust: Add new `rust_dependency_map` target configuration
This allows changing the crate name with which a library ends up being available inside the Rust code, similar to cargo's dependency renaming feature or `extern crate foo as bar` inside Rust code.
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/snippets/rust_dependency_map.md18
-rw-r--r--docs/yaml/functions/_build_target_base.yaml10
2 files changed, 28 insertions, 0 deletions
diff --git a/docs/markdown/snippets/rust_dependency_map.md b/docs/markdown/snippets/rust_dependency_map.md
new file mode 100644
index 0000000..62c9dae
--- /dev/null
+++ b/docs/markdown/snippets/rust_dependency_map.md
@@ -0,0 +1,18 @@
+## Support for defining crate names of Rust dependencies in Rust targets
+
+Rust supports defining a different crate name for a dependency than what the
+actual crate name during compilation of that dependency was.
+
+This allows using multiple versions of the same crate at once, or simply using
+a shorter name of the crate for convenience.
+
+```meson
+a_dep = dependency('some-very-long-name')
+
+my_executable = executable('my-executable', 'src/main.rs',
+ rust_dependency_map : {
+ 'some_very_long_name' : 'a',
+ },
+ dependencies : [a_dep],
+)
+```
diff --git a/docs/yaml/functions/_build_target_base.yaml b/docs/yaml/functions/_build_target_base.yaml
index 8b169c8..abc5bf9 100644
--- a/docs/yaml/functions/_build_target_base.yaml
+++ b/docs/yaml/functions/_build_target_base.yaml
@@ -302,3 +302,13 @@ kwargs:
"proc-macro" is a special rust procedural macro crate.
"proc-macro" is new in 0.62.0.
+
+ rust_dependency_map:
+ type: dict[str]
+ since: 1.2.0
+ description: |
+ On rust targets this provides a map of library names to the crate name
+ with which it would be available inside the rust code.
+
+ This allows renaming similar to the dependency renaming feature of cargo
+ or `extern crate foo as bar` inside rust code.