| 1 |
project('generatorcustom', 'c') |
| 2 |
|
| 3 |
creator = find_program('gen.py') |
| 4 |
catter = find_program('catter.py') |
| 5 |
gen_resx = find_program('gen-resx.py') |
| 6 |
|
| 7 |
gen = generator(creator, |
| 8 |
output: '@[email protected]', |
| 9 |
arguments : ['@INPUT@', '@OUTPUT@']) |
| 10 |
|
| 11 |
res3 = custom_target('gen-res3', |
| 12 |
output : 'res3.txt', |
| 13 |
command : [gen_resx, '@OUTPUT@', '3']) |
| 14 |
|
| 15 |
res4 = custom_target('gen-res4', |
| 16 |
output : 'res4.txt', |
| 17 |
command : [gen_resx, '@OUTPUT@', '4']) |
| 18 |
|
| 19 |
hs = gen.process('res1.txt', 'res2.txt', res3, res4[0]) |
| 20 |
|
| 21 |
allinone = custom_target('alltogether', |
| 22 |
input : hs, |
| 23 |
output : 'alltogether.h', |
| 24 |
command : [catter, '@INPUT@', '@OUTPUT@']) |
| 25 |
|
| 26 |
proggie = executable('proggie', 'main.c', allinone) |
| 27 |
|
| 28 |
test('proggie', proggie) |
| 29 |
|
| 30 |
# specifically testing that cross binaries are run with an exe_wrapper |
| 31 |
if meson.can_run_host_binaries() |
| 32 |
gen_tool = executable('generator', 'gen.c', native : false) |
| 33 |
|
| 34 |
c_gen = generator( |
| 35 |
gen_tool, |
| 36 |
output : '@[email protected]', |
| 37 |
arguments : ['@INPUT@', '@OUTPUT@'] |
| 38 |
) |
| 39 |
|
| 40 |
hs2 = c_gen.process('res1.txt') |
| 41 |
|
| 42 |
host_exe = executable('host_test', 'host.c', hs2, native : false) |
| 43 |
test('compiled generator', host_exe) |
| 44 |
endif |