mesonbuild: move subdir generation along link dep generation

The problem with the earlier position of the generation code was, that
the results could not be cached, because the list of all link_deps was
overall different. However, it shared a special kind of subsets with
other build build targets.

Generating the set of subdirs that are required for linking, alongside
with the link dependencies brings the possibility of caching this.
This reduces the buildting from 1 min. in efl down to 20 sec. And
reduces the amount of 30872534 calls down.

this saves ~40 sec.
pull/4156/head
Marcel Hollerbach 6 years ago committed by Nirbheek Chauhan
parent c68460e2ee
commit 7ae3fbf88d
  1. 11
      mesonbuild/backend/backends.py
  2. 10
      mesonbuild/build.py

@ -394,12 +394,11 @@ class Backend:
return paths
def determine_rpath_dirs(self, target):
link_deps = target.get_all_link_deps()
result = OrderedSet()
for ld in link_deps:
if ld is target:
continue
result.add(self.get_target_dir(ld))
if self.environment.coredata.get_builtin_option('layout') == 'mirror':
result = target.get_link_dep_subdirs()
else:
result = OrderedSet()
result.add('meson-out')
result.update(self.rpaths_for_bundled_shared_libraries(target))
return list(result)

@ -21,7 +21,7 @@ from functools import lru_cache
from . import environment
from . import dependencies
from . import mlog
from .mesonlib import File, MesonException, listify, extract_as_list
from .mesonlib import File, MesonException, listify, extract_as_list, OrderedSet
from .mesonlib import typeslistify, stringlistify, classify_unity_sources
from .mesonlib import get_filenames_templates_dict, substitute_values
from .mesonlib import for_windows, for_darwin, for_cygwin, for_android, has_path_sep
@ -676,6 +676,14 @@ class BuildTarget(Target):
result += i.get_all_link_deps()
return result
@lru_cache(maxsize=None)
def get_link_dep_subdirs(self):
result = OrderedSet()
for i in self.link_targets:
result.add(i.get_subdir())
result.update(i.get_link_dep_subdirs())
return result
def get_custom_install_dir(self):
return self.install_dir

Loading…
Cancel
Save