summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-05-21 23:47:23 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2014-05-21 23:47:23 +0300
commitee0607ddf92b0d4e3cf9a075db6c2e2f4439400e (patch)
tree5776d8b7c254c7b78c5d0e556ee2f6720e2c3b84 /test cases
parent2ecd2ea65a3c3a81e83d298ed815984b4107b9da (diff)
downloadmeson-ee0607ddf92b0d4e3cf9a075db6c2e2f4439400e.tar.gz
Can use outputs of targets as inputs of custom targets.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/57 custom target chain/data_source.txt1
-rw-r--r--test cases/common/57 custom target chain/installed_files.txt1
-rw-r--r--test cases/common/57 custom target chain/meson.build21
-rwxr-xr-xtest cases/common/57 custom target chain/my_compiler.py14
-rwxr-xr-xtest cases/common/57 custom target chain/my_compiler2.py14
5 files changed, 51 insertions, 0 deletions
diff --git a/test cases/common/57 custom target chain/data_source.txt b/test cases/common/57 custom target chain/data_source.txt
new file mode 100644
index 000000000..0c23cc0c3
--- /dev/null
+++ b/test cases/common/57 custom target chain/data_source.txt
@@ -0,0 +1 @@
+This is a text only input file.
diff --git a/test cases/common/57 custom target chain/installed_files.txt b/test cases/common/57 custom target chain/installed_files.txt
new file mode 100644
index 000000000..c5f8bd766
--- /dev/null
+++ b/test cases/common/57 custom target chain/installed_files.txt
@@ -0,0 +1 @@
+subdir/data2.dat
diff --git a/test cases/common/57 custom target chain/meson.build b/test cases/common/57 custom target chain/meson.build
new file mode 100644
index 000000000..7bfcddb94
--- /dev/null
+++ b/test cases/common/57 custom target chain/meson.build
@@ -0,0 +1,21 @@
+project('custom target', 'c')
+
+python = find_program('python3')
+
+comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py')
+comp2 = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler2.py')
+infile = '@0@/@1@'.format(meson.current_source_dir(), 'data_source.txt')
+outfile = '@0@/@1@'.format(meson.current_build_dir(), 'data.dat')
+outfile2 = '@0@/@1@'.format(meson.current_build_dir(), 'data2.dat')
+
+mytarget = custom_target('bindat',
+output : 'data.dat',
+command : [python, comp, infile, outfile],
+)
+
+mytarget2 = custom_target('bindat2',
+output : 'data2.dat',
+command : [python, comp2, mytarget, outfile2],
+install : true,
+install_dir : 'subdir'
+)
diff --git a/test cases/common/57 custom target chain/my_compiler.py b/test cases/common/57 custom target chain/my_compiler.py
new file mode 100755
index 000000000..3165cf8c0
--- /dev/null
+++ b/test cases/common/57 custom target chain/my_compiler.py
@@ -0,0 +1,14 @@
+#!/usr/bin/python3
+
+import sys
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print(sys.argv[0], 'input_file output_file')
+ sys.exit(1)
+ ifile = open(sys.argv[1]).read()
+ if ifile != 'This is a text only input file.\n':
+ print('Malformed input')
+ sys.exit(1)
+ ofile = open(sys.argv[2], 'w')
+ ofile.write('This is a binary output file.\n')
diff --git a/test cases/common/57 custom target chain/my_compiler2.py b/test cases/common/57 custom target chain/my_compiler2.py
new file mode 100755
index 000000000..8c767b124
--- /dev/null
+++ b/test cases/common/57 custom target chain/my_compiler2.py
@@ -0,0 +1,14 @@
+#!/usr/bin/python3
+
+import sys
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print(sys.argv[0], 'input_file output_file')
+ sys.exit(1)
+ ifile = open(sys.argv[1]).read()
+ if ifile != 'This is a binary output file.\n':
+ print('Malformed input')
+ sys.exit(1)
+ ofile = open(sys.argv[2], 'w')
+ ofile.write('This is a different binary output file.\n')