How can I automatically download the dependencies of an external Rust crate (similar to Cargo)? #14096
|
Hi! I'm trying to port a fairly complex project to Rust, and since I need to heavily interface with existing C/C++ libraries, I'm trying to use a polyglot build system, in this case Meson. I managed to make it compile Rust, and link against one of the C libraries I'm using. Now, I want to use an external crate (for the sake of MWE, let's say I managed to write a rand.wrap file [wrap-git]
url = https://github.com/rust-random/rand.git
revision = 0.8.5
depth = 1
method = cargo
[provide]
dependency_names = rand-0.8-rsand my relevant meson.build is project('meson-test', ['rust', 'c'],
version : '0.1',
default_options : ['warning_level=3'],
meson_version: '>=1.0.0')
c_lib = static_library('utils', 'utils.c')
# build cJSON lib with CMake
cjson = dependency('cJSON')
# generate cJSON Rust bindings
rust = import('rust')
generated = rust.bindgen(
input : 'cJSON/cJSON.h',
output : 'generated-cJSON.rs',
dependencies : cjson,
args : ['--no-rustfmt-bindings'],
)
rand = dependency('rand')
exe = executable('meson_test',
'main.rs', generated,
link_with: [c_lib],
dependencies: [cjson])but I get the error and in case it's useful, the complete log is What am doing wrong? think this may be related to #13466 . Thanks! |
Replies: 3 comments 5 replies
|
Since dependency_names is |
|
Meson can synthesize new My understanding is the eventual goal is to plumb this into |
|
Hi @awbertulli support for external crates has taken shape in 1.11.0. See the documentation or #14639 for more information. |
Hi @awbertulli support for external crates has taken shape in 1.11.0. See the documentation or #14639 for more information.