aboutsummaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-04-02 16:43:35 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-04-02 16:43:35 +0300
commite87d3c07ad3943ccd7a17f01ff900136c8a394c6 (patch)
tree420377eef30264658c5b43b26cd7be7fa76efc6a /build.py
parenta3544847ca1414a23d7afe2a77848ea777bba1b0 (diff)
downloadmeson-e87d3c07ad3943ccd7a17f01ff900136c8a394c6.zip
meson-e87d3c07ad3943ccd7a17f01ff900136c8a394c6.tar.gz
meson-e87d3c07ad3943ccd7a17f01ff900136c8a394c6.tar.bz2
Can specify explicit dependencies for custom targets.
Diffstat (limited to 'build.py')
-rw-r--r--build.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/build.py b/build.py
index 8efb356..dae1270 100644
--- a/build.py
+++ b/build.py
@@ -668,11 +668,14 @@ class CustomTarget:
'command' : True,
'install' : True,
'install_dir' : True,
- 'build_always' : True}
+ 'build_always' : True,
+ 'depends' : True}
+
def __init__(self, name, subdir, kwargs):
self.name = name
self.subdir = subdir
self.dependencies = []
+ self.extra_depends = []
self.process_kwargs(kwargs)
self.extra_files = []
self.install_rpath = ''
@@ -744,6 +747,15 @@ class CustomTarget:
self.build_always = kwargs.get('build_always', False)
if not isinstance(self.build_always, bool):
raise InvalidArguments('Argument build_always must be a boolean.')
+ extra_deps = kwargs.get('depends', [])
+ if not isinstance(extra_deps, list):
+ extra_deps = [extra_deps]
+ for ed in extra_deps:
+ while hasattr(ed, 'held_object'):
+ ed = ed.held_object
+ if not isinstance(ed, CustomTarget) and not isinstance(ed, BuildTarget):
+ raise InvalidArguments('Can only depend on toplevel targets.')
+ self.extra_depends.append(ed)
def get_basename(self):
return self.name