2020-03-30 20:22:34 +00:00
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
2020-04-02 11:07:33 +00:00
# spack install dune-typetree
2020-03-30 20:22:34 +00:00
#
# You can edit this file again by typing:
#
2020-04-02 11:07:33 +00:00
# spack edit dune-typetree
2020-03-30 20:22:34 +00:00
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------
from spack import *
class DuneTypetree ( CMakePackage ) :
2020-04-02 11:07:33 +00:00
""" TypeTree is a template library for constructing and operating on statically typed trees of objects. """
2020-03-30 20:22:34 +00:00
homepage = " https://www.dune-project.org "
2020-04-02 11:07:33 +00:00
url = " https://gitlab.dune-project.org/staging/dune-typetree/-/archive/releases/2.7/dune-typetree-releases-2.7.tar.gz "
list_url = ' https://gitlab.dune-project.org/staging/dune-typetree/-/archive/releases/ '
2020-03-30 20:22:34 +00:00
list_depth = 1
2020-04-02 11:07:33 +00:00
version ( ' 2.7 ' , sha256 = ' b546c2588576d4e8b22e675865628734f2f3d9a8688255742d099f41e5db574e ' )
version ( ' 2.6 ' , sha256 = ' a5d78b00ff45a30163062812c8c85f18091b6874df72ceadb9c5c718e0db07de ' )
version ( ' 2.5 ' , sha256 = ' 7596858584e6805db9db701baa6362bbda0607fe19163c99a69ffa3335eee7a2 ' )
2020-03-30 20:22:34 +00:00
#option
variant ( ' blas ' , default = True , description = ' Build with BLAS support ' )
variant ( ' lapack ' , default = True , description = ' Build with LAPACK support ' )
variant ( ' gmp ' , default = True , description = ' Build with GNU multi-precision library support ' )
variant ( ' tbb ' , default = True , description = ' Build with Threading Building Blocks library support ' )
2020-04-02 11:07:33 +00:00
variant ( ' mkl ' , default = True , description = ' Build with Math Kernel library support ' )
2020-03-30 20:22:34 +00:00
variant ( ' doxygen ' , default = True , description = ' Create Doxygen documentation ' )
variant ( ' sphinx ' , default = True , description = ' Create Sphinx documentation ' )
variant ( ' vc ' , default = True , description = ' Build C++ Vectorization library support ' )
variant ( ' imagemagick ' , default = False , description = ' Imagemagick support ' )
2020-04-02 11:07:33 +00:00
variant ( ' oldcategory ' , default = True , description = ' Enable/Disable the backwards compatibility of the category enum/method in dune-istl solvers, preconditioner, etc. ' )
2020-03-30 20:22:34 +00:00
variant ( ' threads ' , default = True , description = ' Activate pThread support ' )
2020-04-02 11:07:33 +00:00
variant ( ' shared ' , default = True , description = ' Enables the build of shared libraries. ' )
2020-03-30 20:22:34 +00:00
#dependencies
2020-04-02 11:07:33 +00:00
depends_on ( ' dune-common+shared ' )
2020-03-30 20:22:34 +00:00
depends_on ( ' cmake@3.1: ' , type = ' build ' )
depends_on ( ' mpi ' )
depends_on ( ' blas ' , when = ' +blas ' )
depends_on ( ' lapack ' , when = ' +lapack ' )
depends_on ( ' doxygen ' , type = ' build ' , when = ' +doxygen ' )
depends_on ( ' gmp ' , when = ' +gmp ' )
depends_on ( ' intel-tbb ' , when = ' +tbb ' )
depends_on ( ' intel-mkl ' , when = ' +mkl ' )
2020-04-02 11:07:33 +00:00
depends_on ( ' python@3.8.2: ' )
2020-03-30 20:22:34 +00:00
depends_on ( ' py-sphinx ' , type = ' build ' , when = ' +sphinx ' )
depends_on ( ' vc ' , when = ' +vc ' )
depends_on ( ' pkg-config ' , type = ' build ' )
depends_on ( ' imagemagick ' , type = ' build ' , when = ' +imagemagick ' )
def url_for_version ( self , version ) :
2020-04-02 11:07:33 +00:00
url = ' https://gitlab.dune-project.org/staging/dune-typetree/-/archive/releases/ {1} /dune-typetree-releases- {1} .tar.gz '
2020-03-30 20:22:34 +00:00
return url . format ( version . up_to ( 2 ) , version )
2020-04-02 11:07:33 +00:00
patch ( ' AddQuadMathFlags.cmake.patch ' )
patch ( ' FindQuadMath.cmake.patch ' )
2020-03-30 20:22:34 +00:00
def cmake_args ( self ) :
""" Populate cmake arguments. """
spec = self . spec
def variant_bool ( feature , on = ' ON ' , off = ' OFF ' ) :
""" Ternary for spec variant to ON/OFF string """
if feature in spec :
return on
return off
def nvariant_bool ( feature ) :
""" Negated ternary for spec variant to OFF/ON string """
return variant_bool ( feature , on = ' OFF ' , off = ' ON ' )
cmake_args = [
# '-DDUNE_BUILD_BOTH_LIBS=%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= %s ' % variant_bool ( ' +selector ' ) ,
' -DUSE_PTHREADS:BOOL= %s ' % variant_bool ( ' +threads ' ) ,
]
if ' python ' in spec :
cmake_args . append ( ' -DPYTHON_INSTALL_LOCATION:STRING= " system " ' )
return cmake_args