diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-07-21 18:36:42 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-07-29 21:58:47 +0300 |
| commit | 254af0fb7797805ab268f94680fb455d1d6643a4 (patch) | |
| tree | 8fdc4951774b518654aaa22b487b71f2bac18402 /docs/markdown | |
| parent | aede231ef4db9fc00ecf1ce5878f94d939dc871f (diff) | |
| download | meson-254af0fb7797805ab268f94680fb455d1d6643a4.tar.gz | |
docs: update for mixed Rust/non-Rust sources
Diffstat (limited to 'docs/markdown')
| -rw-r--r-- | docs/markdown/Rust.md | 13 | ||||
| -rw-r--r-- | docs/markdown/snippets/rust-mixed.md | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/docs/markdown/Rust.md b/docs/markdown/Rust.md index 08580cdb6..452dad6e6 100644 --- a/docs/markdown/Rust.md +++ b/docs/markdown/Rust.md @@ -27,14 +27,20 @@ feature is stabilized. ## Mixing Rust and non-Rust sources -Meson currently does not support creating a single target with Rust and non Rust -sources mixed together, therefore one must compile multiple libraries and link -them. +*(Since 1.9.0)* Rust supports mixed targets, but only supports using +`rustc` as the linker for such targets. If you need to use a non-Rust +linker, or support Meson < 1.9.0, see below. + +Until Meson 1.9.0, Meson did not support creating a single target with +Rust and non Rust sources mixed together. One had to compile a separate +Rust `static_library` or `shared_library`, and link it into the C build +target (e.g., a library or an executable). ```meson rust_lib = static_library( 'rust_lib', sources : 'lib.rs', + rust_abi: 'c', ... ) @@ -44,7 +50,6 @@ c_lib = static_library( link_with : rust_lib, ) ``` -This is an implementation detail of Meson, and is subject to change in the future. ## Mixing Generated and Static sources diff --git a/docs/markdown/snippets/rust-mixed.md b/docs/markdown/snippets/rust-mixed.md new file mode 100644 index 000000000..d42ab908d --- /dev/null +++ b/docs/markdown/snippets/rust-mixed.md @@ -0,0 +1,5 @@ +## Rust and non-Rust sources in the same target + +Meson now supports creating a single target with Rust and non Rust +sources mixed together. In this case, if specified, `link_language` +must be set to `rust`. |
