muparser: minor fixes to 2.2.5 and add 2.2.6 with CMake (#9724)

* muparser: minor fixes to 2.2.5 and add 2.2.6 with CMake
* dealii: make muparser optional
This commit is contained in:
Denis Davydov 2018-11-08 09:05:52 +00:00 committed by Massimiliano Culpo
parent da193a07a3
commit 8f4d6caf32
2 changed files with 27 additions and 4 deletions

View file

@ -46,6 +46,7 @@ class Dealii(CMakePackage, CudaPackage):
variant('hdf5', default=True,
description='Compile with HDF5 (only with MPI)')
variant('metis', default=True, description='Compile with Metis')
variant('muparser', default=True, description='Compile with muParser')
variant('nanoflann', default=True, description='Compile with Nanoflann')
variant('netcdf', default=True,
description='Compile with Netcdf (only with MPI)')
@ -103,7 +104,6 @@ class Dealii(CMakePackage, CudaPackage):
# bzip2 is not needed since 9.0
depends_on('bzip2', when='@:8.99')
depends_on('lapack')
depends_on('muparser')
depends_on('suite-sparse')
depends_on('tbb')
depends_on('zlib')
@ -127,6 +127,7 @@ class Dealii(CMakePackage, CudaPackage):
# but we should not need it
depends_on('metis@5:+int64+real64', when='+metis+int64')
depends_on('metis@5:~int64+real64', when='+metis~int64')
depends_on('muparser', when='+muparser')
depends_on('nanoflann', when='@9.0:+nanoflann')
depends_on('netcdf+mpi', when='+netcdf+mpi')
depends_on('netcdf-cxx', when='+netcdf+mpi')
@ -201,7 +202,6 @@ def cmake_args(self):
'-DLAPACK_INCLUDE_DIRS=%s;%s' % (
spec['lapack'].prefix.include, spec['blas'].prefix.include),
'-DLAPACK_LIBRARIES=%s' % lapack_blas.joined(';'),
'-DMUPARSER_DIR=%s' % spec['muparser'].prefix,
'-DUMFPACK_DIR=%s' % spec['suite-sparse'].prefix,
'-DTBB_DIR=%s' % spec['tbb'].prefix,
'-DZLIB_DIR=%s' % spec['zlib'].prefix,
@ -301,7 +301,7 @@ def cmake_args(self):
# variables:
for library in (
'gsl', 'hdf5', 'p4est', 'petsc', 'slepc', 'trilinos', 'metis',
'sundials', 'nanoflann', 'assimp', 'gmsh'):
'sundials', 'nanoflann', 'assimp', 'gmsh', 'muparser'):
if ('+' + library) in spec:
options.extend([
'-D%s_DIR=%s' % (library.upper(), spec[library].prefix),

View file

@ -11,6 +11,9 @@ class Muparser(Package):
homepage = "http://muparser.beltoforion.de/"
url = "https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz"
version('2.2.6.1', '410d29b4c58d1cdc2fc9ed1c1c7f67fe')
# 2.2.6 presents itself as 2.2.5, don't add it to Spack
# version('2.2.6', 'f197b2815ca0422b2091788a78f2dc8a')
version('2.2.5', '02dae671aa5ad955fdcbcd3fee313fb7')
# Replace std::auto_ptr by std::unique_ptr
@ -18,10 +21,30 @@ class Muparser(Package):
patch('auto_ptr.patch',
when='@2.2.5')
depends_on('cmake@3.1.0:', when='@2.2.6:', type='build')
# Cmake build since 2.2.6
@when('@2.2.6:')
def install(self, spec, prefix):
cmake_args = [
'-DENABLE_SAMPLES=OFF',
'-DENABLE_OPENMP=OFF',
'-DBUILD_SHARED_LIBS=ON'
]
cmake_args.extend(std_cmake_args)
with working_dir('spack-build', create=True):
cmake('..', *cmake_args)
make()
make('install')
@when('@2.2.5')
def install(self, spec, prefix):
options = ['--disable-debug',
'--disable-samples',
'--disable-dependency-tracking',
'CXXFLAGS=-std=c++11',
'CXXFLAGS={0}'.format(self.compiler.cxx11_flag),
'--prefix=%s' % prefix]
configure(*options)