diff --git a/test cases/common/113 generatorcustom/catter.py b/test cases/common/113 generatorcustom/catter.py new file mode 100755 index 000000000..1ee0f538c --- /dev/null +++ b/test cases/common/113 generatorcustom/catter.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys, os + +output = sys.argv[1] +inputs = sys.argv[2:] + +with open(output, 'w') as ofile: + ofile.write('#pragma once\n') + for i in inputs: + content = open(i, 'r').read() + i.write(content) + i.write('\n') diff --git a/test cases/common/113 generatorcustom/gen.py b/test cases/common/113 generatorcustom/gen.py new file mode 100755 index 000000000..2fc0fdddf --- /dev/null +++ b/test cases/common/113 generatorcustom/gen.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import sys, os + +ifile = sys.argv[1] +ofile = sys.argv[2] + +resname = open(ifile, 'r').readline().strip() + +templ = 'char %s[] = "%s";\n' +open(ofile, 'w').write(templ % (resname, resname)) diff --git a/test cases/common/113 generatorcustom/main.c b/test cases/common/113 generatorcustom/main.c new file mode 100644 index 000000000..04abcf69a --- /dev/null +++ b/test cases/common/113 generatorcustom/main.c @@ -0,0 +1,7 @@ +#include + +#include"alltogether.h" + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/113 generatorcustom/meson.build b/test cases/common/113 generatorcustom/meson.build new file mode 100644 index 000000000..529f28a82 --- /dev/null +++ b/test cases/common/113 generatorcustom/meson.build @@ -0,0 +1,17 @@ +project('generatorcustom', 'c') + +creator = find_program('gen.py') +catter = find_program('catter.py') + +gen = generator(creator, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) + +hs = gen.process('res1.txt', 'res2.txt') + +all_headers_in_one = custom_target('alltogether', + input : hs, + output : 'alltogether.h', + command : [catter, '@INPUT@', '@OUTPUT@']) + +executable('proggie', 'main.c', hs) diff --git a/test cases/common/113 generatorcustom/res1.txt b/test cases/common/113 generatorcustom/res1.txt new file mode 100644 index 000000000..6487c56ba --- /dev/null +++ b/test cases/common/113 generatorcustom/res1.txt @@ -0,0 +1 @@ +res1 diff --git a/test cases/common/113 generatorcustom/res2.txt b/test cases/common/113 generatorcustom/res2.txt new file mode 100644 index 000000000..0a8879d51 --- /dev/null +++ b/test cases/common/113 generatorcustom/res2.txt @@ -0,0 +1 @@ +res2