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 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import sys
class Symengine(Package):
class Symengine(CMakePackage):
"""SymEngine is a fast symbolic manipulation library, written in C++."""
homepage = "https://github.com/symengine/symengine"
......@@ -35,7 +36,9 @@ class Symengine(Package):
version('0.1.0', '41ad7daed61fc5a77c285eb6c7303425')
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')
variant('mpc', default=True,
description='Compile with MPC library')
......@@ -54,20 +57,22 @@ class Symengine(Package):
depends_on('cmake', type='build')
# Other dependencies
depends_on('gmp') # mpir is a drop-in replacement for this
depends_on('mpc', when='+mpc') # Could also be built against mpir
depends_on('mpfr', when='+mpfr') # Could also be built against mpir
depends_on('flint', when='+flint') # Could also be built against mpir
depends_on('piranha', when='+piranha~flint') # Could also be built against mpir # NOQA
# NOTE: mpir is a drop-in replacement for gmp
# NOTE: [mpc,mpfr,flint,piranha] could also be built against mpir
depends_on('boost', when='+boostmp')
depends_on('gmp', when='~boostmp')
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):
options = []
options.extend(std_cmake_args)
def build_type(self):
# CMAKE_BUILD_TYPE should be Debug | Release
return 'Release'
# CMAKE_BUILD_TYPE should be Debug | Release
for word in options[:]:
if word.startswith('-DCMAKE_BUILD_TYPE'):
options.remove(word)
def cmake_args(self):
spec = self.spec
options = []
# See https://github.com/symengine/symengine/blob/master/README.md
# for build options
......@@ -76,38 +81,47 @@ def install(self, spec, prefix):
'-DWITH_SYMENGINE_RCP:BOOL=ON',
'-DWITH_SYMENGINE_THREAD_SAFE:BOOL=%s' % (
'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',
'-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' % (
'ON' if '+openmp' in spec else 'OFF'),
'-DBUILD_SHARED_LIBS:BOOL=%s' % (
'ON' if '+shared' in spec else 'OFF'),
])
if '+flint' in spec:
if sys.platform == 'darwin':
options.extend([
'-DWITH_FLINT:BOOL=ON',
'-DINTEGER_CLASS:STRING=flint'
'-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=on'
])
elif '+piranha' in spec:
if '+boostmp' in spec:
options.extend([
'-DWITH_PIRANHA:BOOL=ON',
'-DINTEGER_CLASS:STRING=piranha'
'-DINTEGER_CLASS:STRING=boostmp',
'-DBoost_INCLUDE_DIR=%s' % spec['boost'].prefix.include,
'-DWITH_MPC:BOOL=OFF',
'-DWITH_MPFR:BOOL=OFF',
])
else:
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):
cmake('..', *options)
make()
make('install')
if self.run_tests:
ctest()
return options
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