trilinos: switch to CMakePackage and minor cleanup (#2226)
This commit is contained in:

committed by
Todd Gamblin

parent
453331dba0
commit
29f81b7775
@@ -36,7 +36,7 @@
|
||||
# https://github.com/trilinos/Trilinos/issues/175
|
||||
|
||||
|
||||
class Trilinos(Package):
|
||||
class Trilinos(CMakePackage):
|
||||
"""The Trilinos Project is an effort to develop algorithms and enabling
|
||||
technologies within an object-oriented software framework for the solution
|
||||
of large-scale, complex multi-physics engineering and scientific problems.
|
||||
@@ -124,7 +124,8 @@ def variants_check(self):
|
||||
raise RuntimeError('The superlu-dist variant can only be used' +
|
||||
' with Trilinos @12.0.1:')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
self.variants_check()
|
||||
|
||||
cxx_flags = []
|
||||
@@ -157,7 +158,8 @@ def install(self, spec, prefix):
|
||||
'-DTrilinos_ENABLE_CXX11:BOOL=ON',
|
||||
'-DTPL_ENABLE_Netcdf:BOOL=ON',
|
||||
'-DTPL_ENABLE_HYPRE:BOOL=%s' % (
|
||||
'ON' if '+hypre' in spec else 'OFF')
|
||||
'ON' if '+hypre' in spec else 'OFF'),
|
||||
'-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % self.prefix
|
||||
])
|
||||
|
||||
if spec.satisfies('%intel') and spec.satisfies('@12.6.2'):
|
||||
@@ -206,11 +208,6 @@ def install(self, spec, prefix):
|
||||
'-DTrilinos_ENABLE_Fortran=ON'
|
||||
])
|
||||
|
||||
# for build-debug only:
|
||||
# options.extend([
|
||||
# '-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE'
|
||||
# ])
|
||||
|
||||
# suite-sparse related
|
||||
if '+suite-sparse' in spec:
|
||||
options.extend([
|
||||
@@ -330,12 +327,10 @@ def install(self, spec, prefix):
|
||||
options.extend([
|
||||
'-DTrilinos_ENABLE_FEI=OFF'
|
||||
])
|
||||
return options
|
||||
|
||||
with working_dir('spack-build', create=True):
|
||||
cmake('..', *options)
|
||||
make()
|
||||
make('install')
|
||||
|
||||
@CMakePackage.sanity_check('install')
|
||||
def filter_python(self):
|
||||
# When trilinos is built with Python, libpytrilinos is included
|
||||
# through cmake configure files. Namely, Trilinos_LIBRARIES in
|
||||
# TrilinosConfig.cmake contains pytrilinos. This leads to a
|
||||
@@ -343,14 +338,9 @@ def install(self, spec, prefix):
|
||||
# Trilinos to be used in any C++ code, which links executable
|
||||
# against the libraries listed in Trilinos_LIBRARIES. See
|
||||
# https://github.com/Homebrew/homebrew-science/issues/2148#issuecomment-103614509
|
||||
# A workaround it to remove PyTrilinos from the COMPONENTS_LIST :
|
||||
# A workaround is to remove PyTrilinos from the COMPONENTS_LIST :
|
||||
if '+python' in self.spec:
|
||||
filter_file(r'(SET\(COMPONENTS_LIST.*)(PyTrilinos;)(.*)',
|
||||
(r'\1\3'),
|
||||
'%s/cmake/Trilinos/TrilinosConfig.cmake' %
|
||||
prefix.lib)
|
||||
|
||||
# The shared libraries are not installed correctly on Darwin;
|
||||
# correct this
|
||||
if (sys.platform == 'darwin') and ('+shared' in spec):
|
||||
fix_darwin_install_name(prefix.lib)
|
||||
self.prefix.lib)
|
||||
|
Reference in New Issue
Block a user