|
|
|
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@'])
|
|
|
|
|
|
|
|
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,
|
|
|
|
output : 'alltogether.h',
|
|
|
|
command : [catter, '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
ninjabackend: check if target has compiler attribute
otherwise we are getting errors like:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/mesonmain.py", line 131, in run
return options.run_func(options)
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 245, in run
app.generate()
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 159, in generate
self._generate(env)
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 215, in _generate
intr.backend.generate()
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 518, in generate
self.generate_coverage_rules()
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 991, in generate_coverage_rules
self.generate_coverage_command(e, [])
File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 975, in generate_coverage_command
for compiler in target.compilers.values():
AttributeError: 'RunTarget' object has no attribute 'compilers'
This extends the 109 generatecode test case to also define a test, so
coverage can really detect something.
4 years ago
|
|
|
proggie = executable('proggie', 'main.c', allinone)
|
|
|
|
|
|
|
|
test('proggie', proggie)
|
|
|
|
|
|
|
|
# specifically testing that cross binaries are run with an exe_wrapper
|
|
|
|
if meson.can_run_host_binaries()
|
|
|
|
gen_tool = executable('generator', 'gen.c', native : false)
|
|
|
|
|
|
|
|
c_gen = generator(
|
|
|
|
gen_tool,
|
|
|
|
output : '@BASENAME@-cpp.h',
|
|
|
|
arguments : ['@INPUT@', '@OUTPUT@']
|
|
|
|
)
|
|
|
|
|
|
|
|
hs2 = c_gen.process('res1.txt')
|
|
|
|
|
|
|
|
host_exe = executable('host_test', 'host.c', hs2, native : false)
|
|
|
|
test('compiled generator', host_exe)
|
|
|
|
endif
|