mirror of
https://github.com/boostorg/build.git
synced 2026-02-17 13:42:14 +00:00
Fix library_path.py in BoostBuild/Python.
Patch from Georgy Gritsenko. [SVN r74912]
This commit is contained in:
@@ -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('<library>')
|
||||
sources.extend(lib_sources)
|
||||
|
||||
sources.extend(prop_set.get('<library>'))
|
||||
|
||||
# Add <library-path> properties for all searched libraries
|
||||
extra = []
|
||||
@@ -576,38 +575,41 @@ class LinkingGenerator (generators.Generator):
|
||||
search = s.search()
|
||||
extra.extend(property.Property('<library-path>', sp) for sp in search)
|
||||
|
||||
orig_xdll_path = []
|
||||
|
||||
if prop_set.get('<hardcode-dll-paths>') == ['true'] \
|
||||
and type.is_derived(self.target_types_ [0], 'EXE'):
|
||||
xdll_path = prop_set.get('<xdll-path>')
|
||||
orig_xdll_path = [ replace_grist(x, '<dll-path>') 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('<dll-path>', 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('<hardcode-dll-paths>') == ['true'] \
|
||||
and type.is_derived(self.target_types_ [0], 'EXE'):
|
||||
xdll_path = prop_set.get('<xdll-path>')
|
||||
extra.extend(property.Property('<dll-path>', sp) \
|
||||
for sp in extra_xdll_path)
|
||||
extra.extend(property.Property('<dll-path>', 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(['<xdll-path>' + 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):
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user