trilinos: explicitly use variants instead of spec for TPLs (#27221)

Fixes https://github.com/spack/spack/pull/27188#issuecomment-961212214
This commit is contained in:
Seth R. Johnson 2021-11-05 09:07:33 -04:00 committed by GitHub
parent d2c26fef46
commit 42d8e9eeb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,8 +78,8 @@ class Trilinos(CMakePackage, CudaPackage):
variant('wrapper', default=False, description="Use nvcc-wrapper for CUDA build")
# TPLs (alphabet order)
variant('boost', default=False, description='Compile with Boost')
variant('adios2', default=False, description='Enable ADIOS2')
variant('boost', default=False, description='Compile with Boost')
variant('hdf5', default=False, description='Compile with HDF5')
variant('hypre', default=False, description='Compile with Hypre preconditioner')
variant('mpi', default=True, description='Compile with MPI parallelism')
@ -556,48 +556,57 @@ def define_enable(suffix, value=None):
# ######################### TPLs #############################
# Enable TPLs based on whether they're in our spec, not whether they're
# variant names: packages/features should disable availability
tpl_dep_map = [
def define_tpl(trilinos_name, spack_name, have_dep):
options.append(define('TPL_ENABLE_' + trilinos_name, have_dep))
if not have_dep:
return
depspec = spec[spack_name]
libs = depspec.libs
options.extend([
define(trilinos_name + '_INCLUDE_DIRS', depspec.prefix.include),
define(trilinos_name + '_ROOT', depspec.prefix),
define(trilinos_name + '_LIBRARY_NAMES', libs.names),
define(trilinos_name + '_LIBRARY_DIRS', libs.directories),
])
# Enable these TPLs explicitly from variant options.
tpl_variant_map = [
('ADIOS2', 'adios2'),
('BLAS', 'blas'),
('Boost', 'boost'),
('CGNS', 'cgns'),
('CUDA', 'cuda'),
('HDF5', 'hdf5'),
('HYPRE', 'hypre'),
('MUMPS', 'mumps'),
('UMFPACK', 'suite-sparse'),
('SuperLU', 'superlu'),
('SuperLUDist', 'superlu-dist'),
('X11', 'x11'),
]
if spec.satisfies('@13.0.2:'):
tpl_variant_map.append(('STRUMPACK', 'strumpack'))
for tpl_name, var_name in tpl_variant_map:
define_tpl(tpl_name, var_name, spec.variants[var_name].value)
# Enable these TPLs based on whether they're in our spec; prefer to
# require this way so that packages/features disable availability
tpl_dep_map = [
('BLAS', 'blas'),
('CGNS', 'cgns'),
('LAPACK', 'lapack'),
('Matio', 'matio'),
('METIS', 'metis'),
('MUMPS', 'mumps'),
('Netcdf', 'netcdf-c'),
('SCALAPACK', 'scalapack'),
('SuperLU', 'superlu'),
('SuperLUDist', 'superlu-dist'),
('UMFPACK', 'suite-sparse'),
('X11', 'libx11'),
('Zlib', 'zlib'),
]
if spec.satisfies('@12.12.1:'):
tpl_dep_map.append(('Pnetcdf', 'parallel-netcdf'))
if spec.satisfies('@13:'):
tpl_dep_map.append(('HWLOC', 'hwloc'))
if spec.satisfies('@13.0.2:'):
tpl_dep_map.append(('STRUMPACK', 'strumpack'))
for tpl_name, dep_name in tpl_dep_map:
have_dep = (dep_name in spec)
options.append(define('TPL_ENABLE_' + tpl_name, have_dep))
if not have_dep:
continue
depspec = spec[dep_name]
libs = depspec.libs
options.extend([
define(tpl_name + '_INCLUDE_DIRS', depspec.prefix.include),
define(tpl_name + '_ROOT', depspec.prefix),
define(tpl_name + '_LIBRARY_NAMES', libs.names),
define(tpl_name + '_LIBRARY_DIRS', libs.directories),
])
define_tpl(tpl_name, dep_name, dep_name in spec)
# MPI settings
options.append(define_tpl_enable('MPI'))