[cig-commits] r4197 - in long/3D/Gale/trunk: . python/Gale/packages
walter at geodynamics.org
walter at geodynamics.org
Tue Aug 1 16:07:30 PDT 2006
Author: walter
Date: 2006-08-01 16:07:29 -0700 (Tue, 01 Aug 2006)
New Revision: 4197
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/SConstruct.in
long/3D/Gale/trunk/configure.py
long/3D/Gale/trunk/python/Gale/packages/petsc.py
Log:
r566 at earth: boo | 2006-08-01 16:04:32 -0700
Now compiles with a static petsc
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:565
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:566
Modified: long/3D/Gale/trunk/SConstruct.in
===================================================================
--- long/3D/Gale/trunk/SConstruct.in 2006-08-01 23:07:27 UTC (rev 4196)
+++ long/3D/Gale/trunk/SConstruct.in 2006-08-01 23:07:29 UTC (rev 4197)
@@ -62,6 +62,7 @@
for path in Split('@PETSC_LIBPATH@'):
env.Append(LIBPATH=['#/'+path])
env.Append(RPATH=Split('@PETSC_LIBPATH@'))
+env.ParseConfig('echo "@PETSC_DEPS@"')
# Add the local "lib" directory to the linker path
Modified: long/3D/Gale/trunk/configure.py
===================================================================
--- long/3D/Gale/trunk/configure.py 2006-08-01 23:07:27 UTC (rev 4196)
+++ long/3D/Gale/trunk/configure.py 2006-08-01 23:07:29 UTC (rev 4197)
@@ -198,34 +198,34 @@
+'---------------------------------------------------------------------------------------\n' \
+emsg+'*********************************************************************************\n'
se = ''
- except (TypeError, ValueError), e:
- emsg = str(e)
- if not emsg.endswith('\n'): emsg = emsg+'\n'
- msg ='*********************************************************************************\n'\
- +' ERROR in COMMAND LINE ARGUMENT to configure.py \n' \
- +'---------------------------------------------------------------------------------------\n' \
- +emsg+'*********************************************************************************\n'
- se = ''
- except ImportError, e :
- emsg = str(e)
- if not emsg.endswith('\n'): emsg = emsg+'\n'
- msg ='*********************************************************************************\n'\
- +' UNABLE to FIND MODULE for configure.py \n' \
- +'---------------------------------------------------------------------------------------\n' \
- +emsg+'*********************************************************************************\n'
- se = ''
- except SystemExit, e:
- if e.code is None or e.code == 0:
- return
- msg ='*********************************************************************************\n'\
- +' CONFIGURATION CRASH (Please send configure.log to cig-long at geodynamics.org)\n' \
- +'*********************************************************************************\n'
- se = str(e)
- except Exception, e:
- msg ='*********************************************************************************\n'\
- +' CONFIGURATION CRASH (Please send configure.log to cig-long at geodynamics.org)\n' \
- +'*********************************************************************************\n'
- se = str(e)
+# except (TypeError, ValueError), e:
+# emsg = str(e)
+# if not emsg.endswith('\n'): emsg = emsg+'\n'
+# msg ='*********************************************************************************\n'\
+# +' ERROR in COMMAND LINE ARGUMENT to configure.py \n' \
+# +'---------------------------------------------------------------------------------------\n' \
+# +emsg+'*********************************************************************************\n'
+# se = ''
+# except ImportError, e :
+# emsg = str(e)
+# if not emsg.endswith('\n'): emsg = emsg+'\n'
+# msg ='*********************************************************************************\n'\
+# +' UNABLE to FIND MODULE for configure.py \n' \
+# +'---------------------------------------------------------------------------------------\n' \
+# +emsg+'*********************************************************************************\n'
+# se = ''
+# except SystemExit, e:
+# if e.code is None or e.code == 0:
+# return
+# msg ='*********************************************************************************\n'\
+# +' CONFIGURATION CRASH (Please send configure.log to cig-long at geodynamics.org)\n' \
+# +'*********************************************************************************\n'
+# se = str(e)
+# except Exception, e:
+# msg ='*********************************************************************************\n'\
+# +' CONFIGURATION CRASH (Please send configure.log to cig-long at geodynamics.org)\n' \
+# +'*********************************************************************************\n'
+# se = str(e)
print msg
if not framework is None:
Modified: long/3D/Gale/trunk/python/Gale/packages/petsc.py
===================================================================
--- long/3D/Gale/trunk/python/Gale/packages/petsc.py 2006-08-01 23:07:27 UTC (rev 4196)
+++ long/3D/Gale/trunk/python/Gale/packages/petsc.py 2006-08-01 23:07:29 UTC (rev 4197)
@@ -39,31 +39,55 @@
self.languages = framework.require('PETSc.utilities.languages', self)
return
- def check_library_link(self, libraryDir):
+ def check_library_link(self, libraryDir, bmakeDir):
'''Makes sure that the libraries we find will actually link'''
self.logPrint('Checking petsc library in ' + libraryDir)
testLibraries = ['petscksp','petscdm','petscmat','petscvec','petsc']
testFunction = 'KSPDefaultSMonitor'
foundLibrary=True
+ staticLibrary=False
oldLibs = self.compilers.LIBS
if libraryDir:
- # If specifying a library dir, make sure that there is a shared,
- # and not static (.a), version of the library there.
foundLibrary = False
- for ext in ['.so', '.sl', '.dylib', '.dll']:
+ for ext in ['.so', '.sl', '.dylib', '.dll', '.a']:
if os.path.isfile(os.path.join(libraryDir,
'lib' + testLibraries[0] + ext)):
foundLibrary=True
+ if ext=='.a':
+ staticLibrary=True
self.compilers.LIBS += ' -L'+libraryDir
if foundLibrary:
for library in testLibraries:
self.compilers.LIBS += ' -l'+library
self.pushLanguage(self.language[-1])
- if config.setCompilers.Configure.isDarwin():
+
+ # Static libraries require more effort to support, because we have
+ # to get all of the dependencies as well.
+ packages_libs=''
+ packages_includes=''
+
+ print "static library",staticLibrary,bmakeDir + '/petscconf',os.path.exists(bmakeDir + '/petscconf')
+
+ if staticLibrary:
+ if os.path.exists(bmakeDir + '/petscconf'):
+ from distutils.sysconfig import parse_config_h, parse_makefile, \
+ expand_makefile_vars
+ vars={}
+ parse_makefile(bmakeDir + '/petscconf', vars)
+ packages_libs=expand_makefile_vars(str(vars['PACKAGES_LIBS']), vars)
+ packages_includes= \
+ expand_makefile_vars(str(vars['X11_INCLUDE']),vars) + ' ' \
+ + expand_makefile_vars(str(vars['MPI_INCLUDE']),vars) + ' ' \
+ + expand_makefile_vars(str(vars['BLASLAPACK_INCLUDE']),vars)
+ self.compilers.LIBS += ' ' + packages_libs
+ elif config.setCompilers.Configure.isDarwin():
self.compilers.LIBS += ' -framework vecLib'
+
+ print "packages",packages_libs,packages_includes
+
if not self.checkLink('', testFunction+'();\n'):
foundLibrary = False
self.compilers.LIBS = oldLibs
@@ -75,6 +99,7 @@
for library in testLibraries:
self.libs+=library + ' '
self.lib+='-l' + library + ' '
+ self.dependencies=packages_includes + ' ' + packages_libs
return foundLibrary
def check_petsc_dir(self, petsc_dir, petsc_arch):
@@ -94,7 +119,7 @@
self.logPrint("Checking petsc dir with arch " + petsc_dir + " " + arch)
if os.path.isdir(lib_dir) and os.path.isdir(bmake_dir):
if os.path.isfile(os.path.join(petsc_dir,'include','petsc.h')) and \
- self.check_library_link(lib_dir):
+ self.check_library_link(lib_dir,bmake_dir):
found=True
self.cpppath=include_dir + ' ' + bmake_dir
self.libpath=lib_dir
@@ -121,6 +146,7 @@
self.cpppath=''
self.libpath=''
self.libs=''
+ self.dependencies=''
# Set up the petsc arch if supplied, choosing the
# --with-petsc-arch option preferentially over the PETSC_ARCH
@@ -208,11 +234,12 @@
# Check default compiler libraries
if not foundLibrary:
- foundLibrary=self.check_library_link(libraryDir)
+ foundLibrary=self.check_library_link(libraryDir,
+ self.cpppath + '/bmake')
# Check our list of standard paths
if not foundLibrary:
for dir in libraryDirs:
- if self.check_library_link(dir):
+ if self.check_library_link(dir,self.cpppath + '/bmake'):
foundLibrary=True
self.libpath = dir
break
@@ -224,6 +251,7 @@
self.addSubstitution('PETSC_CPPPATH', self.cpppath)
self.addSubstitution('PETSC_LIBPATH', self.libpath)
self.addSubstitution('PETSC_LIBS', self.libs)
+ self.addSubstitution('PETSC_DEPS', self.dependencies)
if hasattr(self.framework, 'packages'):
self.framework.packages.append(self)
else:
More information about the cig-commits
mailing list