aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-12-10 14:23:31 +0200
committerGitHub <noreply@github.com>2017-12-10 14:23:31 +0200
commit5ff9e05c8bf05304b80a1c21cbbc11f4d5269ff0 (patch)
treebcda526499a6cf39ae1fba017b4dd8f9aa073956 /mesonbuild/build.py
parent2c4e7ebb9b8567ebe198b2d436963dacf667a093 (diff)
parent664771bb534b007127786e62cb43bac0cb305f93 (diff)
downloadmeson-5ff9e05c8bf05304b80a1c21cbbc11f4d5269ff0.zip
meson-5ff9e05c8bf05304b80a1c21cbbc11f4d5269ff0.tar.gz
meson-5ff9e05c8bf05304b80a1c21cbbc11f4d5269ff0.tar.bz2
Merge pull request #2697 from mesonbuild/custom-target-depends-serialize
custom target: Consider all build depends while serializing
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 8eb95dc..7757300 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1549,6 +1549,24 @@ class CustomTarget(Target):
deps.append(c)
return deps
+ def get_transitive_build_target_deps(self):
+ '''
+ Recursively fetch the build targets that this custom target depends on,
+ whether through `command:`, `depends:`, or `sources:` The recursion is
+ only performed on custom targets.
+ This is useful for setting PATH on Windows for finding required DLLs.
+ F.ex, if you have a python script that loads a C module that links to
+ other DLLs in your project.
+ '''
+ bdeps = set()
+ deps = self.get_target_dependencies()
+ for d in deps:
+ if isinstance(d, BuildTarget):
+ bdeps.add(d)
+ elif isinstance(d, CustomTarget):
+ bdeps.update(d.get_transitive_build_target_deps())
+ return bdeps
+
def flatten_command(self, cmd):
cmd = listify(cmd, unholder=True)
final_cmd = []