suite-sparse: add a package-specific 'libs' property (#7269)

This commit is contained in:
Veselin Dobrev 2018-03-06 01:09:20 -08:00 committed by Massimiliano Culpo
parent 9c828f3068
commit 7482cf1d9f

View file

@ -95,7 +95,7 @@ def install(self, spec, prefix):
# with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk, # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk,
# even though this fix is ugly # even though this fix is ugly
'BLAS=%s' % (spec['blas'].libs.ld_flags + ( 'BLAS=%s' % (spec['blas'].libs.ld_flags + (
'-lstdc++' if '@4.5.1' in spec else '')), ' -lstdc++' if '@4.5.1' in spec else '')),
'LAPACK=%s' % spec['lapack'].libs.ld_flags, 'LAPACK=%s' % spec['lapack'].libs.ld_flags,
] ]
@ -125,3 +125,22 @@ def install(self, spec, prefix):
] ]
make('install', *make_args) make('install', *make_args)
@property
def libs(self):
"""Export the libraries of SuiteSparse.
Sample usage: spec['suite-sparse'].libs.ld_flags
spec['suite-sparse:klu,btf'].libs.ld_flags
"""
# Component libraries, ordered by dependency. Any missing components?
all_comps = ['klu', 'btf', 'umfpack', 'cholmod', 'colamd', 'amd',
'camd', 'ccolamd', 'cxsparse', 'ldl', 'rbio', 'spqr',
'suitesparseconfig']
query_parameters = self.spec.last_query.extra_parameters
comps = all_comps if not query_parameters else query_parameters
libs = find_libraries(['lib' + c for c in comps], root=self.prefix.lib,
shared=True, recursive=False)
if not libs:
return None
libs += find_system_libraries('librt')
return libs