diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-10-15 04:37:16 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-10-19 20:46:04 +0530 |
commit | 23b060f0aa64d59ab6636964f9c308d6c0d2bebc (patch) | |
tree | 9a6e4d64dd6ae7cdbe39cdf5bd28602dbf1f908f /mesonbuild/backend/backends.py | |
parent | 092c593acd4b514b23bcb7380156a0dde09b284a (diff) | |
download | meson-23b060f0aa64d59ab6636964f9c308d6c0d2bebc.zip meson-23b060f0aa64d59ab6636964f9c308d6c0d2bebc.tar.gz meson-23b060f0aa64d59ab6636964f9c308d6c0d2bebc.tar.bz2 |
Ninja: Consolidate generated sources handling
Pre-calculate the output directory for GeneratedList and CustomTarget so
we can directly use the same code for both while compiling C/C++ files
and headers.
There is no reason to have separate branches for GeneratedList and
CustomTarget since both can be used in almost exactly the same way for
generating sources.
This is going to used next for adding generated sources support to Vala.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 1f16778..0eb4c6e 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -140,6 +140,19 @@ class Backend(): dirname = os.path.join(self.environment.get_build_dir(), self.get_target_private_dir(target)) return dirname + def get_target_generated_dir(self, target, gensrc, src): + """ + Takes a BuildTarget, a generator source (CustomTarget or GeneratedList), + and a generated source filename. + Returns the full path of the generated source relative to the build root + """ + # CustomTarget generators output to the build dir of the CustomTarget + if isinstance(gensrc, build.CustomTarget): + return os.path.join(self.get_target_dir(gensrc), src) + # GeneratedList generators output to the private build directory of the + # target that the GeneratedList is used in + return os.path.join(self.get_target_private_dir(target), src) + def generate_unity_files(self, target, unity_src): langlist = {} abs_files = [] |