Update SymEngine package (#2919)
Take advantage of new configuration options in the @develop branch
This commit is contained in:
		 Jean-Paul Pelteret
					Jean-Paul Pelteret
				
			
				
					committed by
					
						 Todd Gamblin
						Todd Gamblin
					
				
			
			
				
	
			
			
			 Todd Gamblin
						Todd Gamblin
					
				
			
						parent
						
							db7a786d1c
						
					
				
				
					commit
					416e52c150
				
			| @@ -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): | |||||||
|     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): | |||||||
|     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') | ||||||
|     def install(self, spec, prefix): |     depends_on('flint',    when='+flint~boostmp') | ||||||
|         options = [] |     depends_on('piranha',  when='+piranha~flint~boostmp') | ||||||
|         options.extend(std_cmake_args) |  | ||||||
|  |  | ||||||
|  |     def build_type(self): | ||||||
|         # CMAKE_BUILD_TYPE should be  Debug | Release |         # CMAKE_BUILD_TYPE should be  Debug | Release | ||||||
|         for word in options[:]: |         return 'Release' | ||||||
|             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 |         # See https://github.com/symengine/symengine/blob/master/README.md | ||||||
|         # for build options |         # for build options | ||||||
| @@ -76,19 +81,34 @@ 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 sys.platform == 'darwin': | ||||||
|  |             options.extend([ | ||||||
|  |                 '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=on' | ||||||
|  |             ]) | ||||||
|  |  | ||||||
|  |         if '+boostmp' in spec: | ||||||
|  |             options.extend([ | ||||||
|  |                 '-DINTEGER_CLASS:STRING=boostmp', | ||||||
|  |                 '-DBoost_INCLUDE_DIR=%s' % spec['boost'].prefix.include, | ||||||
|  |                 '-DWITH_MPC:BOOL=OFF', | ||||||
|  |                 '-DWITH_MPFR:BOOL=OFF', | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             options.extend([ | ||||||
|  |                 '-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: |             if '+flint' in spec: | ||||||
|                 options.extend([ |                 options.extend([ | ||||||
|                     '-DWITH_FLINT:BOOL=ON', |                     '-DWITH_FLINT:BOOL=ON', | ||||||
| @@ -104,10 +124,4 @@ def install(self, spec, prefix): | |||||||
|                     '-DINTEGER_CLASS:STRING=gmp' |                     '-DINTEGER_CLASS:STRING=gmp' | ||||||
|                 ]) |                 ]) | ||||||
|  |  | ||||||
|         with working_dir('spack-build', create=True): |         return options | ||||||
|             cmake('..', *options) |  | ||||||
|  |  | ||||||
|             make() |  | ||||||
|             make('install') |  | ||||||
|             if self.run_tests: |  | ||||||
|                 ctest() |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user