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