Multiple generated sources in one target now work.

pull/15/head
Jussi Pakkanen 10 years ago
parent 5d17e417b4
commit 154dc83973
  1. 30
      ninjabackend.py
  2. 1
      test cases/common/65 multiple generators/data2.dat
  3. 6
      test cases/common/65 multiple generators/main.cpp
  4. 13
      test cases/common/65 multiple generators/meson.build
  5. 19
      test cases/common/65 multiple generators/mygen.py
  6. 1
      test cases/common/65 multiple generators/subdir/data.dat
  7. 4
      test cases/common/65 multiple generators/subdir/meson.build

@ -211,22 +211,22 @@ class NinjaBackend(backends.Backend):
# people generate files with weird suffixes (.inc, .fh) that they then include
# in their source files.
header_deps.append(RawFilename(src))
break # just to cut down on indentation size
for src in gensource.get_outfilelist():
if self.environment.is_object(src):
obj_list.append(os.path.join(self.get_target_dir(target), target.get_basename() + '.dir', src))
elif not self.environment.is_header(src):
if is_unity:
if '/' in src:
rel_src = src
else:
for src in gensource.get_outfilelist():
if self.environment.is_object(src):
obj_list.append(os.path.join(self.get_target_dir(target), target.get_basename() + '.dir', src))
elif not self.environment.is_header(src):
if is_unity:
if '/' in src:
rel_src = src
else:
rel_src = os.path.join(self.get_target_private_dir(target), src)
unity_deps.append(rel_src)
abs_src = os.path.join(self.environment.get_build_dir(), rel_src)
unity_src.append(abs_src)
else:
rel_src = os.path.join(self.get_target_private_dir(target), src)
unity_deps.append(rel_src)
abs_src = os.path.join(self.environment.get_build_dir(), rel_src)
unity_src.append(abs_src)
else:
obj_list.append(self.generate_single_compile(target, outfile, src, True,
header_deps=header_deps))
obj_list.append(self.generate_single_compile(target, outfile, src, True,
header_deps=header_deps))
src_list = []
for src in gen_src_deps:
src_list.append(src)

@ -0,0 +1,6 @@
#include"source1.h"
#include"source2.h"
int main(int argc, char **argv) {
return func1() + func2();
}

@ -0,0 +1,13 @@
project('trickier generator', 'cpp')
comp = find_program('mygen.py')
subdir('subdir')
generated2 = custom_target('generated2',
output : ['source2.h', 'source2.cpp'],
input : 'data2.dat',
command : [comp, '@INPUT0@', meson.current_build_dir()])
exe = executable('prog', 'main.cpp', generated, generated2,
include_directories : include_directories('subdir', '.'))
test('generated test', exe)

@ -0,0 +1,19 @@
#!/usr/bin/python3
import sys, os
if len(sys.argv) != 3:
print("You is fail.")
sys.exit(1)
val = open(sys.argv[1]).read().strip()
outdir = sys.argv[2]
outhdr = os.path.join(outdir, 'source%s.h' % val)
outsrc = os.path.join(outdir, 'source%s.cpp' % val)
open(outhdr, 'w').write('int func%s();\n' % val)
open(outsrc, 'w').write('''int func%s() {
return 0;
}
''' % val)

@ -0,0 +1,4 @@
generated = custom_target('generated',
output : ['source1.h', 'source1.cpp'],
input : 'data.dat',
command : [comp, '@INPUT0@', meson.current_build_dir()])
Loading…
Cancel
Save