aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2017-10-01 15:45:08 +0200
committerCorentin Noël <corentin@elementary.io>2017-10-02 01:59:41 +0200
commitac8d5f215640179c6135a87f1e089587ae7fb102 (patch)
tree041a41157f1827c6fc633e19dfd3def49ed7b2e4 /mesonbuild
parentae532c807c61afa51c17222d284475c1984e0ec8 (diff)
downloadmeson-ac8d5f215640179c6135a87f1e089587ae7fb102.zip
meson-ac8d5f215640179c6135a87f1e089587ae7fb102.tar.gz
meson-ac8d5f215640179c6135a87f1e089587ae7fb102.tar.bz2
Allow different directories for Vala files
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 2e6e351..e00dd5e 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1131,9 +1131,14 @@ int dummy;
# file is outside the build directory, the path components will be
# stripped and just the basename will be used.
if isinstance(gensrc, (build.CustomTarget, build.GeneratedList)) or gensrc.is_built:
- vala_c_file = os.path.splitext(vala_file)[0] + '.c'
- else:
vala_c_file = os.path.splitext(os.path.basename(vala_file))[0] + '.c'
+ else:
+ realpath = os.path.abspath(os.path.join(self.environment.get_build_dir(), vala_file))
+ if (realpath.startswith(os.path.join(self.environment.get_source_dir(), target.get_subdir()))):
+ relpath = os.path.relpath(realpath, os.path.join(self.environment.get_source_dir(), target.get_subdir()))
+ vala_c_file = os.path.join(os.path.dirname(relpath), os.path.splitext(os.path.basename(vala_file))[0] + '.c')
+ else:
+ vala_c_file = os.path.splitext(os.path.basename(vala_file))[0] + '.c'
# All this will be placed inside the c_out_dir
vala_c_file = os.path.join(c_out_dir, vala_c_file)
vala_c_src.append(vala_c_file)
@@ -1145,6 +1150,7 @@ int dummy;
# means it will also preserve the directory components of Vala sources
# found inside the build tree (generated sources).
args += ['-d', c_out_dir]
+ args += ['-b', os.path.join(self.environment.get_source_dir(), target.get_subdir())]
if not isinstance(target, build.Executable):
# Library name
args += ['--library=' + target.name]