diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-09-29 21:15:00 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-10-01 23:47:19 +0200 |
commit | c53d35aa721e3c98590ef15c82a87b01ede9f628 (patch) | |
tree | 1ffaffd4cff94ec810c5fa8188dd1f6b4d4c4421 /mesonbuild/build.py | |
parent | c38544a6ec3aaf8a160305a31684362ce7d450f9 (diff) | |
download | meson-c53d35aa721e3c98590ef15c82a87b01ede9f628.zip meson-c53d35aa721e3c98590ef15c82a87b01ede9f628.tar.gz meson-c53d35aa721e3c98590ef15c82a87b01ede9f628.tar.bz2 |
build: generate the mappings in the Targets
Before, the mappings has been created over all the links, while it
actaully only used the Shared or Static Targets. This structure now is
tree like structured and cached, thus the results can be computed a lot
faster.
The generator step generate_install is now for EFL from 6 sec. down to
0.3s. Which improves the overall build time from ~20 sec. to ~14 sec.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 9279590..9c7b6a4 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -25,7 +25,7 @@ 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 -from .compilers import is_object, clink_langs, sort_clink, lang_suffixes +from .compilers import is_object, clink_langs, sort_clink, lang_suffixes, get_macos_dylib_install_name from .interpreterbase import FeatureNew pch_kwargs = set(['c_pch', 'cpp_pch']) @@ -89,6 +89,10 @@ known_shmod_kwargs = known_build_target_kwargs known_stlib_kwargs = known_build_target_kwargs | {'pic'} known_jar_kwargs = known_exe_kwargs | {'main_class'} +@lru_cache(maxsize=None) +def get_target_macos_dylib_install_name(ld): + return get_macos_dylib_install_name(ld.prefix, ld.name, ld.suffix, ld.soversion) + class InvalidArguments(MesonException): pass @@ -692,6 +696,20 @@ class BuildTarget(Target): result += i.get_all_link_deps() return result + def get_link_deps_mapping(self, prefix, environment): + return self.get_transitive_link_deps_mapping(prefix, environment) + + @lru_cache(maxsize=None) + def get_transitive_link_deps_mapping(self, prefix, environment): + result = {} + for i in self.link_targets: + mapping = i.get_link_deps_mapping(prefix, environment) + #we are merging two dictionaries, while keeping the earlier one dominant + result_tmp = mapping.copy() + result_tmp.update(result) + result = result_tmp + return result + @lru_cache(maxsize=None) def get_link_dep_subdirs(self): result = OrderedSet() @@ -1404,6 +1422,9 @@ class StaticLibrary(BuildTarget): self.filename = self.prefix + self.name + '.' + self.suffix self.outputs = [self.filename] + def get_link_deps_mapping(self, prefix, environment): + return {} + def get_default_install_dir(self, environment): return environment.get_static_lib_dir() @@ -1453,6 +1474,18 @@ class SharedLibrary(BuildTarget): self.basic_filename_tpl = '{0.prefix}{0.name}.{0.suffix}' self.determine_filenames(is_cross, environment) + def get_link_deps_mapping(self, prefix, environment): + result = {} + mappings = self.get_transitive_link_deps_mapping(prefix, environment) + old = get_target_macos_dylib_install_name(self) + if old not in mappings: + fname = self.get_filename() + outdirs, _ = self.get_install_dir(self.environment) + new = os.path.join(prefix, outdirs[0], fname) + result.update({old: new}) + mappings.update(result) + return mappings + def get_default_install_dir(self, environment): return environment.get_shared_lib_dir() |