diff --git a/src/tools/builtin.py b/src/tools/builtin.py index 31a7bffee..5c32903c6 100644 --- a/src/tools/builtin.py +++ b/src/tools/builtin.py @@ -565,9 +565,8 @@ class LinkingGenerator (generators.Generator): generators.Generator.__init__ (self, id, composing, source_types, target_types_and_names, requirements) def run (self, project, name, prop_set, sources): - - lib_sources = prop_set.get('') - sources.extend(lib_sources) + + sources.extend(prop_set.get('')) # Add properties for all searched libraries extra = [] @@ -576,38 +575,41 @@ class LinkingGenerator (generators.Generator): search = s.search() extra.extend(property.Property('', sp) for sp in search) - orig_xdll_path = [] - - if prop_set.get('') == ['true'] \ - and type.is_derived(self.target_types_ [0], 'EXE'): - xdll_path = prop_set.get('') - orig_xdll_path = [ replace_grist(x, '') for x in xdll_path ] - # It's possible that we have libraries in sources which did not came - # from 'lib' target. For example, libraries which are specified - # just as filenames as sources. We don't have xdll-path properties - # for such target, but still need to add proper dll-path properties. - for s in sources: + # It's possible that we have libraries in sources which did not came + # from 'lib' target. For example, libraries which are specified + # just as filenames as sources. We don't have xdll-path properties + # for such target, but still need to add proper dll-path properties. + extra_xdll_path = [] + for s in sources: if type.is_derived (s.type (), 'SHARED_LIB') and not s.action (): # Unfortunately, we don't have a good way to find the path # to a file, so use this nasty approach. p = s.project() - location = path.root(s.name(), p.get('source-location')) - xdll_path.append(path.parent(location)) - - extra.extend(property.Property('', sp) for sp in xdll_path) + location = path.root(s.name(), p.get('source-location')[0]) + extra_xdll_path.append(os.path.dirname(location)) + + # Hardcode DLL paths only when linking executables. + # Pros: do not need to relink libraries when installing. + # Cons: "standalone" libraries (plugins, python extensions) can not + # hardcode paths to dependent libraries. + if prop_set.get('') == ['true'] \ + and type.is_derived(self.target_types_ [0], 'EXE'): + xdll_path = prop_set.get('') + extra.extend(property.Property('', sp) \ + for sp in extra_xdll_path) + extra.extend(property.Property('', sp) \ + for sp in xdll_path) if extra: - prop_set = prop_set.add_raw (extra) - + prop_set = prop_set.add_raw (extra) result = generators.Generator.run(self, project, name, prop_set, sources) - + if result: ur = self.extra_usage_requirements(result, prop_set) - ur = ur.add(property_set.create(orig_xdll_path)) + ur = ur.add(property_set.create(['' + p for p in extra_xdll_path])) else: return None - - return(ur, result) + return (ur, result) def extra_usage_requirements (self, created_targets, prop_set): diff --git a/src/tools/stage.py b/src/tools/stage.py index 25eccbe51..90d3c0f97 100644 --- a/src/tools/stage.py +++ b/src/tools/stage.py @@ -224,7 +224,7 @@ def symlink(name, project, source, ps): return virtual_target.FileTarget(name, source.type(), project, a, exact=True) def relink_file(project, source, ps): - action = source.action() + action = source[0].action() cloned_action = virtual_target.clone_action(action, project, "", ps) targets = cloned_action.targets() # We relink only on Unix, where exe or shared lib is always a single file.