aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-01-06 11:56:52 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-01-19 10:14:12 -0800
commitcaa6d5e16b6b12f64269246e83d29e2189bb5e92 (patch)
tree9e633abc57a37a66011b563cfaca73b341755b32
parentbff0b415250b4f4f7cd750b60e6c01daaa61af15 (diff)
downloadmeson-caa6d5e16b6b12f64269246e83d29e2189bb5e92.zip
meson-caa6d5e16b6b12f64269246e83d29e2189bb5e92.tar.gz
meson-caa6d5e16b6b12f64269246e83d29e2189bb5e92.tar.bz2
backend/ninja: Add order dependencies for generated sources in rust
-rw-r--r--mesonbuild/backend/ninjabackend.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 9f2e649..c1c4c93 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1582,6 +1582,9 @@ int dummy;
# Compiler args for compiling this target
args += compilers.get_base_compile_args(base_proxy, rustc)
self.generate_generator_list_rules(target)
+
+ orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets]
+
main_rust_file = None
for i in target.get_sources():
if not rustc.can_compile(i):
@@ -1598,6 +1601,7 @@ int dummy;
fname = i
if main_rust_file is None:
main_rust_file = fname
+ orderdeps.append(fname)
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 = os.path.join(target.subdir, target.get_filename())
@@ -1635,7 +1639,6 @@ int dummy;
args += target.get_extra_args('rust')
args += rustc.get_output_args(os.path.join(target.subdir, target.get_filename()))
args += self.environment.coredata.get_external_args(target.for_machine, rustc.language)
- orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets]
linkdirs = OrderedDict()
for d in target.link_targets:
linkdirs[d.subdir] = True
@@ -1682,7 +1685,7 @@ int dummy;
args += ['-C', 'link-arg=' + rpath_arg + ':' + os.path.join(rustc.get_sysroot(), 'lib')]
compiler_name = self.get_compiler_rule_name('rust', target.for_machine)
element = NinjaBuildElement(self.all_outputs, target_name, compiler_name, main_rust_file)
- if len(orderdeps) > 0:
+ if orderdeps:
element.add_orderdep(orderdeps)
element.add_item('ARGS', args)
element.add_item('targetdep', depfile)