aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/common/71 ctarget dependency
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/common/71 ctarget dependency')
-rwxr-xr-xmeson/test cases/common/71 ctarget dependency/gen1.py12
-rwxr-xr-xmeson/test cases/common/71 ctarget dependency/gen2.py10
-rw-r--r--meson/test cases/common/71 ctarget dependency/input.dat1
-rw-r--r--meson/test cases/common/71 ctarget dependency/meson.build20
4 files changed, 43 insertions, 0 deletions
diff --git a/meson/test cases/common/71 ctarget dependency/gen1.py b/meson/test cases/common/71 ctarget dependency/gen1.py
new file mode 100755
index 000000000..dbadb6d92
--- /dev/null
+++ b/meson/test cases/common/71 ctarget dependency/gen1.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import time, sys
+
+# Make sure other script runs first if dependency
+# is missing.
+time.sleep(0.5)
+
+with open(sys.argv[1]) as f:
+ contents = f.read()
+with open(sys.argv[2], 'w') as f:
+ f.write(contents)
diff --git a/meson/test cases/common/71 ctarget dependency/gen2.py b/meson/test cases/common/71 ctarget dependency/gen2.py
new file mode 100755
index 000000000..dc6525b9d
--- /dev/null
+++ b/meson/test cases/common/71 ctarget dependency/gen2.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import sys, os
+from glob import glob
+
+files = glob(os.path.join(sys.argv[1], '*.tmp'))
+assert(len(files) == 1)
+
+with open(files[0]) as ifile, open(sys.argv[2], 'w') as ofile:
+ ofile.write(ifile.read())
diff --git a/meson/test cases/common/71 ctarget dependency/input.dat b/meson/test cases/common/71 ctarget dependency/input.dat
new file mode 100644
index 000000000..7af91e29a
--- /dev/null
+++ b/meson/test cases/common/71 ctarget dependency/input.dat
@@ -0,0 +1 @@
+This is a piece of text.
diff --git a/meson/test cases/common/71 ctarget dependency/meson.build b/meson/test cases/common/71 ctarget dependency/meson.build
new file mode 100644
index 000000000..cd11951b2
--- /dev/null
+++ b/meson/test cases/common/71 ctarget dependency/meson.build
@@ -0,0 +1,20 @@
+project('custom target dependency', 'c')
+
+# Sometimes custom targets do not take input files
+# but instead do globbing or some similar wackiness.
+# In this case we need to be able to specify a
+# manual dependency between two custom targets,
+# if one needs to be run before the other.
+
+g1 = find_program('gen1.py')
+g2 = find_program('gen2.py')
+
+c1 = custom_target('medput',
+input : 'input.dat',
+output : 'medput.tmp',
+command : [g1, '@INPUT@', '@OUTPUT@'])
+
+custom_target('output',
+output : 'output.dat',
+command : [g2, '@OUTDIR@', '@OUTPUT@'],
+depends : c1)