Merge branch 'nioncode-vs-generator'

pull/574/head
Jussi Pakkanen 9 years ago
commit c2082146ab
  1. 13
      mesonbuild/backend/backends.py
  2. 13
      mesonbuild/backend/ninjabackend.py
  3. 5
      mesonbuild/backend/vs2010backend.py
  4. 8
      test cases/common/59 object generator/meson.build
  5. 3
      test cases/common/59 object generator/prog.c
  6. 3
      test cases/common/59 object generator/source3.c

@ -433,6 +433,19 @@ class Backend():
final_args.append(a)
return final_args
def replace_outputs(self, args, private_dir, output_list):
newargs = []
regex = re.compile('@OUTPUT(\d+)@')
for arg in args:
m = regex.search(arg)
while m is not None:
index = int(m.group(1))
src = '@OUTPUT%d@' % index
arg = arg.replace(src, os.path.join(private_dir, output_list[index]))
m = regex.search(arg)
newargs.append(arg)
return newargs
def get_custom_target_provided_libraries(self, target):
libs = []
for t in target.get_generated_sources():

@ -1286,19 +1286,6 @@ rule FORTRAN_DEP_HACK
self.generate_pch_rule_for(langname, compiler, qstr, True, outfile)
outfile.write('\n')
def replace_outputs(self, args, private_dir, output_list):
newargs = []
regex = re.compile('@OUTPUT(\d+)@')
for arg in args:
m = regex.search(arg)
while m is not None:
index = int(m.group(1))
src = '@OUTPUT%d@' % index
arg = arg.replace(src, os.path.join(private_dir, output_list[index]))
m = regex.search(arg)
newargs.append(arg)
return newargs
def generate_custom_generator_rules(self, target, outfile):
for genlist in target.get_generated_sources():
if isinstance(genlist, build.CustomTarget):

@ -96,11 +96,12 @@ class Vs2010Backend(backends.Backend):
sole_output = ''
curfile = infilelist[i]
infilename = os.path.join(self.environment.get_source_dir(), curfile)
outfiles = genlist.get_outputs_for(curfile)
outfiles = [os.path.join(target_private_dir, of) for of in outfiles]
outfiles_rel = genlist.get_outputs_for(curfile)
outfiles = [os.path.join(target_private_dir, of) for of in outfiles_rel]
generator_output_files += outfiles
args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)\
for x in base_args]
args = self.replace_outputs(args, target_private_dir, outfiles_rel)
args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir()).replace("@BUILD_DIR@", target_private_dir)
for x in args]
fullcmd = exe_arr + self.replace_extra_args(args, genlist)

@ -20,6 +20,12 @@ gen = generator(python,
generated = gen.process(['source.c', 'source2.c'])
e = executable('prog', 'prog.c', generated)
# Generate an object file with indexed OUTPUT replacement.
gen2 = generator(python,
output : outputname,
arguments : [comp, cc, '@INPUT@', '@OUTPUT0@'])
generated2 = gen2.process(['source3.c'])
e = executable('prog', 'prog.c', generated, generated2)
test('objgen', e)

@ -1,6 +1,7 @@
int func1_in_obj();
int func2_in_obj();
int func3_in_obj();
int main(int argc, char **argv) {
return func1_in_obj() + func2_in_obj();
return func1_in_obj() + func2_in_obj() + func3_in_obj();
}

@ -0,0 +1,3 @@
int func3_in_obj() {
return 0;
}
Loading…
Cancel
Save