From 42d8e9eeb5c99805d99d8214d127b243a59da787 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Fri, 5 Nov 2021 09:07:33 -0400 Subject: trilinos: explicitly use variants instead of spec for TPLs (#27221) Fixes https://github.com/spack/spack/pull/27188#issuecomment-961212214 --- .../repos/builtin/packages/trilinos/package.py | 59 +++++++++++++--------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 3b03b9dc37..ae8cd1a43d 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -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 @@ class Trilinos(CMakePackage, CudaPackage): # ######################### 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')) -- cgit v1.2.3-70-g09d2