aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-12-28 16:20:18 -0500
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-01-12 03:25:08 -0500
commit78b030cf19709a7c050814e2589276f6e8c06a07 (patch)
tree9ea4befb98e284a15c012bc750f7cdf8bfc50f56 /mesonbuild
parenteea067087261fbeb19ff12ee6a6def95e0141322 (diff)
downloadmeson-78b030cf19709a7c050814e2589276f6e8c06a07.zip
meson-78b030cf19709a7c050814e2589276f6e8c06a07.tar.gz
meson-78b030cf19709a7c050814e2589276f6e8c06a07.tar.bz2
Add support for Files passed to generators.
I need this for windows.compile_resources to be able to use configure_file results, but it may have other benefits.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/backend/vs2010backend.py2
-rw-r--r--mesonbuild/build.py10
3 files changed, 8 insertions, 6 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index e6f82d1..218e128 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 8fa6ada..cc33d39 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -918,9 +918,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
@@ -938,7 +940,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