summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVeselin Dobrev <v-dobrev@users.noreply.github.com>2018-02-19 22:11:04 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2018-02-19 22:11:04 -0800
commit95fe8f7e07011739b8d46e994dd383233835e1b4 (patch)
treea0e41d64431cd7e477d6d7cf390ab132c430a0ed
parente179883a5b18d8f781ca2c4c98396bf6d57f86df (diff)
downloadspack-95fe8f7e07011739b8d46e994dd383233835e1b4.tar.gz
spack-95fe8f7e07011739b8d46e994dd383233835e1b4.tar.bz2
spack-95fe8f7e07011739b8d46e994dd383233835e1b4.tar.xz
spack-95fe8f7e07011739b8d46e994dd383233835e1b4.zip
sundials: add the 'headers' and 'libs' properties (#7282)
* [SUNDIALS] Add the 'headers' and 'libs' properties, plus a couple of small tweaks. * [SUNDIALS] Revert incorrectly changed conflicts() directive. Fix style.
-rw-r--r--var/spack/repos/builtin/packages/sundials/package.py40
1 files changed, 37 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py
index 16cbcbe34f..73816b6224 100644
--- a/var/spack/repos/builtin/packages/sundials/package.py
+++ b/var/spack/repos/builtin/packages/sundials/package.py
@@ -216,9 +216,9 @@ class Sundials(CMakePackage):
fortran_flag = self.compiler.pic_flag
if spec.satisfies('%clang platform=darwin'):
- mpif77 = Executable(self.spec['mpi'].mpif77)
- libgfortran = LibraryList(mpif77('--print-file-name',
- 'libgfortran.a', output=str))
+ f77 = Executable(self.compiler.f77)
+ libgfortran = LibraryList(f77('--print-file-name',
+ 'libgfortran.a', output=str))
fortran_flag += ' ' + libgfortran.ld_flags
# List of CMake arguments
@@ -476,3 +476,37 @@ class Sundials(CMakePackage):
for filename in f90_files:
filter_file(os.environ['FC'], self.compiler.fc,
os.path.join(dirname, filename), **kwargs)
+
+ @property
+ def headers(self):
+ """Export the headers and defines of SUNDIALS.
+ Sample usage: spec['sundials'].headers.cpp_flags
+ """
+ # SUNDIALS headers are inside subdirectories, so we use a fake header
+ # in the include directory.
+ hdr = find(self.prefix.include.nvector, 'nvector_serial.h',
+ recursive=False)
+ return HeaderList(join_path(self.spec.prefix.include, 'fake.h')) \
+ if hdr else None
+
+ @property
+ def libs(self):
+ """Export the libraries of SUNDIALS.
+ Sample usage: spec['sundials'].libs.ld_flags
+ spec['sundials:arkode,cvode'].libs.ld_flags
+ """
+ query_parameters = self.spec.last_query.extra_parameters
+ if not query_parameters:
+ sun_libs = 'libsundials_*[!0-9]'
+ # Q: should the result be ordered by dependency?
+ else:
+ sun_libs = ['libsundials_' + p for p in query_parameters]
+ search_paths = [[self.prefix.lib, False], [self.prefix.lib64, False],
+ [self.prefix, True]]
+ is_shared = '+shared' in self.spec
+ for path, recursive in search_paths:
+ libs = find_libraries(sun_libs, root=path, shared=is_shared,
+ recursive=recursive)
+ if libs:
+ return libs
+ return None # Raise an error