diff options
| -rw-r--r-- | mesonbuild/backend/ninjabackend.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 73a809cd4..24758866c 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1994,14 +1994,13 @@ class NinjaBackend(backends.Backend): if main_rust_file is None: raise RuntimeError('A Rust target has no Rust sources. This is weird. Also a bug. Please report') target_name = self.get_target_filename(target) - cratetype = target.rust_crate_type - args.extend(['--crate-type', cratetype]) + args.extend(['--crate-type', target.rust_crate_type]) # If we're dynamically linking, add those arguments # # Rust is super annoying, calling -C link-arg foo does not work, it has # to be -C link-arg=foo - if cratetype in {'bin', 'dylib'}: + if target.rust_crate_type in {'bin', 'dylib'}: args.extend(rustc.get_linker_always_args()) args += self.generate_basic_compiler_args(target, rustc) @@ -2116,7 +2115,7 @@ class NinjaBackend(backends.Backend): and dep.rust_crate_type == 'dylib' for dep in target_deps) - if cratetype in {'dylib', 'proc-macro'} or has_rust_shared_deps: + if target.rust_crate_type in {'dylib', 'proc-macro'} or has_rust_shared_deps: # add prefer-dynamic if any of the Rust libraries we link # against are dynamic or this is a dynamic library itself, # otherwise we'll end up with multiple implementations of libstd. @@ -2126,12 +2125,12 @@ class NinjaBackend(backends.Backend): args += self.get_build_rpath_args(target, rustc) proc_macro_dylib_path = None - if cratetype == 'proc-macro': + if target.rust_crate_type == 'proc-macro': proc_macro_dylib_path = self.get_target_filename_abs(target) self._add_rust_project_entry(target.name, os.path.abspath(os.path.join(self.environment.build_dir, main_rust_file)), - args, cratetype, target_name, + args, target.rust_crate_type, target_name, bool(target.subproject), proc_macro_dylib_path, project_deps) @@ -2144,7 +2143,6 @@ class NinjaBackend(backends.Backend): element.add_dep(deps) element.add_item('ARGS', args) element.add_item('targetdep', depfile) - element.add_item('cratetype', cratetype) self.add_build(element) if isinstance(target, build.SharedLibrary): self.generate_shsym(target) |
