add `crate-name` to Rust target args

This is required for downstream Rust dependencies to properly import
libraries using `extern crate`.
pull/2104/head
Adam C. Foltzer 8 years ago committed by Jussi Pakkanen
parent bff37a90fc
commit 4eda3ca0fc
  1. 1
      mesonbuild/backend/ninjabackend.py
  2. 2
      test cases/rust/6 named staticlib/installed_files.txt
  3. 5
      test cases/rust/6 named staticlib/meson.build
  4. 3
      test cases/rust/6 named staticlib/prog.rs
  5. 1
      test cases/rust/6 named staticlib/stuff.rs

@ -1176,6 +1176,7 @@ int dummy;
else:
raise InvalidArguments('Unknown target type for rustc.')
args.append(cratetype)
args += ['--crate-name', target.name]
args += rustc.get_buildtype_args(self.get_option_for_target('buildtype', target))
depfile = os.path.join(target.subdir, target.name + '.d')
args += ['--emit', 'dep-info={}'.format(depfile), '--emit', 'link']

@ -0,0 +1,2 @@
usr/bin/prog?exe
usr/lib/libnamed_stuff.rlib

@ -0,0 +1,5 @@
project('rust static library', 'rust')
l = static_library('named_stuff', 'stuff.rs', install : true)
e = executable('prog', 'prog.rs', link_with : l, install : true)
test('linktest', e)

@ -0,0 +1,3 @@
extern crate named_stuff;
fn main() { println!("printing: {}", named_stuff::explore()); }

@ -0,0 +1 @@
pub fn explore() -> &'static str { "librarystring" }
Loading…
Cancel
Save