Dummy module to facilitate developement of new modules
This commit is contained in:
parent
bbd682d03d
commit
8076c3b4f8
|
@ -58,6 +58,8 @@ class DuneFunctions(CMakePackage):
|
|||
variant('amiramesh', default=False, description='Build with AmiraMesh support')
|
||||
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('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=True, description='Enables the build of shared libraries.')
|
||||
variant('alugrid', default=False, description='Support of dune-alugrid module')
|
||||
|
@ -67,8 +69,7 @@ class DuneFunctions(CMakePackage):
|
|||
|
||||
#dependencies
|
||||
depends_on('dune-localfunctions')
|
||||
depends_on('dune-grid')
|
||||
depends_on('dune-grid+uggrid', when='+uggrid')
|
||||
depends_on('dune-grid+uggrid')
|
||||
depends_on('dune-typetree')
|
||||
depends_on('dune-istl')
|
||||
depends_on('dune-common+python+shared')
|
||||
|
|
|
@ -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)
|
|
@ -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()
|
|
@ -0,0 +1,78 @@
|
|||
|
||||
from spack import *
|
||||
|
||||
|
||||
class DuneNewmodule(CMakePackage):
|
||||
"""Abstractions for functions and discrete function space bases"""
|
||||
|
||||
|
||||
homepage = "https://www.dune-project.org"
|
||||
url = "https://gitlab.dune-project.org/staging/"
|
||||
list_url = 'https://gitlab.dune-project.org/staging/dune-functions/-/archive/releases/'
|
||||
list_depth = 1
|
||||
|
||||
version('2.7', sha256='0')
|
||||
|
||||
|
||||
#option
|
||||
variant('geometry', default=True, description='Build with dune-geometry support')
|
||||
variant('grid', default=True, description='Build with dune-grid support')
|
||||
variant('istl', default=True, description='Build with dune-istl support')
|
||||
variant('localfunctions', default=True, description='Build with dune-localfunctions support')
|
||||
variant('uggrid', default=True, description='Build with dune-uggrid support')
|
||||
variant('functions', default=True, description='Build with dune-functions support')
|
||||
variant('python', default=True, description='Build with dune-python support')
|
||||
variant('typetree', default=True, description='Build with dune-typetree support')
|
||||
|
||||
variant('alugrid', default=False, description='Build with dune-alugrid support')
|
||||
|
||||
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('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=True, description='Enables the build of shared libraries.')
|
||||
|
||||
#dependencies
|
||||
depends_on('dune-common',type=('build', 'link', 'run'))
|
||||
depends_on('dune-alugrid', when='+alugrid')
|
||||
depends_on('dune-functions', when='+functions')
|
||||
depends_on('dune-geometry', when='+geometry')
|
||||
depends_on('dune-istl', when='+istl')
|
||||
depends_on('dune-localfunctions', when='+localfunctions')
|
||||
depends_on('dune-python', when='+python')
|
||||
depends_on('dune-typetree', when='+typetree')
|
||||
depends_on('dune-grid+uggrid', when='+grid')
|
||||
depends_on('dune-uggrid', when='+uggrid')
|
||||
|
||||
depends_on('cmake@3.1:', type='build')
|
||||
|
||||
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
|
||||
|
|
@ -46,7 +46,7 @@ class DuneUggrid(CMakePackage):
|
|||
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('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')
|
||||
|
|
Loading…
Reference in New Issue