aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-01 11:44:23 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-06-03 20:37:27 +0300
commitd6407445b9aabfa90b23ef1da6b0e903b4e6b9e0 (patch)
tree6aef2ef5d54ffbcae90fb26c364bd3b488a9483a /mesonbuild/backend/backends.py
parent93f04033c1387519038998584c013ce60bf5301d (diff)
downloadmeson-d6407445b9aabfa90b23ef1da6b0e903b4e6b9e0.zip
meson-d6407445b9aabfa90b23ef1da6b0e903b4e6b9e0.tar.gz
meson-d6407445b9aabfa90b23ef1da6b0e903b4e6b9e0.tar.bz2
backend: refactor get_custom_target_provided_libraries
the problem here is, that get_custom_target_provided_libraries iterated over all generated sources of a target. In each output we check if this is a library or not. In projects like EFL we have added a lot of generated target to many different targets, so the iterating of the output is rather consistent, with this commit we drop from 19% of the time spending in get_custom_target_provided_libraries down to 3.51%.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index d10e1e9..a044ab5 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -873,14 +873,22 @@ class Backend:
result[dep.get_id()] = dep
return result
+ @lru_cache(maxsize=None)
+ def get_custom_target_provided_by_generated_source(self, generated_source):
+ libs = []
+ for f in generated_source.get_outputs():
+ if self.environment.is_library(f):
+ libs.append(os.path.join(self.get_target_dir(generated_source), f))
+ return libs
+
+ @lru_cache(maxsize=None)
def get_custom_target_provided_libraries(self, target):
libs = []
for t in target.get_generated_sources():
if not isinstance(t, build.CustomTarget):
continue
- for f in t.get_outputs():
- if self.environment.is_library(f):
- libs.append(os.path.join(self.get_target_dir(t), f))
+ l = self.get_custom_target_provided_by_generated_source(t)
+ libs = libs + l
return libs
def is_unity(self, target):