Skip to content
Snippets Groups Projects
Commit 416e52c1 authored by Jean-Paul Pelteret's avatar Jean-Paul Pelteret Committed by Todd Gamblin
Browse files

Update SymEngine package (#2919)

Take advantage of new configuration options in the @develop branch
parent db7a786d
No related branches found
No related tags found
No related merge requests found
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import sys
class Symengine(Package): class Symengine(CMakePackage):
"""SymEngine is a fast symbolic manipulation library, written in C++.""" """SymEngine is a fast symbolic manipulation library, written in C++."""
homepage = "https://github.com/symengine/symengine" homepage = "https://github.com/symengine/symengine"
...@@ -35,7 +36,9 @@ class Symengine(Package): ...@@ -35,7 +36,9 @@ class Symengine(Package):
version('0.1.0', '41ad7daed61fc5a77c285eb6c7303425') version('0.1.0', '41ad7daed61fc5a77c285eb6c7303425')
version('develop', git='https://github.com/symengine/symengine.git') version('develop', git='https://github.com/symengine/symengine.git')
variant('flint', default=True, variant('boostmp', default=False,
description='Compile with Boost multi-precision integer library')
variant('flint', default=False,
description='Compile with Flint integer library') description='Compile with Flint integer library')
variant('mpc', default=True, variant('mpc', default=True,
description='Compile with MPC library') description='Compile with MPC library')
...@@ -54,20 +57,22 @@ class Symengine(Package): ...@@ -54,20 +57,22 @@ class Symengine(Package):
depends_on('cmake', type='build') depends_on('cmake', type='build')
# Other dependencies # Other dependencies
depends_on('gmp') # mpir is a drop-in replacement for this # NOTE: mpir is a drop-in replacement for gmp
depends_on('mpc', when='+mpc') # Could also be built against mpir # NOTE: [mpc,mpfr,flint,piranha] could also be built against mpir
depends_on('mpfr', when='+mpfr') # Could also be built against mpir depends_on('boost', when='+boostmp')
depends_on('flint', when='+flint') # Could also be built against mpir depends_on('gmp', when='~boostmp')
depends_on('piranha', when='+piranha~flint') # Could also be built against mpir # NOQA depends_on('mpc', when='+mpc~boostmp')
depends_on('mpfr', when='+mpfr~boostmp')
depends_on('flint', when='+flint~boostmp')
depends_on('piranha', when='+piranha~flint~boostmp')
def install(self, spec, prefix): def build_type(self):
options = [] # CMAKE_BUILD_TYPE should be Debug | Release
options.extend(std_cmake_args) return 'Release'
# CMAKE_BUILD_TYPE should be Debug | Release def cmake_args(self):
for word in options[:]: spec = self.spec
if word.startswith('-DCMAKE_BUILD_TYPE'): options = []
options.remove(word)
# See https://github.com/symengine/symengine/blob/master/README.md # See https://github.com/symengine/symengine/blob/master/README.md
# for build options # for build options
...@@ -76,38 +81,47 @@ def install(self, spec, prefix): ...@@ -76,38 +81,47 @@ def install(self, spec, prefix):
'-DWITH_SYMENGINE_RCP:BOOL=ON', '-DWITH_SYMENGINE_RCP:BOOL=ON',
'-DWITH_SYMENGINE_THREAD_SAFE:BOOL=%s' % ( '-DWITH_SYMENGINE_THREAD_SAFE:BOOL=%s' % (
'ON' if ('+thread_safe' or '+openmp') in spec else 'OFF'), 'ON' if ('+thread_safe' or '+openmp') in spec else 'OFF'),
'-DBUILD_TESTS:BOOL=ON', '-DBUILD_TESTS:BOOL=%s' % (
'ON' if self.run_tests else 'OFF'),
'-DBUILD_BENCHMARKS:BOOL=ON', '-DBUILD_BENCHMARKS:BOOL=ON',
'-DWITH_MPC:BOOL=%s' % (
'ON' if '+mpc' in spec else 'OFF'),
'-DWITH_MPFR:BOOL=%s' % (
'ON' if '+mpfr' in spec else 'OFF'),
'-DINTEGER_CLASS:STRING=gmp',
'-DWITH_OPENMP:BOOL=%s' % ( '-DWITH_OPENMP:BOOL=%s' % (
'ON' if '+openmp' in spec else 'OFF'), 'ON' if '+openmp' in spec else 'OFF'),
'-DBUILD_SHARED_LIBS:BOOL=%s' % ( '-DBUILD_SHARED_LIBS:BOOL=%s' % (
'ON' if '+shared' in spec else 'OFF'), 'ON' if '+shared' in spec else 'OFF'),
]) ])
if '+flint' in spec: if sys.platform == 'darwin':
options.extend([ options.extend([
'-DWITH_FLINT:BOOL=ON', '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=on'
'-DINTEGER_CLASS:STRING=flint'
]) ])
elif '+piranha' in spec:
if '+boostmp' in spec:
options.extend([ options.extend([
'-DWITH_PIRANHA:BOOL=ON', '-DINTEGER_CLASS:STRING=boostmp',
'-DINTEGER_CLASS:STRING=piranha' '-DBoost_INCLUDE_DIR=%s' % spec['boost'].prefix.include,
'-DWITH_MPC:BOOL=OFF',
'-DWITH_MPFR:BOOL=OFF',
]) ])
else: else:
options.extend([ options.extend([
'-DINTEGER_CLASS:STRING=gmp' '-DWITH_MPC:BOOL=%s' % (
'ON' if '+mpc' in spec else 'OFF'),
'-DWITH_MPFR:BOOL=%s' % (
'ON' if '+mpfr' in spec else 'OFF'),
]) ])
if '+flint' in spec:
options.extend([
'-DWITH_FLINT:BOOL=ON',
'-DINTEGER_CLASS:STRING=flint'
])
elif '+piranha' in spec:
options.extend([
'-DWITH_PIRANHA:BOOL=ON',
'-DINTEGER_CLASS:STRING=piranha'
])
else:
options.extend([
'-DINTEGER_CLASS:STRING=gmp'
])
with working_dir('spack-build', create=True): return options
cmake('..', *options)
make()
make('install')
if self.run_tests:
ctest()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment