From bdd4c45b173055931db1c758cd7f016693d3a924 Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Fri, 9 Jun 2017 14:51:58 -0700 Subject: Enhance Rust support - Adds a `crate_type` kwarg to library targets, allowing the different types of Rust [linkage][1]. - Shared libraries use the `dylib` crate type by default, but can also be `cdylib` - Static libraries use the `rlib` crate type by default, but can also be `staticlib` - If any Rust target has shared library dependencies, add the appropriate linker arguments, including rpath for the sysroot of the Rust compiler [1]: https://doc.rust-lang.org/reference/linkage.html --- mesonbuild/compilers.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mesonbuild/compilers.py') diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index c9cfb46..6e7283c 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1809,6 +1809,14 @@ class RustCompiler(Compiler): def get_buildtype_args(self, buildtype): return rust_buildtype_args[buildtype] + def build_rpath_args(self, build_dir, rpath_paths, install_rpath): + return build_unix_rpath_args(build_dir, rpath_paths, install_rpath) + + def get_sysroot(self): + cmd = self.exelist + ['--print', 'sysroot'] + p, stdo, stde = Popen_safe(cmd) + return stdo.split('\n')[0] + class SwiftCompiler(Compiler): def __init__(self, exelist, version): self.language = 'swift' -- cgit v1.1