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.pull/11716/head
parent
474e3ea8af
commit
01420bf8fc
7 changed files with 48 additions and 14 deletions
@ -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], |
||||||
|
) |
||||||
|
``` |
@ -1,4 +1,4 @@ |
|||||||
#[no_mangle] |
#[no_mangle] |
||||||
pub extern "C" fn what_have_we_here() -> i32 { |
pub extern "C" fn what_have_we_here() -> i32 { |
||||||
leaf::HOW_MANY * leaf::HOW_MANY |
myleaf::HOW_MANY * myleaf::HOW_MANY |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue