diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-09-25 13:46:07 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-09-27 22:01:24 +0300 |
commit | dda5e8cadbfdeee3267b1a0943c014e06bcd0100 (patch) | |
tree | 049a70c550729d722e23c67d8312c2eaa820da6f /mesonbuild/backend/ninjabackend.py | |
parent | dfc2b75ee2dba3245ac23bb3d7f0156e47773ed5 (diff) | |
download | meson-dda5e8cadbfdeee3267b1a0943c014e06bcd0100.zip meson-dda5e8cadbfdeee3267b1a0943c014e06bcd0100.tar.gz meson-dda5e8cadbfdeee3267b1a0943c014e06bcd0100.tar.bz2 |
Allow CustomTarget's to be indexed
This allows a CustomTarget to be indexed, and the resulting indexed
value (a CustomTargetIndex type), to be used as a source in other
targets. This will confer a dependency on the original target, but only
inserts the source file returning by index the original target's
outputs. This can allow a CustomTarget that creates both a header and a
code file to have it's outputs split, for example.
Fixes #1470
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 41b93cb..d2ba49f 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -245,7 +245,7 @@ int dummy; header_deps = [] # XXX: Why don't we add deps to CustomTarget headers here? for genlist in target.get_generated_sources(): - if isinstance(genlist, build.CustomTarget): + if isinstance(genlist, (build.CustomTarget, build.CustomTargetIndex)): continue for src in genlist.get_outputs(): if self.environment.is_header(src): @@ -1761,10 +1761,11 @@ rule FORTRAN_DEP_HACK outfile.write('\n') def generate_generator_list_rules(self, target, outfile): - # CustomTargets have already written their rules, - # so write rules for GeneratedLists here + # CustomTargets have already written their rules and + # CustomTargetIndexes don't actually get generated, so write rules for + # GeneratedLists here for genlist in target.get_generated_sources(): - if isinstance(genlist, build.CustomTarget): + if isinstance(genlist, (build.CustomTarget, build.CustomTargetIndex)): continue self.generate_genlist_for_target(genlist, target, outfile) @@ -2013,7 +2014,7 @@ rule FORTRAN_DEP_HACK # Generator output goes into the target private dir which is # already in the include paths list. Only custom targets have their # own target build dir. - if not isinstance(i, build.CustomTarget): + if not isinstance(i, (build.CustomTarget, build.CustomTargetIndex)): continue idir = self.get_target_dir(i) if idir not in custom_target_include_dirs: |