From 4e5efd3897c5bd03fbcd32fcf43c82879ca8caf4 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Thu, 25 Feb 2021 19:53:41 +0100 Subject: Allow custom target output to be processed by generators --- test cases/common/106 generatorcustom/gen-resx.py | 9 +++++++++ test cases/common/106 generatorcustom/main.c | 5 +++-- test cases/common/106 generatorcustom/meson.build | 12 ++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 test cases/common/106 generatorcustom/gen-resx.py (limited to 'test cases') diff --git a/test cases/common/106 generatorcustom/gen-resx.py b/test cases/common/106 generatorcustom/gen-resx.py new file mode 100755 index 0000000..7d31ade --- /dev/null +++ b/test cases/common/106 generatorcustom/gen-resx.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import sys + +ofile = sys.argv[1] +num = sys.argv[2] + +with open(ofile, 'w') as f: + f.write('res{}\n'.format(num)) diff --git a/test cases/common/106 generatorcustom/main.c b/test cases/common/106 generatorcustom/main.c index 4b6857d..153dc12 100644 --- a/test cases/common/106 generatorcustom/main.c +++ b/test cases/common/106 generatorcustom/main.c @@ -1,7 +1,8 @@ -#include +#include -#include"alltogether.h" +#include "alltogether.h" int main(void) { + printf("%s - %s - %s - %s\n", res1, res2, res3, res4); return 0; } diff --git a/test cases/common/106 generatorcustom/meson.build b/test cases/common/106 generatorcustom/meson.build index b3f50bb..2128d21 100644 --- a/test cases/common/106 generatorcustom/meson.build +++ b/test cases/common/106 generatorcustom/meson.build @@ -2,12 +2,21 @@ project('generatorcustom', 'c') creator = find_program('gen.py') catter = find_program('catter.py') +gen_resx = find_program('gen-resx.py') gen = generator(creator, output: '@BASENAME@.h', arguments : ['@INPUT@', '@OUTPUT@']) -hs = gen.process('res1.txt', 'res2.txt') +res3 = custom_target('gen-res3', + output : 'res3.txt', + command : [gen_resx, '@OUTPUT@', '3']) + +res4 = custom_target('gen-res4', + output : 'res4.txt', + command : [gen_resx, '@OUTPUT@', '4']) + +hs = gen.process('res1.txt', 'res2.txt', res3, res4[0]) allinone = custom_target('alltogether', input : hs, @@ -17,4 +26,3 @@ allinone = custom_target('alltogether', proggie = executable('proggie', 'main.c', allinone) test('proggie', proggie) - -- cgit v1.1