xref: /petsc/config/BuildSystem/config/packages/SuperLU.py (revision d9acb416d05abeed0a33bde3a81aeb2ea0364f6a)
1import config.package
2import os
3
4class Configure(config.package.CMakePackage):
5  def __init__(self, framework):
6    config.package.CMakePackage.__init__(self, framework)
7    self.version          = '6.0.1'
8    self.minversion       = '5.2.1' # bugs in 5.2.0 prevent it from functioning
9    self.versionname      = 'SUPERLU_MAJOR_VERSION.SUPERLU_MINOR_VERSION.SUPERLU_PATCH_VERSION'
10    self.gitcommit        = 'v'+self.version
11    self.download         = ['git://https://github.com/xiaoyeli/superlu','https://github.com/xiaoyeli/superlu/archive/'+self.gitcommit+'.tar.gz']
12    self.functions        = ['set_default_options']
13    self.includes         = ['slu_ddefs.h']
14    self.liblist          = [['libsuperlu.a']]
15    # SuperLU has NO support for 64-bit integers, use SuperLU_Dist if you need that
16    self.requires32bitint = 1;  # 1 means that the package will not work with 64-bit integers
17    self.excludedDirs     = ['superlu_dist','superlu_mt']
18    # SuperLU does not work with --download-fblaslapack with Compaqf90 compiler on windows.
19    # However it should work with intel ifort.
20    self.downloadonWindows= 1
21    self.hastests         = 1
22    self.hastestsdatafiles= 1
23    self.precisions       = ['single','double']
24    return
25
26  def setupDependencies(self, framework):
27    config.package.CMakePackage.setupDependencies(self, framework)
28    self.blasLapack = self.framework.require('config.packages.BlasLapack',self)
29    self.deps       = [self.blasLapack]
30    return
31
32  def formCMakeConfigureArgs(self):
33    args = config.package.CMakePackage.formCMakeConfigureArgs(self)
34    args.append('-DUSE_XSDK_DEFAULTS=YES')
35    args.append('-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=TRUE')
36    args.append('-DTPL_BLAS_LIBRARIES="'+self.libraries.toString(self.blasLapack.dlib)+'"')
37
38    #  Tests are broken on Apple since they depend on a shared library that is not resolved against BLAS
39    args.append('-Denable_tests=0')
40
41    if not hasattr(self.compilers, 'FC'):
42      args.append('-DXSDK_ENABLE_Fortran=OFF')
43
44    # Add in fortran mangling flag
45    if self.blasLapack.mangling == 'underscore':
46      mangledef = '-DAdd_'
47    elif self.blasLapack.mangling == 'caps':
48      mangledef = '-DUpCase'
49    else:
50      mangledef = '-DNoChange'
51    for place,item in enumerate(args):
52      if item.find('CMAKE_C_FLAGS') >= 0 or item.find('CMAKE_CXX_FLAGS') >= 0:
53        args[place]=item[:-1]+' '+mangledef+'"'
54
55    return args
56
57