Merge pull request #794 from mesonbuild/allgen

A target that has only generated sources
pull/809/head
Jussi Pakkanen 8 years ago committed by GitHub
commit 5fee7331cb
  1. 5
      mesonbuild/backend/ninjabackend.py
  2. 8
      test cases/common/118 allgenerate/converter.py
  3. 6
      test cases/common/118 allgenerate/foobar.cpp.in
  4. 20
      test cases/common/118 allgenerate/meson.build

@ -264,10 +264,12 @@ int dummy;
unity_src = []
unity_deps = [] # Generated sources that must be built before compiling a Unity target.
header_deps += self.get_generated_headers(target)
generator_output_sources = [] # Needed to determine the linker
for gensource in target.get_generated_sources():
if isinstance(gensource, build.CustomTarget):
for src in gensource.output:
src = os.path.join(self.get_target_dir(gensource), src)
generator_output_sources.append(src)
if self.environment.is_source(src) and not self.environment.is_header(src):
if is_unity:
unity_deps.append(os.path.join(self.environment.get_build_dir(), RawFilename(src)))
@ -285,6 +287,7 @@ int dummy;
header_deps.append(RawFilename(src))
else:
for src in gensource.get_outfilelist():
generator_output_sources.append(src)
if self.environment.is_object(src):
obj_list.append(os.path.join(self.get_target_private_dir(target), src))
elif not self.environment.is_header(src):
@ -330,7 +333,7 @@ int dummy;
if is_unity:
for src in self.generate_unity_files(target, unity_src):
obj_list.append(self.generate_single_compile(target, outfile, src, True, unity_deps + header_deps))
linker = self.determine_linker(target, src_list)
linker = self.determine_linker(target, src_list + generator_output_sources)
elem = self.generate_link(target, outfile, outname, obj_list, linker, pch_objects)
self.generate_shlib_aliases(target, self.get_target_dir(target))
elem.write(outfile)

@ -0,0 +1,8 @@
#!/usr/bin/env python3
import sys
ifile = sys.argv[1]
ofile = sys.argv[2]
open(ofile, 'w').write(open(ifile).read())

@ -0,0 +1,6 @@
#include<stdio.h>
int main(int argc, char **argv) {
printf("I am a program.\n");
return 0;
}

@ -0,0 +1,20 @@
# Must have two languages here to exercise linker language
# selection bug
project('all sources generated', 'c', 'cpp')
comp = find_program('converter.py')
g = generator(comp,
output : '@BASENAME@.cpp',
arguments : ['@INPUT@', '@OUTPUT@'])
c = g.process('foobar.cpp.in')
prog = executable('genexe', c)
c2 = custom_target('c2gen',
output : 'c2gen.cpp',
input : 'foobar.cpp.in',
command : [comp, '@INPUT@', '@OUTPUT@'])
prog2 = executable('genexe2', c2)
Loading…
Cancel
Save