diff options
Diffstat (limited to 'docs/markdown/Rust.md')
| -rw-r--r-- | docs/markdown/Rust.md | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/docs/markdown/Rust.md b/docs/markdown/Rust.md index c93eadf02..1ca3d3a85 100644 --- a/docs/markdown/Rust.md +++ b/docs/markdown/Rust.md @@ -137,9 +137,28 @@ cargo_ws = rustmod.workspace( features: ['feature1', 'feature2']) ``` -### Limitations +Finally, the workspace object is able to build targets specified in `lib` +or `bin` sections, extracting compiler arguments for dependencies and +diagnostics from the Cargo.toml file. The simplest case is that of building +a simple binary crate: -All your own crates must be built using the usual Meson functions such as -[[static_library]] or [[executable]]. In the future, workspace object -functionality will be extended to help building rustc command lines -based on features, dependency names, and so on. +```meson +cargo_ws.package().executable(install: true) +``` + +For a workspace: + +```meson +pkg_lib = cargo_ws.package('myproject-lib') +lib = pkg_lib.library(install: false) +pkg_lib.override_dependency(declare_dependency(link_with: lib)) + +cargo_ws.package().executable(install: true) +``` + +Sources are automatically discovered, but can be specified as a +[[@structured_src]] if they are partly generated. + +It is still possible to use keyword arguments to link non-Rust build targets, +or even to use the usual Meson functions such as [[static_library]] or +[[executable]]. |
