From 9ea9a4063a441e7a07043aabb24fadcf036359a9 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 14 Feb 2018 03:26:15 +0100 Subject: fftw package: improved libs implementation (#7212) Add query parameters to retrieve libraries based on precision (e.g. double or quad) and mpi/openmp support. --- var/spack/repos/builtin/packages/fftw/package.py | 33 ++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index b047574f82..87dc0cbba3 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -24,6 +24,8 @@ ############################################################################## from spack import * +import llnl.util.lang + class Fftw(AutotoolsPackage): """FFTW is a C subroutine library for computing the discrete Fourier @@ -88,8 +90,35 @@ class Fftw(AutotoolsPackage): @property def libs(self): - result = find_libraries(['libfftw3'], root=self.prefix, recurse=True) - return result + + # Reduce repetitions of entries + query_parameters = list(llnl.util.lang.dedupe( + self.spec.last_query.extra_parameters + )) + + # List of all the suffixes associated with float precisions + precisions = [ + ('float', 'f'), + ('double', ''), + ('long_double', 'l'), + ('quad', 'q') + ] + + # Retrieve the correct suffixes, or use double as a default + suffixes = [v for k, v in precisions if k in query_parameters] or [''] + + # Construct the list of libraries that needs to be found + libraries = [] + for sfx in suffixes: + if 'mpi' in query_parameters and '+mpi' in self.spec: + libraries.append('libfftw3' + sfx + '_mpi') + + if 'openmp' in query_parameters and '+openmp' in self.spec: + libraries.append('libfftw3' + sfx + '_omp') + + libraries.append('libfftw3' + sfx) + + return find_libraries(libraries, root=self.prefix, recurse=True) def autoreconf(self, spec, prefix): if '+pfft_patches' in spec: -- cgit v1.2.3-70-g09d2