trilinos: fix x11 noheaderserror (#27966)

* trilinos: fix define_tpl to handle depspecs w/out headers

This should address #27758 (i.e. errors due to netlib-scalapack not
having headers)

* trilinos: This fixes a mismatch in variant name and spec name for x11/libx11
This commit is contained in:
Tom Payerle 2021-12-29 10:28:20 -05:00 committed by GitHub
parent 95f2b10b4f
commit eba3e1a20c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@
from spack import * from spack import *
from spack.build_environment import dso_suffix from spack.build_environment import dso_suffix
from spack.error import NoHeadersError
from spack.operating_systems.mac_os import macos_version from spack.operating_systems.mac_os import macos_version
from spack.pkg.builtin.kokkos import Kokkos from spack.pkg.builtin.kokkos import Kokkos
@ -561,31 +562,40 @@ def define_tpl(trilinos_name, spack_name, have_dep):
return return
depspec = spec[spack_name] depspec = spec[spack_name]
libs = depspec.libs libs = depspec.libs
try:
options.extend([
define(trilinos_name + '_INCLUDE_DIRS',
depspec.headers.directories),
])
except NoHeadersError:
# Handle case were depspec does not have headers
pass
options.extend([ options.extend([
define(trilinos_name + '_INCLUDE_DIRS', depspec.headers.directories),
define(trilinos_name + '_ROOT', depspec.prefix), define(trilinos_name + '_ROOT', depspec.prefix),
define(trilinos_name + '_LIBRARY_NAMES', libs.names), define(trilinos_name + '_LIBRARY_NAMES', libs.names),
define(trilinos_name + '_LIBRARY_DIRS', libs.directories), define(trilinos_name + '_LIBRARY_DIRS', libs.directories),
]) ])
# Enable these TPLs explicitly from variant options. # Enable these TPLs explicitly from variant options.
# Format is (TPL name, variant name, Spack spec name)
tpl_variant_map = [ tpl_variant_map = [
('ADIOS2', 'adios2'), ('ADIOS2', 'adios2', 'adios2'),
('Boost', 'boost'), ('Boost', 'boost', 'boost'),
('CUDA', 'cuda'), ('CUDA', 'cuda', 'cuda'),
('HDF5', 'hdf5'), ('HDF5', 'hdf5', 'hdf5'),
('HYPRE', 'hypre'), ('HYPRE', 'hypre', 'hypre'),
('MUMPS', 'mumps'), ('MUMPS', 'mumps', 'mumps'),
('UMFPACK', 'suite-sparse'), ('UMFPACK', 'suite-sparse', 'suite-sparse'),
('SuperLU', 'superlu'), ('SuperLU', 'superlu', 'superlu'),
('SuperLUDist', 'superlu-dist'), ('SuperLUDist', 'superlu-dist', 'superlu-dist'),
('X11', 'x11'), ('X11', 'x11', 'libx11'),
] ]
if spec.satisfies('@13.0.2:'): if spec.satisfies('@13.0.2:'):
tpl_variant_map.append(('STRUMPACK', 'strumpack')) tpl_variant_map.append(('STRUMPACK', 'strumpack', 'strumpack'))
for tpl_name, var_name in tpl_variant_map: for tpl_name, var_name, spec_name in tpl_variant_map:
define_tpl(tpl_name, var_name, spec.variants[var_name].value) define_tpl(tpl_name, spec_name, spec.variants[var_name].value)
# Enable these TPLs based on whether they're in our spec; prefer to # Enable these TPLs based on whether they're in our spec; prefer to
# require this way so that packages/features disable availability # require this way so that packages/features disable availability