aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-04-19 15:32:24 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2017-05-08 20:59:46 +0200
commit7053d9abfdef64c1f507173609fad4c9866441eb (patch)
tree0eaa78e007a8c69066dfa152490edc64e01da636 /mesonbuild/backend/ninjabackend.py
parentccab7d64f474f00e010b2c6601e63d8034c5552a (diff)
downloadmeson-7053d9abfdef64c1f507173609fad4c9866441eb.zip
meson-7053d9abfdef64c1f507173609fad4c9866441eb.tar.gz
meson-7053d9abfdef64c1f507173609fad4c9866441eb.tar.bz2
Allow link_depends to take strings, Files or generated objects. Closes #1172
Currently only strings can be passed to the link_depends argument of executable and *library, which solves many cases, but not every one. This patch allows generated sources and Files to be passed as well. On the implementation side, it uses a helper method to keep the more complex logic separated from the __init__ method. This also requires that Targets set their link_depends paths as Files, and the backend is responsible for converting to strings when it wants them. This adds tests for the following cases: - Using a file in a subdir - Using a configure_file as an input - Using a custom_target as an input It does not support using a generator as an input, since currently that would require calling the generator twice, once for the -Wl argument, and once for the link_depends. Also updates the docs.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-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 f4c78a1..bbae408 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2316,8 +2316,8 @@ rule FORTRAN_DEP_HACK
# current compiler.
commands = commands.to_native()
dep_targets = [self.get_dependency_filename(t) for t in dependencies]
- dep_targets += [os.path.join(self.environment.source_dir,
- target.subdir, t) for t in target.link_depends]
+ dep_targets.extend([self.get_dependency_filename(t)
+ for t in target.link_depends])
elem = NinjaBuildElement(self.all_outputs, outname, linker_rule, obj_list)
elem.add_dep(dep_targets + custom_target_libraries)
elem.add_item('LINK_ARGS', commands)
@@ -2335,6 +2335,12 @@ rule FORTRAN_DEP_HACK
def get_dependency_filename(self, t):
if isinstance(t, build.SharedLibrary):
return os.path.join(self.get_target_private_dir(t), self.get_target_filename(t) + '.symbols')
+ elif isinstance(t, mesonlib.File):
+ if t.is_built:
+ return t.relative_name()
+ else:
+ return t.absolute_path(self.environment.get_source_dir(),
+ self.environment.get_build_dir())
return self.get_target_filename(t)
def generate_shlib_aliases(self, target, outdir):