aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/backends.py4
-rw-r--r--test cases/common/166 custom target subdir depend files/copyfile.py6
-rw-r--r--test cases/common/166 custom target subdir depend files/meson.build7
-rw-r--r--test cases/common/166 custom target subdir depend files/subdir/dep.dat1
-rw-r--r--test cases/common/166 custom target subdir depend files/subdir/foo.c.in6
-rw-r--r--test cases/common/166 custom target subdir depend files/subdir/meson.build6
6 files changed, 28 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index df58271..067b719 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -740,9 +740,9 @@ class Backend:
deps.append(i.rel_to_builddir(self.build_to_src))
else:
if absolute_paths:
- deps.append(os.path.join(self.environment.get_build_dir(), i))
+ deps.append(os.path.join(self.environment.get_source_dir(), target.subdir, i))
else:
- deps.append(os.path.join(self.build_to_src, i))
+ deps.append(os.path.join(self.build_to_src, target.subdir, i))
return deps
def eval_custom_target_command(self, target, absolute_outputs=False):
diff --git a/test cases/common/166 custom target subdir depend files/copyfile.py b/test cases/common/166 custom target subdir depend files/copyfile.py
new file mode 100644
index 0000000..ff42ac3
--- /dev/null
+++ b/test cases/common/166 custom target subdir depend files/copyfile.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import sys
+import shutil
+
+shutil.copyfile(sys.argv[1], sys.argv[2])
diff --git a/test cases/common/166 custom target subdir depend files/meson.build b/test cases/common/166 custom target subdir depend files/meson.build
new file mode 100644
index 0000000..44f5c71
--- /dev/null
+++ b/test cases/common/166 custom target subdir depend files/meson.build
@@ -0,0 +1,7 @@
+project('custom target subdir depend files', 'c')
+
+copy = find_program('copyfile.py')
+
+subdir('subdir')
+
+executable('foo', foo_src)
diff --git a/test cases/common/166 custom target subdir depend files/subdir/dep.dat b/test cases/common/166 custom target subdir depend files/subdir/dep.dat
new file mode 100644
index 0000000..5daee49
--- /dev/null
+++ b/test cases/common/166 custom target subdir depend files/subdir/dep.dat
@@ -0,0 +1 @@
+You can depend on this file. \ No newline at end of file
diff --git a/test cases/common/166 custom target subdir depend files/subdir/foo.c.in b/test cases/common/166 custom target subdir depend files/subdir/foo.c.in
new file mode 100644
index 0000000..d53846f
--- /dev/null
+++ b/test cases/common/166 custom target subdir depend files/subdir/foo.c.in
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main() {
+ printf("foo is working.\n");
+ return 0;
+}
diff --git a/test cases/common/166 custom target subdir depend files/subdir/meson.build b/test cases/common/166 custom target subdir depend files/subdir/meson.build
new file mode 100644
index 0000000..f9d31c4
--- /dev/null
+++ b/test cases/common/166 custom target subdir depend files/subdir/meson.build
@@ -0,0 +1,6 @@
+foo_src = custom_target('foo_src',
+ depend_files : 'dep.dat',
+ input : 'foo.c.in',
+ output : 'foo.c',
+ command : [copy, '@INPUT@', '@OUTPUT@']
+)