aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ninjabackend.py5
-rw-r--r--test cases/rust/2 sharedlib/meson.build3
-rw-r--r--test cases/rust/2 sharedlib/stuff.rs3
3 files changed, 9 insertions, 2 deletions
diff --git a/ninjabackend.py b/ninjabackend.py
index 95edba9..543cc12 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -506,12 +506,13 @@ class NinjaBackend(backends.Backend):
flags = ['--crate-type']
if isinstance(target, build.Executable):
flags.append('bin')
+ elif isinstance(target, build.SharedLibrary):
+ flags.append('dylib')
else:
raise InvalidArguments('Unknown target type for rustc.')
flags += rustc.get_buildtype_flags(self.environment.coredata.buildtype)
- target_file = target.get_basename()
depfile = target.name + '.d'
- flags += ['--out-dir', target.subdir, '-o', target_file]
+ flags += ['--out-dir', target.subdir, '-o', target.get_filename()]
flags += ['--dep-info', depfile]
element = NinjaBuildElement(target_name, 'rust_COMPILER', relsrc)
element.add_item('FLAGS', flags)
diff --git a/test cases/rust/2 sharedlib/meson.build b/test cases/rust/2 sharedlib/meson.build
new file mode 100644
index 0000000..88a0623
--- /dev/null
+++ b/test cases/rust/2 sharedlib/meson.build
@@ -0,0 +1,3 @@
+project('rust shared library', 'rust')
+
+l = shared_library('stuff', 'stuff.rs')
diff --git a/test cases/rust/2 sharedlib/stuff.rs b/test cases/rust/2 sharedlib/stuff.rs
new file mode 100644
index 0000000..5e1dcc2
--- /dev/null
+++ b/test cases/rust/2 sharedlib/stuff.rs
@@ -0,0 +1,3 @@
+#![crate_id = "stuff#1.0"]
+
+pub fn explore() -> &'static str { "librarystring" }