From dbeea6ff98437dcb55b866bdceaca8aaf2fbb801 Mon Sep 17 00:00:00 2001 From: Gauthier Folzan Date: Mon, 30 Mar 2020 22:22:34 +0200 Subject: [PATCH] First commit --- README.md | 25 ++- .../dune-alugrid/AddQuadMathFlags.cmake.patch | 31 ++++ .../dune-alugrid/FindQuadMath.cmake.patch | 62 +++++++ packages/dune-alugrid/package.py | 124 +++++++++++++ packages/dune-common/package.py | 110 ++++++++++++ packages/dune-geometry/package.py | 113 ++++++++++++ packages/dune-grid/package.py | 120 +++++++++++++ packages/dune-istl/package.py | 126 +++++++++++++ .../AddQuadMathFlags.cmake.patch | 31 ++++ .../FindQuadMath.cmake.patch | 62 +++++++ packages/dune-localfunctions/package.py | 118 ++++++++++++ .../dune-python/AddQuadMathFlags.cmake.patch | 31 ++++ packages/dune-python/FindQuadMath.cmake.patch | 62 +++++++ packages/dune-python/package.py | 169 ++++++++++++++++++ .../AddQuadMathFlags.cmake.patch | 31 ++++ .../dune-typetree/FindQuadMath.cmake.patch | 62 +++++++ packages/dune-typetree/package.py | 121 +++++++++++++ .../dune-uggrid/AddQuadMathFlags.cmake.patch | 31 ++++ packages/dune-uggrid/FindQuadMath.cmake.patch | 62 +++++++ packages/dune-uggrid/package.py | 114 ++++++++++++ packages/dune-uggrid/parallel_CMakeList.patch | 12 ++ 21 files changed, 1616 insertions(+), 1 deletion(-) create mode 100644 packages/dune-alugrid/AddQuadMathFlags.cmake.patch create mode 100644 packages/dune-alugrid/FindQuadMath.cmake.patch create mode 100644 packages/dune-alugrid/package.py create mode 100644 packages/dune-common/package.py create mode 100644 packages/dune-geometry/package.py create mode 100644 packages/dune-grid/package.py create mode 100644 packages/dune-istl/package.py create mode 100644 packages/dune-localfunctions/AddQuadMathFlags.cmake.patch create mode 100644 packages/dune-localfunctions/FindQuadMath.cmake.patch create mode 100644 packages/dune-localfunctions/package.py create mode 100644 packages/dune-python/AddQuadMathFlags.cmake.patch create mode 100644 packages/dune-python/FindQuadMath.cmake.patch create mode 100644 packages/dune-python/package.py create mode 100644 packages/dune-typetree/AddQuadMathFlags.cmake.patch create mode 100644 packages/dune-typetree/FindQuadMath.cmake.patch create mode 100644 packages/dune-typetree/package.py create mode 100644 packages/dune-uggrid/AddQuadMathFlags.cmake.patch create mode 100644 packages/dune-uggrid/FindQuadMath.cmake.patch create mode 100644 packages/dune-uggrid/package.py create mode 100644 packages/dune-uggrid/parallel_CMakeList.patch diff --git a/README.md b/README.md index 16be0be..0658fe1 100644 --- a/README.md +++ b/README.md @@ -1 +1,24 @@ -# dune_spack_repo \ No newline at end of file +# Dune Spack repository +## Installation +Clone spack git +``` +git clone https://github.com/spack/spack.git +source ./share/spack/setup-env.sh +spack bootstrap +``` +add dune spack repo +``` +cd $HOME +git clone https://github.com/gauthier12/dune_spack_repo.git +spack repo add dune_spack_repo +``` +Install dune modules +``` +spack install dune-python +``` +## Use +To use dune-python, load the module +``` +source $SPACK_ROOT/share/spack/setup-env.sh +spack load dune-python +``` diff --git a/packages/dune-alugrid/AddQuadMathFlags.cmake.patch b/packages/dune-alugrid/AddQuadMathFlags.cmake.patch new file mode 100644 index 0000000..08eb9e9 --- /dev/null +++ b/packages/dune-alugrid/AddQuadMathFlags.cmake.patch @@ -0,0 +1,31 @@ +--- a/cmake/modules/AddQuadMathFlags.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/AddQuadMathFlags.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,28 @@ ++# Defines the functions to use QuadMath ++# ++# .. cmake_function:: add_dune_quadmath_flags ++# ++# .. cmake_param:: targets ++# :positional: ++# :single: ++# :required: ++# ++# A list of targets to use QuadMath with. ++# ++ ++ ++function(add_dune_quadmath_flags _targets) ++ if(QUADMATH_FOUND) ++ foreach(_target ${_targets}) ++ target_link_libraries(${_target} "quadmath") ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-DENABLE_QUADMATH=1 -D_GLIBCXX_USE_FLOAT128=1 ") ++ if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-fext-numeric-literals ") ++ endif() ++ endforeach(_target ${_targets}) ++ endif(QUADMATH_FOUND) ++endfunction(add_dune_quadmath_flags) diff --git a/packages/dune-alugrid/FindQuadMath.cmake.patch b/packages/dune-alugrid/FindQuadMath.cmake.patch new file mode 100644 index 0000000..716d0a1 --- /dev/null +++ b/packages/dune-alugrid/FindQuadMath.cmake.patch @@ -0,0 +1,62 @@ +--- a/cmake/modules/FindQuadMath.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/FindQuadMath.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,59 @@ ++# .. cmake_module:: ++# ++# Find the GCC Quad-Precision library ++# ++# Sets the following variables: ++# ++# :code:`QUADMATH_FOUND` ++# True if the Quad-Precision library was found. ++# ++# ++ ++ ++# search for the header quadmath.h ++include(CheckIncludeFile) ++check_include_file(quadmath.h QUADMATH_HEADER) ++ ++include(CheckCSourceCompiles) ++include(CMakePushCheckState) ++ ++cmake_push_check_state() # Save variables ++set(CMAKE_REQUIRED_LIBRARIES quadmath) ++check_c_source_compiles(" ++#include ++ ++int main () ++{ ++ __float128 r = 1.0q; ++ r = strtoflt128(\"1.2345678\", NULL); ++ return 0; ++}" QUADMATH_COMPILES) ++cmake_pop_check_state() ++ ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ "QuadMath" ++ DEFAULT_MSG ++ QUADMATH_HEADER ++ QUADMATH_COMPILES ++) ++ ++# text for feature summary ++set_package_properties("QuadMath" PROPERTIES ++ DESCRIPTION "GCC Quad-Precision library") ++ ++# set HAVE_QUADMATH for config.h ++set(HAVE_QUADMATH ${QUADMATH_FOUND}) ++ ++# -fext-numeric-literals is a GCC extension not available in other compilers like clang ++if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set(_QUADMATH_EXT_NUMERIC_LITERALS "-fext-numeric-literals") ++endif() ++ ++# register all QuadMath related flags ++if(HAVE_QUADMATH) ++ dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_QUADMATH=1" "_GLIBCXX_USE_FLOAT128=1" ++ COMPILE_OPTIONS ${_QUADMATH_EXT_NUMERIC_LITERALS} ++ LIBRARIES "quadmath") ++endif() diff --git a/packages/dune-alugrid/package.py b/packages/dune-alugrid/package.py new file mode 100644 index 0000000..aa90a95 --- /dev/null +++ b/packages/dune-alugrid/package.py @@ -0,0 +1,124 @@ +# 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: +# +# spack install dune-alugrid +# +# You can edit this file again by typing: +# +# spack edit dune-alugrid +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneAlugrid(CMakePackage): + """ALUGrid is an adaptive, loadbalancing, unstructured implementation of the DUNE grid interface supporting either simplices or cubes.""" + + homepage = "https://www.dune-project.org" + url = "https://github.com/dune-mirrors/dune-alugrid/archive/v2.6.0.tar.gz" + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.6.0', sha256='25fa4a5127837a0def2f93ae7fda38c5098dd066536236533015755ad264a870') + version('2.4.0', sha256='fd0fab5b2c6e1e0c9f792947dad1f9c2e2d6b65242935474017e0c278bab3ae1') + + #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') + variant('mkl', default=True, description='Build with Math Kernel library support') + variant('doxygen', default=True, description='Create Doxygen documentation') + variant('sphinx', default=True, description='Create Sphinx documentation') + variant('python', default=False, description='Build with Python and dune-python') + variant('vc', default=True, description='Build C++ Vectorization library support') + variant('zlib', default=True, description='Build zlib library support') + variant('imagemagick', default=False, description='Imagemagick support') + variant('corepy', default=False, description='Build with dune-corepy support') + variant('uggrid', default=False, description='Build with dune-uggrid support') + variant('ptscotch', default=True, description='Build with PT-Scotch support') + variant('metis', default=True, description='Build with METIS support') + variant('parmetis', default=True, description='Build with ParMETIS support') + variant('alberta', default=False, description='Build with Alberta support') + variant('psurface', default=False, description='Build with Psurface support') + variant('amiramesh', default=False, description='Build with AmiraMesh support') + variant('sionlib', default=False, description='Build with SIONlib support') + variant('zoltan', default=True, description='Build with Zoltan support') + variant('threads', default=True, description='Whether we are using pthreads') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + variant('shared', default=False, description='Enables the build of shared libraries.') + + #dependencies + depends_on('dune-common') + depends_on('dune-geometry') + depends_on('dune-grid') + depends_on('dune-corepy', when='+corepy') + depends_on('dune-python', when='+python') + depends_on('dune-uggrid', when='+uggrid') + 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') + depends_on('python@3.0:') + depends_on('py-sphinx', type='build', when='+sphinx') + depends_on('vc', when='+vc') + depends_on('zlib', when='+zlib') + depends_on('scotch+mpi', when='+ptscotch') + depends_on('zoltan', when='+zoltan') + depends_on('metis', when='+metis') + depends_on('parmetis', when='+parmetis') + depends_on('pkg-config', type='build') + depends_on('imagemagick', type='build', when='+imagemagick') + depends_on('alberta', when='+alberta') + depends_on('psurface', when='+psurface') + depends_on('amiramesh', when='+amiramesh') + depends_on('sionlib', when='+sionlib') + + patch('AddQuadMathFlags.cmake.patch', when='@2.6') + patch('FindQuadMath.cmake.patch', when='@2.6') + + 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('-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE') + cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') + + return cmake_args + diff --git a/packages/dune-common/package.py b/packages/dune-common/package.py new file mode 100644 index 0000000..b67b40e --- /dev/null +++ b/packages/dune-common/package.py @@ -0,0 +1,110 @@ +# 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: +# +# spack install dune-common +# +# You can edit this file again by typing: +# +# spack edit dune-common +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneCommon(CMakePackage): + """ + dune-common provides basic infrastructure classes for all Dune + modules. + """ + + homepage = "https://www.dune-project.org" + url = "https://www.dune-project.org/download/2.7.0/dune-common-2.7.0.tar.gz" + list_url = "https://www.dune-project.org/download/" + list_depth = 1 + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='3c83c583a45325513113148cb94bd978e601907a6591c765f6253342e00f1890') + version('2.6.0', sha256='1c566abb509ffd29690055acb5a7a69e3eda3848c2171f7af75c1e8743663c05') + version('2.5.2', sha256='042fc7b9ae4b781e027a48048ea4067deb924ae172e56821f679bc8afe312159') + version('2.5.1', sha256='fa9b1e538236e761d4eec703343e1345e8da1b75b3d2adbdde5fc53012d05814') + version('2.5.0', sha256='3a6e20189926f0908316d43b2b130ae89e3662865926325a236c5465640a33c2') + version('2.4.2', sha256='93e973e1db81950c378cf3ebe6cffca32fb642c7bd5e40a8883ebdc8c6909536') + version('2.4.1', sha256='e4e9a4d6207484728a8582c5bca14c1479075b655d095790a037e6f0135762a8') + version('2.4.0', sha256='7c2865e467883adbfdf4b248b8dbf3cd171a47c7498164d2dbe700171fdb7b1f') + + 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') + variant('mkl', default=True, description='Build with Math Kernel library support') + 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') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + variant('python', default=True, description='Build with Python') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + + + + # FIXME: Add dependencies if required. + #option + 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') + depends_on('python@3.0:', when='+python') + 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): + 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): + """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 diff --git a/packages/dune-geometry/package.py b/packages/dune-geometry/package.py new file mode 100644 index 0000000..407b0a2 --- /dev/null +++ b/packages/dune-geometry/package.py @@ -0,0 +1,113 @@ +# 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: +# +# spack install dune-geometry +# +# You can edit this file again by typing: +# +# spack edit dune-geometry +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneGeometry(CMakePackage): + """ + dune-geometry includes everything related to the DUNE reference + elements. This includes the reference elements themselves, mappings + on the reference elements (geometries), and quadratures. + """ + + homepage = "https://www.dune-project.org" + url = "https://www.dune-project.org/download/2.7.0/dune-geometry-2.7.0.tar.gz" + list_url = "https://www.dune-project.org/download/" + list_depth = 1 + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='d996c73efa345338766c5e4774e3b06ec1ed27eb745916af35877bbf38dd2cb2') + version('2.6.0', sha256='7661155a0be3d001db43c6d99f1ee1a04101bc3e666dade82a40a6ed65578a42') + version('2.5.2', sha256='30e9e6c22206034e3e490d3b0bf841cd49e8ece0d3a2f6df453e8594f546ec0d') + version('2.5.1', sha256='f3782b27a4622bd7b7bc52fa7561d5bcf4f0dc39d6c161c082047c7b92140076') + version('2.5.0', sha256='0b8ea21c046b703dbb4dfb1481e5ea74c9ea7487930be66d7a3fd74c854fb08e') + version('2.4.2', sha256='4fe3d09b1dba6c36b73662af32088639eac5af33e01599469de2b71bd0a8c4e3') + version('2.4.1', sha256='a6b92785150d309760f95add38d8a12bfd906d994e298cd54e744f34064b4e0f') + version('2.4.0', sha256='f0f8acb95fd325b9b78f9d1e35d733830865378c4d5d5c34e3ecce687341fe86') + + #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') + variant('mkl', default=True, description='Build with Threading Building Blocks library support') + variant('doxygen', default=True, description='Create Doxygen documentation') + variant('sphinx', default=True, description='Create Sphinx documentation') + variant('python', default=True, description='Build with Python') + variant('vc', default=True, description='Build C++ Vectorization library support') + variant('imagemagick', default=False, description='Imagemagick support') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + + + + #dependencies + depends_on('dune-common') + 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') + depends_on('python@3.0:') + 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): + url = "https://www.dune-project.org/download/{1}/dune-geometry-{1}.tar.gz" + return url.format(version.up_to(2), version) + + 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('-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE') + cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') + + return cmake_args + diff --git a/packages/dune-grid/package.py b/packages/dune-grid/package.py new file mode 100644 index 0000000..6309b3d --- /dev/null +++ b/packages/dune-grid/package.py @@ -0,0 +1,120 @@ +# 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: +# +# spack install dune-grid +# +# You can edit this file again by typing: +# +# spack edit dune-grid +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneGrid(CMakePackage): + """ + dune-grid provides grid interface and some grid implementations + """ + + homepage = "https://www.dune-project.org" + url = "https://www.dune-project.org/download/2.7.0/dune-grid-2.7.0.tar.gz" + list_url = "https://www.dune-project.org/download/" + list_depth = 1 + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='fa88dd60619df51100327a9128c3f7242a3a13b7ddfbac43a04f7e85c1f8d29d') + version('2.6.0', sha256='a03145e8fd9b0d585f84ca8b62a65d6fc3e918fb571d48c1eb69f95499dee4ca') + version('2.5.2', sha256='5763e36a0623f37a2cec14d62631e56468e10c3b4ed68f7a36b9479b13fd87d5') + version('2.5.1', sha256='228f4bbeb8e810b02389f08307997b1f6290d49265e61281566e50afdadee511') + version('2.5.0', sha256='a5ce78e6cf59b2968fdf4a638e199bae5c935b43e428b2492d7adf34fb609027') + version('2.4.2', sha256='b3ab581b48f65da16200486ac56320ed0ea7811f88a5d00a131b23b3299e0c72') + version('2.4.1', sha256='eeb3858bef485faa2c2f570ebc303742fa0b8581725523ba85fd87c5306353d7') + version('2.4.0', sha256='e608bb47e7e9965b561c5eaceeb55cdc0a22adc5caf96c2eb67ee0cd1f8db9b4') + + #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') + variant('mkl', default=True, description='Build with Math Kernel library support') + variant('doxygen', default=True, description='Create Doxygen documentation') + variant('sphinx', default=True, description='Create Sphinx documentation') + variant('python', default=True, description='Build with Python and dune-python') + variant('vc', default=True, description='Build C++ Vectorization library support') + variant('imagemagick', default=False, description='Imagemagick support') + variant('uggrid', default=False, description='Build with dune-uggrid support') + variant('metis', default=True, description='Build with METIS support') + variant('parmetis', default=True, description='Build with ParMETIS support') + variant('alberta', default=False, description='Build with Alberta support') + variant('psurface', default=False, description='Build with Psurface support') + variant('amiramesh', default=False, description='Build with AmiraMesh support') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + + #dependencies + depends_on('dune-common') + depends_on('dune-geometry') + 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') + depends_on('python@3.0:') + 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') + depends_on('metis', when='+metis') + depends_on('parmetis', when='+parmetis') + depends_on('dune-uggrid', when='+uggrid') + depends_on('alberta', when='+alberta') + depends_on('psurface', when='+psurface') + depends_on('amiramesh', when='+amiramesh') + def url_for_version(self, version): + url = "https://www.dune-project.org/download/{1}/dune-grid-{1}.tar.gz" + return url.format(version.up_to(2), version) + + 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 diff --git a/packages/dune-istl/package.py b/packages/dune-istl/package.py new file mode 100644 index 0000000..5e81e49 --- /dev/null +++ b/packages/dune-istl/package.py @@ -0,0 +1,126 @@ +# 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: +# +# spack install dune-istl +# +# You can edit this file again by typing: +# +# spack edit dune-istl +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneIstl(CMakePackage): + """ + dune-istl is the iterative solver template library which provides + generic sparse matrix/vector classes and a variety of solvers based + on these classes. A special feature is the use of templates to + exploit the recursive block structure of finite element matrices at + compile time. Available solvers include Krylov methods, (block-) + incomplete decompositions and aggregation-based algebraic multigrid. + """ + + homepage = "https://www.dune-project.org" + url = "https://www.dune-project.org/download/2.7.0/dune-istl-2.7.0.tar.gz" + list_url = "https://www.dune-project.org/download/" + list_depth = 1 + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='c98d218bdf79549bb2e96fc465e9f9a72f5d88b78090812a59dae85cfee3833e') + version('2.6.0', sha256='5ce06fc396624f654c3f34e333fd5900e992c4596b3230abe68617ed77f64f50') + version('2.5.2', sha256='9fe33fb60b9c9f98100bfc909eb4d56598bae4f036f01f00b4a9fd2498387178') + version('2.5.1', sha256='7e183b1361419620e3df7287d962bcbc1860fa8233588f5b25507ef7a20649dc') + version('2.5.0', sha256='f9af37af1e8186443df384f155d66d2f16e95a909f9574d2bcae85d6d14b95ab') + version('2.4.2', sha256='7e02eaa3d2d054f056709d1c9a91235b73bc0f96b47630f91c914d349093f572') + version('2.4.1', sha256='0ea512e538935812cd6f3a9504f3b06fadff5c15d9d1b0dc499a5a913ea02a4d') + version('2.4.0', sha256='205686b77f7e36d6bc0d2771b1514d98d221b608e5f4efdeeafb1a750e3ca2ba') + + #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') + variant('mkl', default=True, description='Build with Threading Building Blocks library support') + variant('doxygen', default=True, description='Create Doxygen documentation') + variant('sphinx', default=True, description='Create Sphinx documentation') + variant('python', default=True, description='Build with Python') + variant('vc', default=True, description='Build C++ Vectorization library support') + variant('metis', default=True, description='Build METIS library support') + variant('parmetis', default=True, description='Build ParMETIS library support') + variant('suitesparse', default=True, description='Build SuiteSparse library support') + variant('superlu', default=True, description='Build Supernodal LU library support') + variant('arpack', default=True, description='Build ARnoldi PACKage library support') + variant('imagemagick', default=False, description='Imagemagick support') + variant('oldcategory', default=True, description='Enable/Disable the backwards compatibility of the category enum/method in dune-istl solvers, preconditioner, etc.') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + + + + #dependencies + depends_on('dune-common') + 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') + depends_on('python@3.0:') + depends_on('py-sphinx', type='build', when='+sphinx') + depends_on('vc', when='+vc') + depends_on('metis', when='+metis') + depends_on('parmetis', when='+parmetis') + depends_on('suite-sparse', when='+suitesparse') + depends_on('superlu', when='+superlu') + depends_on('arpack-ng', when='+arpack') + depends_on('pkg-config', type='build') + depends_on('imagemagick', type='build', when='+imagemagick') + def url_for_version(self, version): + url = "https://www.dune-project.org/download/{1}/dune-istl-{1}.tar.gz" + return url.format(version.up_to(2), version) + + 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'), + ] + cmake_args.append('-DDUNE_ISTL_SUPPORT_OLD_CATEGORY=%s' % variant_bool('+oldcategory')) + if 'python' in spec: + cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') + + return cmake_args diff --git a/packages/dune-localfunctions/AddQuadMathFlags.cmake.patch b/packages/dune-localfunctions/AddQuadMathFlags.cmake.patch new file mode 100644 index 0000000..08eb9e9 --- /dev/null +++ b/packages/dune-localfunctions/AddQuadMathFlags.cmake.patch @@ -0,0 +1,31 @@ +--- a/cmake/modules/AddQuadMathFlags.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/AddQuadMathFlags.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,28 @@ ++# Defines the functions to use QuadMath ++# ++# .. cmake_function:: add_dune_quadmath_flags ++# ++# .. cmake_param:: targets ++# :positional: ++# :single: ++# :required: ++# ++# A list of targets to use QuadMath with. ++# ++ ++ ++function(add_dune_quadmath_flags _targets) ++ if(QUADMATH_FOUND) ++ foreach(_target ${_targets}) ++ target_link_libraries(${_target} "quadmath") ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-DENABLE_QUADMATH=1 -D_GLIBCXX_USE_FLOAT128=1 ") ++ if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-fext-numeric-literals ") ++ endif() ++ endforeach(_target ${_targets}) ++ endif(QUADMATH_FOUND) ++endfunction(add_dune_quadmath_flags) diff --git a/packages/dune-localfunctions/FindQuadMath.cmake.patch b/packages/dune-localfunctions/FindQuadMath.cmake.patch new file mode 100644 index 0000000..716d0a1 --- /dev/null +++ b/packages/dune-localfunctions/FindQuadMath.cmake.patch @@ -0,0 +1,62 @@ +--- a/cmake/modules/FindQuadMath.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/FindQuadMath.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,59 @@ ++# .. cmake_module:: ++# ++# Find the GCC Quad-Precision library ++# ++# Sets the following variables: ++# ++# :code:`QUADMATH_FOUND` ++# True if the Quad-Precision library was found. ++# ++# ++ ++ ++# search for the header quadmath.h ++include(CheckIncludeFile) ++check_include_file(quadmath.h QUADMATH_HEADER) ++ ++include(CheckCSourceCompiles) ++include(CMakePushCheckState) ++ ++cmake_push_check_state() # Save variables ++set(CMAKE_REQUIRED_LIBRARIES quadmath) ++check_c_source_compiles(" ++#include ++ ++int main () ++{ ++ __float128 r = 1.0q; ++ r = strtoflt128(\"1.2345678\", NULL); ++ return 0; ++}" QUADMATH_COMPILES) ++cmake_pop_check_state() ++ ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ "QuadMath" ++ DEFAULT_MSG ++ QUADMATH_HEADER ++ QUADMATH_COMPILES ++) ++ ++# text for feature summary ++set_package_properties("QuadMath" PROPERTIES ++ DESCRIPTION "GCC Quad-Precision library") ++ ++# set HAVE_QUADMATH for config.h ++set(HAVE_QUADMATH ${QUADMATH_FOUND}) ++ ++# -fext-numeric-literals is a GCC extension not available in other compilers like clang ++if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set(_QUADMATH_EXT_NUMERIC_LITERALS "-fext-numeric-literals") ++endif() ++ ++# register all QuadMath related flags ++if(HAVE_QUADMATH) ++ dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_QUADMATH=1" "_GLIBCXX_USE_FLOAT128=1" ++ COMPILE_OPTIONS ${_QUADMATH_EXT_NUMERIC_LITERALS} ++ LIBRARIES "quadmath") ++endif() diff --git a/packages/dune-localfunctions/package.py b/packages/dune-localfunctions/package.py new file mode 100644 index 0000000..72cc0ec --- /dev/null +++ b/packages/dune-localfunctions/package.py @@ -0,0 +1,118 @@ +# 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: +# +# spack install dune-localfunctions +# +# You can edit this file again by typing: +# +# spack edit dune-localfunctions +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneLocalfunctions(CMakePackage): + """ + dune-localfunctions provides interface and implementation for shape + functions defined on the DUNE reference elements. In addition to the + shape function, interpolation operators and special keys are + provided which can be used to assemble global function spaces on + finite-element grids. + """ + + homepage = "https://www.dune-project.org" + url = "https://www.dune-project.org/download/2.7.0/dune-localfunctions-2.7.0.tar.gz" + list_url = "https://www.dune-project.org/download/" + list_depth = 1 + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='0dbb8e559cc9ca3a506116fc49648c990a40e3162cf4659289f1d96d602a30fa') + version('2.6.0', sha256='14664b007fbc5e3592740075d2aeca6890e6e185f9924da044fe726ea3fc86a5') + version('2.5.2', sha256='7253fb9186f73bf58d49ecaee22cccd4ad197eff09b07955568307f0cc946958') + version('2.5.1', sha256='4308d45132f463ca6c37cf59f0ef52b30b13dc01afba782c467e7ed6511dd0c0') + version('2.5.0', sha256='d92e05fbfcb10750aba0597eca1c43c3842a657bb53ab7f25c33c1e24cc654ea') + version('2.4.2', sha256='652dea9a47934be62f8c3777a7fda5c1e2d2b2fead5777d180f467acf8472a31') + version('2.4.1', sha256='569cd4839564f4d419e52a51873c3e2b153f9656d77a37e0b5fb22f15423399f') + version('2.4.0', sha256='5edb297ac26901232dd0cb2899a56d562192abe1cc6ac79efec57818359112e3') + + #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') + variant('mkl', default=True, description='Build with Threading Building Blocks library support') + 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') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + variant('python', default=True, description='Build with Python') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + + #dependencies + depends_on('dune-common') + depends_on('dune-geometry') + 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') + depends_on('python@3.0:') + 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') + + patch('AddQuadMathFlags.cmake.patch', when='@2.6') + patch('FindQuadMath.cmake.patch', when='@2.6') + + + def url_for_version(self, version): + url = "https://www.dune-project.org/download/{1}/dune-localfunctions-{1}.tar.gz" + return url.format(version.up_to(2), version) + + 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('-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE') + cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') + + return cmake_args diff --git a/packages/dune-python/AddQuadMathFlags.cmake.patch b/packages/dune-python/AddQuadMathFlags.cmake.patch new file mode 100644 index 0000000..08eb9e9 --- /dev/null +++ b/packages/dune-python/AddQuadMathFlags.cmake.patch @@ -0,0 +1,31 @@ +--- a/cmake/modules/AddQuadMathFlags.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/AddQuadMathFlags.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,28 @@ ++# Defines the functions to use QuadMath ++# ++# .. cmake_function:: add_dune_quadmath_flags ++# ++# .. cmake_param:: targets ++# :positional: ++# :single: ++# :required: ++# ++# A list of targets to use QuadMath with. ++# ++ ++ ++function(add_dune_quadmath_flags _targets) ++ if(QUADMATH_FOUND) ++ foreach(_target ${_targets}) ++ target_link_libraries(${_target} "quadmath") ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-DENABLE_QUADMATH=1 -D_GLIBCXX_USE_FLOAT128=1 ") ++ if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-fext-numeric-literals ") ++ endif() ++ endforeach(_target ${_targets}) ++ endif(QUADMATH_FOUND) ++endfunction(add_dune_quadmath_flags) diff --git a/packages/dune-python/FindQuadMath.cmake.patch b/packages/dune-python/FindQuadMath.cmake.patch new file mode 100644 index 0000000..716d0a1 --- /dev/null +++ b/packages/dune-python/FindQuadMath.cmake.patch @@ -0,0 +1,62 @@ +--- a/cmake/modules/FindQuadMath.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/FindQuadMath.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,59 @@ ++# .. cmake_module:: ++# ++# Find the GCC Quad-Precision library ++# ++# Sets the following variables: ++# ++# :code:`QUADMATH_FOUND` ++# True if the Quad-Precision library was found. ++# ++# ++ ++ ++# search for the header quadmath.h ++include(CheckIncludeFile) ++check_include_file(quadmath.h QUADMATH_HEADER) ++ ++include(CheckCSourceCompiles) ++include(CMakePushCheckState) ++ ++cmake_push_check_state() # Save variables ++set(CMAKE_REQUIRED_LIBRARIES quadmath) ++check_c_source_compiles(" ++#include ++ ++int main () ++{ ++ __float128 r = 1.0q; ++ r = strtoflt128(\"1.2345678\", NULL); ++ return 0; ++}" QUADMATH_COMPILES) ++cmake_pop_check_state() ++ ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ "QuadMath" ++ DEFAULT_MSG ++ QUADMATH_HEADER ++ QUADMATH_COMPILES ++) ++ ++# text for feature summary ++set_package_properties("QuadMath" PROPERTIES ++ DESCRIPTION "GCC Quad-Precision library") ++ ++# set HAVE_QUADMATH for config.h ++set(HAVE_QUADMATH ${QUADMATH_FOUND}) ++ ++# -fext-numeric-literals is a GCC extension not available in other compilers like clang ++if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set(_QUADMATH_EXT_NUMERIC_LITERALS "-fext-numeric-literals") ++endif() ++ ++# register all QuadMath related flags ++if(HAVE_QUADMATH) ++ dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_QUADMATH=1" "_GLIBCXX_USE_FLOAT128=1" ++ COMPILE_OPTIONS ${_QUADMATH_EXT_NUMERIC_LITERALS} ++ LIBRARIES "quadmath") ++endif() diff --git a/packages/dune-python/package.py b/packages/dune-python/package.py new file mode 100644 index 0000000..d545ae7 --- /dev/null +++ b/packages/dune-python/package.py @@ -0,0 +1,169 @@ +# 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: +# +# spack install dune-python +# +# You can edit this file again by typing: +# +# spack edit dune-python +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * +import os + + +class DunePython(CMakePackage): + """ + Python bindings for the DUNE core modules + """ + + homepage = "https://www.dune-project.org" +# url = "https://www.dune-project.org/download/2.6.0/dune-python-2.6.0.tar.gz" + url = 'https://gitlab.dune-project.org/staging/dune-python/-/archive/releases/2.7/dune-python-releases-2.7.tar.gz' + list_url = 'https://gitlab.dune-project.org/staging/dune-python/-/archive/releases/' +# list_url = "https://www.dune-project.org/download/" + list_depth = 1 +# version('2.7.0', url = 'https://gitlab.dune-project.org/staging/dune-python/-/archive/releases/2.7/dune-python-releases-2.7.tar.gz') + + python_components = [ 'dune' ] + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7', sha256='432564c8577f5d3c9e9d6b2b3710189fd3ac9551eac61986f5966d2fa2534c46') + version('2.6', sha256='cc9e9222de850eea659680e41a824bb5d7b300d0e89a8c0855f8d0a31f01ff2d') + + + #option +# ugggrid seems to be a requirement (does not link without) +# variant('uggrid', default=False, description='Build with dune-uggrid support') + + variant('functions', default=False, description='Build with dune-functions support') + 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') + variant('mkl', default=True, description='Build with Math Kernel library support') + 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') + variant('metis', default=True, description='Build METIS library support') + variant('parmetis', default=True, description='Build ParMETIS library support') + variant('arpack', default=True, description='Build ARnoldi PACKage library support') + variant('suitesparse', default=True, description='Build SuiteSparse library support') + variant('superlu', default=True, description='Build Supernodal LU library support') + variant('alberta', default=False, description='Build with Alberta support') + variant('psurface', default=False, description='Build with Psurface support') + variant('amiramesh', default=False, description='Build with AmiraMesh support') + variant('jupyter', default=False, description='Build with Jupyter support') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + variant('oldcategory', default=True, description='Enable/Disable the backwards compatibility of the category enum/method in dune-istl solvers, preconditioner, etc.') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=True, description='Enables the build of shared libraries.') + variant('localfunctions', default=False, description='Support of dune-localfunctions module') + variant('functions', default=False, description='Support of dune-functions module') + variant('alugrid', default=False, description='Support of dune-alugrid module') + variant('fempy', default=False, description='Support of dune-fempy module') + variant('spgrid', default=False, description='Support of dune-spgrid module') + variant('typetree', default=False, description='Support of dune-typetree module') + + extends('python') + + #dependencies + depends_on('dune-grid+python+shared') + depends_on('dune-istl+python+shared') + depends_on('dune-geometry+python+shared') +# depends_on('dune-uggrid', when='+uggrid') + depends_on('dune-uggrid+python+shared') + depends_on('dune-common+python+shared') + depends_on('dune-localfunctions+python+shared', when='+localfunctions') + depends_on('dune-functions+python+shared', when='+functions') + depends_on('dune-alugrid+python+shared', when='+alugrid') + depends_on('dune-fempy+python+shared', when='+fempy') + depends_on('dune-spgrid+python+shared', when='+spgrid') + depends_on('dune-typetree+python+shared', when='+typetree') + 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') + depends_on('python@3.8.2:') + depends_on('py-setuptools', type='build') + depends_on('py-numpy') + depends_on('py-pip') + 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') + depends_on('metis', when='+metis') + depends_on('parmetis', when='+parmetis') + depends_on('arpack-ng', when='+arpack') + depends_on('suite-sparse', when='+suitesparse') + depends_on('superlu', when='+superlu') + depends_on('alberta', when='+alberta') + depends_on('psurface', when='+psurface') + depends_on('amiramesh', when='+amiramesh') + depends_on('py-jupyter', when='+jupyter') + + def url_for_version(self, version): + url = 'https://gitlab.dune-project.org/staging/dune-python/-/archive/releases/{1}/dune-python-releases-{1}.tar.gz' + return url.format(version.up_to(2), version) + + patch('AddQuadMathFlags.cmake.patch') + patch('FindQuadMath.cmake.patch') + + 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'), + '-DDUNE_ISTL_SUPPORT_OLD_CATEGORY=%s' % variant_bool('+oldcategory'), + '-DUSE_PTHREADS:BOOL=%s' % variant_bool('+threads'), + ] +# if 'python' in spec: +# cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') + + return cmake_args + + @run_after('install') + def install_python_components(self): + for package in self.python_components: + print(os.path.dirname(os.path.abspath(__file__))) + build_directory = 'python' + print(self) + with working_dir(join_path(self.build_directory,'python')): + print(working_dir) + print(os.path.dirname(os.path.abspath(__file__))) + print(join_path(self.build_directory,'python')) + setup_py('install', '--prefix={0}'.format(self.prefix)) diff --git a/packages/dune-typetree/AddQuadMathFlags.cmake.patch b/packages/dune-typetree/AddQuadMathFlags.cmake.patch new file mode 100644 index 0000000..08eb9e9 --- /dev/null +++ b/packages/dune-typetree/AddQuadMathFlags.cmake.patch @@ -0,0 +1,31 @@ +--- a/cmake/modules/AddQuadMathFlags.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/AddQuadMathFlags.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,28 @@ ++# Defines the functions to use QuadMath ++# ++# .. cmake_function:: add_dune_quadmath_flags ++# ++# .. cmake_param:: targets ++# :positional: ++# :single: ++# :required: ++# ++# A list of targets to use QuadMath with. ++# ++ ++ ++function(add_dune_quadmath_flags _targets) ++ if(QUADMATH_FOUND) ++ foreach(_target ${_targets}) ++ target_link_libraries(${_target} "quadmath") ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-DENABLE_QUADMATH=1 -D_GLIBCXX_USE_FLOAT128=1 ") ++ if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-fext-numeric-literals ") ++ endif() ++ endforeach(_target ${_targets}) ++ endif(QUADMATH_FOUND) ++endfunction(add_dune_quadmath_flags) diff --git a/packages/dune-typetree/FindQuadMath.cmake.patch b/packages/dune-typetree/FindQuadMath.cmake.patch new file mode 100644 index 0000000..716d0a1 --- /dev/null +++ b/packages/dune-typetree/FindQuadMath.cmake.patch @@ -0,0 +1,62 @@ +--- a/cmake/modules/FindQuadMath.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/FindQuadMath.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,59 @@ ++# .. cmake_module:: ++# ++# Find the GCC Quad-Precision library ++# ++# Sets the following variables: ++# ++# :code:`QUADMATH_FOUND` ++# True if the Quad-Precision library was found. ++# ++# ++ ++ ++# search for the header quadmath.h ++include(CheckIncludeFile) ++check_include_file(quadmath.h QUADMATH_HEADER) ++ ++include(CheckCSourceCompiles) ++include(CMakePushCheckState) ++ ++cmake_push_check_state() # Save variables ++set(CMAKE_REQUIRED_LIBRARIES quadmath) ++check_c_source_compiles(" ++#include ++ ++int main () ++{ ++ __float128 r = 1.0q; ++ r = strtoflt128(\"1.2345678\", NULL); ++ return 0; ++}" QUADMATH_COMPILES) ++cmake_pop_check_state() ++ ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ "QuadMath" ++ DEFAULT_MSG ++ QUADMATH_HEADER ++ QUADMATH_COMPILES ++) ++ ++# text for feature summary ++set_package_properties("QuadMath" PROPERTIES ++ DESCRIPTION "GCC Quad-Precision library") ++ ++# set HAVE_QUADMATH for config.h ++set(HAVE_QUADMATH ${QUADMATH_FOUND}) ++ ++# -fext-numeric-literals is a GCC extension not available in other compilers like clang ++if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set(_QUADMATH_EXT_NUMERIC_LITERALS "-fext-numeric-literals") ++endif() ++ ++# register all QuadMath related flags ++if(HAVE_QUADMATH) ++ dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_QUADMATH=1" "_GLIBCXX_USE_FLOAT128=1" ++ COMPILE_OPTIONS ${_QUADMATH_EXT_NUMERIC_LITERALS} ++ LIBRARIES "quadmath") ++endif() diff --git a/packages/dune-typetree/package.py b/packages/dune-typetree/package.py new file mode 100644 index 0000000..8af05a6 --- /dev/null +++ b/packages/dune-typetree/package.py @@ -0,0 +1,121 @@ +# 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: +# +# spack install dune-istl +# +# You can edit this file again by typing: +# +# spack edit dune-istl +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneTypetree(CMakePackage): + """ + @description@ + """ + + homepage = "https://www.dune-project.org" + url = "https://gitlab.dune-project.org/staging/dune-typetree/-/archive/v2.6.0/dune-typetree-v2.6.0.tar.gz" + list_url = "https://www.dune-project.org/download/" + list_depth = 1 + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='c98d218bdf79549bb2e96fc465e9f9a72f5d88b78090812a59dae85cfee3833e') + version('2.6.0', sha256='5ce06fc396624f654c3f34e333fd5900e992c4596b3230abe68617ed77f64f50') + version('2.5.2', sha256='9fe33fb60b9c9f98100bfc909eb4d56598bae4f036f01f00b4a9fd2498387178') + version('2.5.1', sha256='7e183b1361419620e3df7287d962bcbc1860fa8233588f5b25507ef7a20649dc') + version('2.5.0', sha256='f9af37af1e8186443df384f155d66d2f16e95a909f9574d2bcae85d6d14b95ab') + version('2.4.2', sha256='7e02eaa3d2d054f056709d1c9a91235b73bc0f96b47630f91c914d349093f572') + version('2.4.1', sha256='0ea512e538935812cd6f3a9504f3b06fadff5c15d9d1b0dc499a5a913ea02a4d') + version('2.4.0', sha256='205686b77f7e36d6bc0d2771b1514d98d221b608e5f4efdeeafb1a750e3ca2ba') + + #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') + variant('mkl', default=True, description='Build with Threading Building Blocks library support') + variant('doxygen', default=True, description='Create Doxygen documentation') + variant('sphinx', default=True, description='Create Sphinx documentation') + variant('python', default=True, description='Build with Python') + variant('vc', default=True, description='Build C++ Vectorization library support') + variant('imagemagick', default=False, description='Imagemagick support') + variant('metis', default=True, description='Build METIS library support') + variant('parmetis', default=True, description='Build ParMETIS library support') + variant('suitesparse', default=True, description='Build SuiteSparse library support') + variant('superlu', default=True, description='Build Supernodal LU library support') + variant('arpack', default=True, description='Build ARnoldi PACKage library support') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + + #dependencies + depends_on('dune-common') + 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') + depends_on('python@3.0:') + 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') + depends_on('metis', when='+metis') + depends_on('parmetis', when='+parmetis') + depends_on('suite-sparse', when='+suitesparse') + depends_on('superlu', when='+superlu') + depends_on('arpack-ng', when='+arpack') + + patch('AddQuadMathFlags.cmake.patch', when='@2.6') + patch('FindQuadMath.cmake.patch', when='@2.6') + + def url_for_version(self, version): + url = "https://gitlab.dune-project.org/staging/dune-typetree/-/archive/{1}/dune-typetree-{1}.tar.gz" + return url.format(version.up_to(2), version) + + 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 diff --git a/packages/dune-uggrid/AddQuadMathFlags.cmake.patch b/packages/dune-uggrid/AddQuadMathFlags.cmake.patch new file mode 100644 index 0000000..08eb9e9 --- /dev/null +++ b/packages/dune-uggrid/AddQuadMathFlags.cmake.patch @@ -0,0 +1,31 @@ +--- a/cmake/modules/AddQuadMathFlags.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/AddQuadMathFlags.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,28 @@ ++# Defines the functions to use QuadMath ++# ++# .. cmake_function:: add_dune_quadmath_flags ++# ++# .. cmake_param:: targets ++# :positional: ++# :single: ++# :required: ++# ++# A list of targets to use QuadMath with. ++# ++ ++ ++function(add_dune_quadmath_flags _targets) ++ if(QUADMATH_FOUND) ++ foreach(_target ${_targets}) ++ target_link_libraries(${_target} "quadmath") ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-DENABLE_QUADMATH=1 -D_GLIBCXX_USE_FLOAT128=1 ") ++ if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set_property(TARGET ${_target} ++ APPEND_STRING ++ PROPERTY COMPILE_FLAGS "-fext-numeric-literals ") ++ endif() ++ endforeach(_target ${_targets}) ++ endif(QUADMATH_FOUND) ++endfunction(add_dune_quadmath_flags) diff --git a/packages/dune-uggrid/FindQuadMath.cmake.patch b/packages/dune-uggrid/FindQuadMath.cmake.patch new file mode 100644 index 0000000..716d0a1 --- /dev/null +++ b/packages/dune-uggrid/FindQuadMath.cmake.patch @@ -0,0 +1,62 @@ +--- a/cmake/modules/FindQuadMath.cmake 2020-03-24 07:54:22.548925006 +0100 ++++ b/cmake/modules/FindQuadMath.cmake.patched 2020-03-24 22:53:43.127262894 +0100 +@@ -0,0 +1,59 @@ ++# .. cmake_module:: ++# ++# Find the GCC Quad-Precision library ++# ++# Sets the following variables: ++# ++# :code:`QUADMATH_FOUND` ++# True if the Quad-Precision library was found. ++# ++# ++ ++ ++# search for the header quadmath.h ++include(CheckIncludeFile) ++check_include_file(quadmath.h QUADMATH_HEADER) ++ ++include(CheckCSourceCompiles) ++include(CMakePushCheckState) ++ ++cmake_push_check_state() # Save variables ++set(CMAKE_REQUIRED_LIBRARIES quadmath) ++check_c_source_compiles(" ++#include ++ ++int main () ++{ ++ __float128 r = 1.0q; ++ r = strtoflt128(\"1.2345678\", NULL); ++ return 0; ++}" QUADMATH_COMPILES) ++cmake_pop_check_state() ++ ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ "QuadMath" ++ DEFAULT_MSG ++ QUADMATH_HEADER ++ QUADMATH_COMPILES ++) ++ ++# text for feature summary ++set_package_properties("QuadMath" PROPERTIES ++ DESCRIPTION "GCC Quad-Precision library") ++ ++# set HAVE_QUADMATH for config.h ++set(HAVE_QUADMATH ${QUADMATH_FOUND}) ++ ++# -fext-numeric-literals is a GCC extension not available in other compilers like clang ++if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ++ set(_QUADMATH_EXT_NUMERIC_LITERALS "-fext-numeric-literals") ++endif() ++ ++# register all QuadMath related flags ++if(HAVE_QUADMATH) ++ dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_QUADMATH=1" "_GLIBCXX_USE_FLOAT128=1" ++ COMPILE_OPTIONS ${_QUADMATH_EXT_NUMERIC_LITERALS} ++ LIBRARIES "quadmath") ++endif() diff --git a/packages/dune-uggrid/package.py b/packages/dune-uggrid/package.py new file mode 100644 index 0000000..5582030 --- /dev/null +++ b/packages/dune-uggrid/package.py @@ -0,0 +1,114 @@ +# 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: +# +# spack install dune-uggrid +# +# You can edit this file again by typing: +# +# spack edit dune-uggrid +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack import * + + +class DuneUggrid(CMakePackage): + """ + dune-uggrid is a fork of the old UG finite element software, wrapped + as a Dune module, and stripped of everything but the grid data + structure. + You need this module if you want to use the UGGrid grid + implementation from dune-grid. + """ + + homepage = "https://www.dune-project.org" + url = "https://github.com/dune-mirrors/dune-uggrid/archive/v2.6.0.tar.gz" + + # FIXME: Add a list of GitHub accounts to + # notify when the package is updated. + # maintainers = ['github_user1', 'github_user2'] + + version('2.7.0', sha256='bcf4afd386f23cdb7f7ba16cc2fec4918c4afb516761ef7905af8378ea86eb4c') + version('2.6.0', sha256='3da75c672c151ca711526f2c0619d6f1ebf8f489c972066ee3b43252ea8daed4') + version('2.5.2', sha256='3a484376e625fff880ff9db6be53ccca0080c5ce7229ed31c09e09fa4a4a4afa') + version('2.5.1', sha256='55ccb3a4b4aad0c22c2cda6fa2b50325caf5c4493a9e033562fc03cf5a3b3f61') + version('2.5.0', sha256='b7f5ac061b6d5f30e22a2acfff205a3fc4751f57f1e301db83c66da2b9105bc9') + + #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') + variant('mkl', default=True, description='Build with Threading Building Blocks library support') + 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') + variant('2d', default=True, description='Build library for 2d') + variant('3d', default=True, description='Build library for 3d') + variant('threads', default=True, description='Activate pThread support') + variant('shared', default=False, description='Enables the build of shared libraries.') + variant('python', default=True, description='Build with Python') + variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') + variant('selector', default=True, description='Grid selector definition added to config.h') + + #dependencies + depends_on('dune-common') + depends_on('cmake@3.1:', type='build') + depends_on('cmake@2.8.12:', when='@2.6', 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') + depends_on('python@3.0:') + 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') + + patch('parallel_CMakeList.patch', when='@2.6') + patch('AddQuadMathFlags.cmake.patch') + patch('FindQuadMath.cmake.patch') + + 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"') + if self.spec.variants['build_type'].value == 'Debug': + cmake_args.append('UG_ENABLE_DEBUGGING:BOOL=True') + cmake_args.append('-DUG_ENABLE_2D:BOOL=%s' % variant_bool('+2d')) + cmake_args.append('-DUG_ENABLE_3D:BOOL=%s' % variant_bool('+3d')) + + return cmake_args diff --git a/packages/dune-uggrid/parallel_CMakeList.patch b/packages/dune-uggrid/parallel_CMakeList.patch new file mode 100644 index 0000000..4782f9e --- /dev/null +++ b/packages/dune-uggrid/parallel_CMakeList.patch @@ -0,0 +1,12 @@ +--- a/parallel/CMakeLists.txt 2020-03-24 23:00:09.873941559 +0100 ++++ b/parallel/CMakeLists.txt.patched 2020-03-24 23:11:41.287296340 +0100 +@@ -3,7 +3,8 @@ + # Maybe dune-common should export them? + add_definitions(-DENABLE_MPI=1 -DMPICH_SKIP_MPICXX -DMPIPP_H) + include_directories("${MPI_DUNE_INCLUDE_PATH}") +- set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "${MPI_DUNE_COMPILE_FLAGS}") ++ separate_arguments(MPI_DUNE_COMPILE_FLAGS UNIX_COMMAND "${MPI_DUNE_COMPILE_FLAGS}") ++ set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS ${MPI_DUNE_COMPILE_FLAGS}) + ug_add_dim_libs(parallel OBJECT initparallel.cc) # OBJECT_DIM_LIBS ddd dddif) + endif() +