diff options
12 files changed, 73 insertions, 13 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 668d6c4..cdffb76 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1557,7 +1557,7 @@ rule FORTRAN_DEP_HACK else: sole_output = '' curfile = infilelist[i] - infilename = os.path.join(self.build_to_src, curfile) + infilename = curfile.rel_to_builddir(self.build_to_src) outfiles = genlist.get_outputs_for(curfile) outfiles = [os.path.join(self.get_target_private_dir(target), of) for of in outfiles] if generator.depfile is None: diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 7e6831a..137e9ae 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -121,7 +121,7 @@ class Vs2010Backend(backends.Backend): else: sole_output = '' curfile = infilelist[i] - infilename = os.path.join(self.environment.get_source_dir(), curfile) + infilename = os.path.join(down, curfile.rel_to_builddir(self.build_to_src)) outfiles_rel = genlist.get_outputs_for(curfile) outfiles = [os.path.join(target_private_dir, of) for of in outfiles_rel] generator_output_files += outfiles diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 91815fa..2ca1404 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -932,9 +932,11 @@ class Generator(): def process_files(self, name, files, state, extra_args=[]): output = GeneratedList(self, extra_args=extra_args) for f in files: - if not isinstance(f, str): - raise InvalidArguments('{} arguments must be strings.'.format(name)) - output.add_file(os.path.join(state.subdir, f)) + if isinstance(f, str): + f = File.from_source_file(state.environment.source_dir, state.subdir, f) + elif not isinstance(f, File): + raise InvalidArguments('{} arguments must be strings or files not {!r}.'.format(name, f)) + output.add_file(f) return output @@ -952,7 +954,7 @@ class GeneratedList(): def add_file(self, newfile): self.infilelist.append(newfile) - outfiles = self.generator.get_base_outnames(newfile) + outfiles = self.generator.get_base_outnames(newfile.fname) self.outfilelist += outfiles self.outmap[newfile] = outfiles diff --git a/mesontest.py b/mesontest.py index 9c7559d..e334a46 100755 --- a/mesontest.py +++ b/mesontest.py @@ -295,8 +295,12 @@ class TestHarness: write_json_log(jsonlogfile, name, result) def print_summary(self, logfile, jsonlogfile): - msg = 'Test summary: %d OK, %d FAIL, %d SKIP, %d TIMEOUT' \ - % (self.success_count, self.fail_count, self.skip_count, self.timeout_count) + msg = ''' +OK: %4d +FAIL: %4d +SKIP: %4d +TIMEOUT: %4d +''' % (self.success_count, self.fail_count, self.skip_count, self.timeout_count) print(msg) if logfile: logfile.write(msg) diff --git a/test cases/common/126 llvm ir and assembly/meson.build b/test cases/common/126 llvm ir and assembly/meson.build index 97cce18..4ce4636 100644 --- a/test cases/common/126 llvm ir and assembly/meson.build +++ b/test cases/common/126 llvm ir and assembly/meson.build @@ -1,5 +1,8 @@ project('llvm-ir', 'c', 'cpp') +cpu = host_machine.cpu_family() +supported_cpus = ['arm', 'x86', 'x86_64'] + foreach lang : ['c', 'cpp'] cc = meson.get_compiler(lang) cc_id = cc.get_id() @@ -20,7 +23,6 @@ foreach lang : ['c', 'cpp'] uscore_args = [] message('underscore is NOT prefixed') endif - cpu = host_machine.cpu_family() square_base = 'square-' + cpu square_impl = square_base + '.S' # MSVC cannot directly compile assembly files, so we pass it through the @@ -46,9 +48,12 @@ foreach lang : ['c', 'cpp'] input : square_preproc, output : lang + square_base + '.obj', command : [ml, '/Fo', '@OUTPUT@', '/c', '@INPUT@']) - endif - e = executable('square_asm_' + lang, square_impl, 'main.' + lang, - c_args : uscore_args, cpp_args : uscore_args) - test('test ASM square' + lang, e) + if supported_cpus.contains(cpu) + e = executable('square_asm_' + lang, square_impl, 'main.' + lang, + c_args : uscore_args, cpp_args : uscore_args) + test('test ASM square' + lang, e) + elif cc_id != 'clang' + error('MESON_SKIP_TEST: Unsupported cpu: "' + cpu + '", and LLVM not found') + endif endforeach diff --git a/test cases/common/133 configure file in generator/inc/confdata.in b/test cases/common/133 configure file in generator/inc/confdata.in new file mode 100644 index 0000000..e44cdea --- /dev/null +++ b/test cases/common/133 configure file in generator/inc/confdata.in @@ -0,0 +1 @@ +@VALUE@ diff --git a/test cases/common/133 configure file in generator/inc/meson.build b/test cases/common/133 configure file in generator/inc/meson.build new file mode 100644 index 0000000..05d2dcb --- /dev/null +++ b/test cases/common/133 configure file in generator/inc/meson.build @@ -0,0 +1,6 @@ +cdata = configuration_data() +cdata.set('VALUE', '42') + +cfile = configure_file(input : 'confdata.in', +output : 'confdata', +configuration : cdata) diff --git a/test cases/common/133 configure file in generator/meson.build b/test cases/common/133 configure file in generator/meson.build new file mode 100644 index 0000000..e1c26b6 --- /dev/null +++ b/test cases/common/133 configure file in generator/meson.build @@ -0,0 +1,4 @@ +project('conf file in generator', 'c') + +subdir('inc') +subdir('src') diff --git a/test cases/common/133 configure file in generator/src/gen.py b/test cases/common/133 configure file in generator/src/gen.py new file mode 100755 index 0000000..99b7cdd --- /dev/null +++ b/test cases/common/133 configure file in generator/src/gen.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +ifile = sys.argv[1] +ofile = sys.argv[2] + +with open(ifile, 'r') as f: + resval = f.readline().strip() + +templ = '#define RESULT (%s)\n' +with open(ofile, 'w') as f: + f.write(templ % (resval, )) diff --git a/test cases/common/133 configure file in generator/src/main.c b/test cases/common/133 configure file in generator/src/main.c new file mode 100644 index 0000000..54f4f57 --- /dev/null +++ b/test cases/common/133 configure file in generator/src/main.c @@ -0,0 +1,17 @@ +#include<stdio.h> + +#include"confdata.h" +#if RESULT != 42 +#error Configuration RESULT is not defined correctly +#endif + +#undef RESULT + +#include"source.h" +#if RESULT != 23 +#error Source RESULT is not defined correctly +#endif + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/133 configure file in generator/src/meson.build b/test cases/common/133 configure file in generator/src/meson.build new file mode 100644 index 0000000..2fb804e --- /dev/null +++ b/test cases/common/133 configure file in generator/src/meson.build @@ -0,0 +1,7 @@ +compiler = find_program('gen.py') +gen = generator(compiler, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) +hs = gen.process(cfile, files('source')) + +executable('proggie', 'main.c', hs) diff --git a/test cases/common/133 configure file in generator/src/source b/test cases/common/133 configure file in generator/src/source new file mode 100644 index 0000000..4099407 --- /dev/null +++ b/test cases/common/133 configure file in generator/src/source @@ -0,0 +1 @@ +23 |