Build a shared Rust library.

pull/15/head
Jussi Pakkanen 11 years ago
parent e4b17ff3e8
commit bf4708eb83
  1. 5
      ninjabackend.py
  2. 3
      test cases/rust/2 sharedlib/meson.build
  3. 3
      test cases/rust/2 sharedlib/stuff.rs

@ -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)

@ -0,0 +1,3 @@
project('rust shared library', 'rust')
l = shared_library('stuff', 'stuff.rs')

@ -0,0 +1,3 @@
#![crate_id = "stuff#1.0"]
pub fn explore() -> &'static str { "librarystring" }
Loading…
Cancel
Save