diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-04-13 19:10:49 +0300 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-04-14 10:27:54 -0400 |
commit | e184fc84b32cc2597efd950123df36038c6ee1e0 (patch) | |
tree | bccf07274c7a357a159e1e7e3430bcf37ef2d45c /mesonbuild | |
parent | a787b0cd5fdb0d0dce85148c4febde0806885085 (diff) | |
download | meson-e184fc84b32cc2597efd950123df36038c6ee1e0.zip meson-e184fc84b32cc2597efd950123df36038c6ee1e0.tar.gz meson-e184fc84b32cc2597efd950123df36038c6ee1e0.tar.bz2 |
rust: Link staticlib/cdylib link targets like link targets from any other language
staticlib/cdylib only provide a C ABI, i.e. contain no Rust metadata,
and can be linked like a link target from any other language.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index d556009..cd860b8 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1904,7 +1904,10 @@ class NinjaBackend(backends.Backend): # TODO: we likely need to use verbatim to handle name_prefix and name_suffix for d in target.link_targets: linkdirs.add(d.subdir) - if d.uses_rust(): + # staticlib and cdylib provide a plain C ABI, i.e. contain no Rust + # metadata. As such they should be treated like any other external + # link target + if d.uses_rust() and d.rust_crate_type not in ['staticlib', 'cdylib']: # specify `extern CRATE_NAME=OUTPUT_FILE` for each Rust # dependency, so that collisions with libraries in rustc's # sysroot don't cause ambiguity |