Add test case for generated headers used through a dependency.

pull/3705/head
Jussi Pakkanen 7 years ago
parent d9efee01d0
commit e581a8937f
  1. 1
      test cases/common/179 source in dep/generated/funname
  2. 17
      test cases/common/179 source in dep/generated/genheader.py
  3. 5
      test cases/common/179 source in dep/generated/main.c
  4. 12
      test cases/common/179 source in dep/generated/meson.build
  5. 2
      test cases/common/179 source in dep/meson.build

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import sys
ifile = sys.argv[1]
ofile = sys.argv[2]
templ = '''#pragma once
int %s() {
return 42;
}
'''
funname = open(ifile).readline().strip()
open(ofile, 'w').write(templ % funname)

@ -0,0 +1,5 @@
#include"funheader.h"
int main(int argc, char **argv) {
return my_wonderful_function() != 42;
}

@ -0,0 +1,12 @@
fp = find_program('genheader.py')
genh = custom_target('genh',
input : 'funname',
output : 'funheader.h',
command : [fp, '@INPUT@', '@OUTPUT@'])
dep = declare_dependency(sources : [genh])
e = executable('genuser', 'main.c',
dependencies : dep)
test('genuser', e)

@ -4,3 +4,5 @@ dep = declare_dependency(sources : 'foo.c')
executable('bar', 'bar.cpp',
dependencies : dep)
subdir('generated')

Loading…
Cancel
Save