First commit
This commit is contained in:
31
packages/dune-localfunctions/AddQuadMathFlags.cmake.patch
Normal file
31
packages/dune-localfunctions/AddQuadMathFlags.cmake.patch
Normal file
@ -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)
|
62
packages/dune-localfunctions/FindQuadMath.cmake.patch
Normal file
62
packages/dune-localfunctions/FindQuadMath.cmake.patch
Normal file
@ -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 <quadmath.h>
|
||||
+
|
||||
+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()
|
118
packages/dune-localfunctions/package.py
Normal file
118
packages/dune-localfunctions/package.py
Normal file
@ -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
|
Reference in New Issue
Block a user