xref: /petsc/config/BuildSystem/config/packages/SuperLU.py (revision db36af275f3dcf14e1746c1b2beff84d232bbd9c)
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.gitcommit        = 'a081941' #master/v5.2.1+ from sept-30-2016
8    self.download         = ['git://https://github.com/xiaoyeli/superlu','https://github.com/xiaoyeli/superlu/archive/'+self.gitcommit+'.tar.gz']
9    self.downloaddirnames  = ['SuperLU','superlu']
10    self.functions        = ['set_default_options']
11    self.includes         = ['slu_ddefs.h']
12    self.liblist          = [['libsuperlu.a']]
13    # SuperLU has NO support for 64 bit integers, use SuperLU_Dist if you need that
14    self.requires32bitint = 1;  # 1 means that the package will not work with 64 bit integers
15    self.excludedDirs     = ['superlu_dist','SuperLU_DIST','SuperLU_MT']
16    # SuperLU does not work with --download-fblaslapack with Compaqf90 compiler on windows.
17    # However it should work with intel ifort.
18    self.downloadonWindows= 1
19    self.hastests         = 1
20    self.hastestsdatafiles= 1
21    self.precisions       = ['single','double']
22    return
23
24  def setupDependencies(self, framework):
25    config.package.CMakePackage.setupDependencies(self, framework)
26    self.blasLapack = self.framework.require('config.packages.BlasLapack',self)
27    self.deps       = [self.blasLapack]
28    return
29
30  def formCMakeConfigureArgs(self):
31    args = config.package.CMakePackage.formCMakeConfigureArgs(self)
32    args.append('-DUSE_XSDK_DEFAULTS=YES')
33
34    args.append('-DTPL_BLAS_LIBRARIES="'+self.libraries.toString(self.blasLapack.dlib)+'"')
35
36    #  Tests are broken on Apple since they depend on a shared library that is not resolved against BLAS
37    args.append('-Denable_tests=0')
38    #  CMake in SuperLU should set this; but like many other packages it does not [and its different from superlu_dist]
39    args.append('-DCMAKE_INSTALL_LIBDIR:STRING="'+os.path.join(self.installDir,self.libdir)+'"')
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