[!7] Variant restructuring

Merge branch 'feature/variant-restructuring' into 'master'

ref:spack/dune-spack\> Some of the variants/dependencies in the prototype were
unneeded, I went through also with a keen eye on keeping the total number of
variants a bit lower. I also added defaults that I consider useful.

Sits on top of [!6]

See merge request [spack/dune-spack!7]

  [!6]: gitlab.dune-project.org/NoneNone/merge_requests/6
  [spack/dune-spack!7]: gitlab.dune-project.org/spack/dune-spack/merge_requests/7
This commit is contained in:
Dominic Kempf 2020-05-15 09:19:17 +00:00
commit c1bcb57367
1 changed files with 55 additions and 72 deletions

View File

@ -28,12 +28,9 @@ class Dune(CMakePackage):
""" """
DUNE, the Distributed and Unified Numerics Environment is a modular toolbox for solving partial differential equations (PDEs) with grid-based methods. DUNE, the Distributed and Unified Numerics Environment is a modular toolbox for solving partial differential equations (PDEs) with grid-based methods.
""" """
homepage = "https://www.dune-project.org" homepage = "https://www.dune-project.org"
git = "https://gitlab.dune-project.org/core/dune-common.git" git = "https://gitlab.dune-project.org/core/dune-common.git"
python_components = [ 'dune' ]
# This defines a mapping of available versions of the dune Spack package # This defines a mapping of available versions of the dune Spack package
# and the branch name in the Dune repositories this refers to. # and the branch name in the Dune repositories this refers to.
dune_versions_to_branch = { dune_versions_to_branch = {
@ -41,51 +38,47 @@ class Dune(CMakePackage):
"2.7" : "releases/2.7", "2.7" : "releases/2.7",
} }
variant('2d', default=True, description='Build library for 2d') # Variants for the general build process
variant('3d', default=True, description='Build library for 3d') variant('shared', default=True, description='Enables the build of shared libraries.')
variant('alberta', default=False, description='Build with Alberta support')
variant('amiramesh', default=False, description='Build with AmiraMesh support') # Some variants for customization of Dune
variant('doc', default=False, description='Build and install documentation')
# Variants for upstream dependencies
variant('arpack', default=True, description='Build ARnoldi PACKage library support') variant('arpack', default=True, description='Build ARnoldi PACKage library support')
variant('blas', default=True, description='Build with BLAS support') variant('blas', default=True, description='Build with BLAS support')
variant('doxygen', default=True, description='Create Doxygen documentation')
variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory')
variant('fempy', default=False, description='Support of dune-fempy module')
variant('gmp', default=True, description='Build with GNU multi-precision library support') variant('gmp', default=True, description='Build with GNU multi-precision library support')
variant('imagemagick', default=False, description='Imagemagick support')
variant('jupyter', default=False, description='Build with Jupyter support')
variant('lapack', default=True, description='Build with LAPACK support') variant('lapack', default=True, description='Build with LAPACK support')
variant('metis', default=True, description='Build with METIS library support') variant('metis', default=True, description='Build with METIS library support')
variant('mkl', default=True, description='Build with Math Kernel library support') variant('parmetis', default=False, description='Build with ParMETIS support')
variant('tbb', default=True, description='Build with Threading Building Blocks library support')
variant('oldcategory', default=True, description='Enable/Disable the backwards compatibility of the category enum/method in dune-istl solvers, preconditioner, etc.')
variant('parmetis', default=True, description='Build with ParMETIS support')
variant('psurface', default=False, description='Build with Psurface support')
variant('ptscotch', default=True, description='Build with PT-Scotch support') variant('ptscotch', default=True, description='Build with PT-Scotch support')
variant('selector', default=True, description='Grid selector definition added to config.h')
variant('shared', default=True, description='Enables the build of shared libraries.')
variant('sionlib', default=False, description='Build with SIONlib support') variant('sionlib', default=False, description='Build with SIONlib support')
variant('sphinx', default=True, description='Create Sphinx documentation')
variant('suitesparse', default=True, description='Build SuiteSparse library support') variant('suitesparse', default=True, description='Build SuiteSparse library support')
variant('superlu', default=True, description='Build Supernodal LU library support') variant('superlu', default=False, description='Build Supernodal LU library support')
variant('threads', default=True, description='Activate pThread support') variant('tbb', default=False, description='Build with Intel TBB support')
variant('vc', default=True, description='Build C++ Vectorization library support') variant('vc', default=False, description='Build C++ Vectorization library support')
variant('zlib', default=True, description='Build zlib library support') variant('zlib', default=False, description='Build zlib library support')
variant('zoltan', default=True, description='Build with Zoltan support') variant('zoltan', default=False, description='Build with Zoltan support')
# Some variants that were here that are on my todo list
# variant('jupyter', default=False, description='Build with Jupyter support')
# Define one variant for each Dune module that we have. Only core modules
# are activated by default.
variant('alugrid', default=False, description='Build with dune-alugrid module') variant('alugrid', default=False, description='Build with dune-alugrid module')
variant('corepy', default=False, description='Build with dune-corepy module')
variant('functions', default=False, description='Build with dune-functions module') variant('functions', default=False, description='Build with dune-functions module')
variant('geometry', default=False, description='Build with dune-geometry module') variant('geometry', default=True, description='Build with dune-geometry module')
variant('grid', default=False, description='Build with dune-grid module') variant('grid', default=True, description='Build with dune-grid module')
variant('istl', default=False, description='Build with dune-istl module') variant('istl', default=True, description='Build with dune-istl module')
variant('localfunctions', default=False, description='Build with dune-localfunctions module') variant('localfunctions', default=True, description='Build with dune-localfunctions module')
variant('python', default=False, description='Build with Python and dune-python') variant('python', default=False, description='Build with Python and dune-python')
variant('spgrid', default=False, description='Build with dune-spgrid module') variant('spgrid', default=False, description='Build with dune-spgrid module')
variant('typetree', default=False, description='Build with dune-typetree module') variant('typetree', default=False, description='Build with dune-typetree module')
variant('uggrid', default=False, description='Build with dune-uggrid module') variant('uggrid', default=False, description='Build with dune-uggrid module')
# Iterate over all available Dune versions and define resources for all Dune modules # Iterate over all available Dune versions and define resources for all Dune modules
# If a Dune module behaves differently for different versions (e.g. dune-python got
# merged into dune-common post-2.7), define the resource outside of this loop.
for vers, branch in dune_versions_to_branch.items(): for vers, branch in dune_versions_to_branch.items():
version(vers, branch=dune_versions_to_branch[vers]) version(vers, branch=dune_versions_to_branch[vers])
@ -124,13 +117,6 @@ class Dune(CMakePackage):
when='@%s+functions' % vers, when='@%s+functions' % vers,
) )
resource(
name='dune-python',
git='https://gitlab.dune-project.org/staging/dune-python.git',
branch=branch,
when='@%s+python' % vers,
)
resource( resource(
name='dune-typetree', name='dune-typetree',
git='https://gitlab.dune-project.org/staging/dune-typetree.git', git='https://gitlab.dune-project.org/staging/dune-typetree.git',
@ -152,7 +138,19 @@ class Dune(CMakePackage):
when='@%s+uggrid' % vers, when='@%s+uggrid' % vers,
) )
resource(
name='dune-spgrid',
git='https://gitlab.dune-project.org/extensions/dune-spgrid.git',
branch=branch,
when='@%s+spgrid' % vers,
)
resource(
name='dune-python',
git='https://gitlab.dune-project.org/staging/dune-python.git',
branch=branch,
when='@2.7+python',
)
# Dependencies between modules # Dependencies between modules
module_dependencies={"dune-common":[]} module_dependencies={"dune-common":[]}
@ -167,43 +165,35 @@ class Dune(CMakePackage):
module_dependencies["dune-alugrid"]=["dune-grid","dune-geometry","dune-common"] module_dependencies["dune-alugrid"]=["dune-grid","dune-geometry","dune-common"]
extends('python') extends('python')
#option python_components = [ 'dune' ]
depends_on('gawk')
depends_on('cmake@3.1:', type='build') # Specify upstream dependencies (often depending on variants)
depends_on('mpi') depends_on('arpack-ng', when='+arpack')
depends_on('blas', when='+blas') depends_on('blas', when='+blas')
depends_on('lapack', when='+lapack') depends_on('cmake@3.1:', type='build')
depends_on('doxygen', type='build', when='+doxygen') depends_on('doxygen', type='build', when='+doc')
depends_on('gawk')
depends_on('gmp', when='+gmp') depends_on('gmp', when='+gmp')
depends_on('imagemagick', type='build', when='+doc')
depends_on('intel-tbb', when='+tbb') depends_on('intel-tbb', when='+tbb')
depends_on('intel-mkl', when='+mkl') depends_on('lapack', when='+lapack')
depends_on('metis', when='+metis')
depends_on('mpi')
depends_on('parmetis', when='+parmetis')
depends_on('pkg-config', type='build')
depends_on('python@3.0:', type=('build', 'run'), when='+python') depends_on('python@3.0:', type=('build', 'run'), when='+python')
depends_on('py-setuptools', type='build') depends_on('py-setuptools', type='build')
depends_on('py-jupyter', type=('build', 'run'), when='+jupyter')
depends_on('py-numpy', type=('build', 'run'), when='+python') depends_on('py-numpy', type=('build', 'run'), when='+python')
depends_on('py-pip', type=('build', 'run'), when='+python') depends_on('py-pip', type=('build', 'run'), when='+python')
depends_on('py-sphinx', type=('build', 'run'), when='+sphinx') depends_on('py-sphinx', type=('build', 'run'), when='+doc')
depends_on('vc', when='+vc') depends_on('scotch+mpi', when='+ptscotch')
depends_on('pkg-config', type='build') depends_on('sionlib', when='+sionlib')
depends_on('imagemagick', type='build', when='+imagemagick')
depends_on('metis', when='+metis')
depends_on('parmetis', when='+parmetis')
depends_on('arpack-ng', when='+arpack')
depends_on('suite-sparse', when='+suitesparse') depends_on('suite-sparse', when='+suitesparse')
depends_on('superlu', when='+superlu') depends_on('superlu', when='+superlu')
depends_on('alberta', when='+alberta') depends_on('vc', when='+vc')
depends_on('psurface', when='+psurface')
depends_on('amiramesh', when='+amiramesh')
depends_on('sionlib', when='+sionlib')
depends_on('zlib', when='+zlib') depends_on('zlib', when='+zlib')
depends_on('scotch+mpi', when='+ptscotch')
depends_on('zoltan', when='+zoltan') depends_on('zoltan', when='+zoltan')
def url_for_version(self, version):
url = "https://www.dune-project.org/download/{1}/dune-common-{1}.tar.gz"
return url.format(version.up_to(2), version)
def cmake_args(self): def cmake_args(self):
"""Populate cmake arguments.""" """Populate cmake arguments."""
spec = self.spec spec = self.spec
@ -218,14 +208,10 @@ class Dune(CMakePackage):
return variant_bool(feature, on='OFF', off='ON') return variant_bool(feature, on='OFF', off='ON')
cmake_args = [ cmake_args = [
# '-DDUNE_BUILD_BOTH_LIBS=%s' % variant_bool('+shared'),
'-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'), '-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'),
'-DDUNE_GRID_EXTRA_UTILS:BOOL=%s' % variant_bool('+extrautils'), '-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=ON',
'-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=%s' % variant_bool('+selector'),
'-DDUNE_ISTL_SUPPORT_OLD_CATEGORY=%s' % variant_bool('+oldcategory'),
'-DUSE_PTHREADS:BOOL=%s' % variant_bool('+threads'),
] ]
#self.define_from_variant('DETECT_HDF5', 'hdf5'),
if '+python' in spec: if '+python' in spec:
cmake_args.append('-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE') cmake_args.append('-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE')
cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"')
@ -261,9 +247,6 @@ class Dune(CMakePackage):
return CMakePackage._get_needed_resources(self) return CMakePackage._get_needed_resources(self)
def cmake(self, spec, prefix): def cmake(self, spec, prefix):
if self.stage.archive_file:
os.remove(self.stage.archive_file)
# Write an opts file for later use # Write an opts file for later use
with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile: with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile:
optFile.write('CMAKE_FLAGS="') optFile.write('CMAKE_FLAGS="')