[cig-commits] commit: Updating latest changes to the SCons scripts.

Mercurial hg at geodynamics.org
Mon Nov 24 11:22:39 PST 2008


changeset:   14:8868b2a3c2e3
user:        LukeHodkinson
date:        Thu Feb 07 05:59:29 2008 +0000
files:       SConfigure SConsUtils SConstruct
description:
Updating latest changes to the SCons scripts.


diff -r 1e7bd9de39a2 -r 8868b2a3c2e3 SConfigure
--- a/SConfigure	Thu Feb 07 04:43:09 2008 +0000
+++ b/SConfigure	Thu Feb 07 05:59:29 2008 +0000
@@ -48,7 +48,7 @@ void METHOD(int *i){printf("FORTRAN_UPPE
     return res[0]
 
 #
-# Custom package classes.
+# Some functions for processing certain search paths.
 #
 
 def petsc_get_arch(base_dir):
@@ -151,6 +151,7 @@ if not env.GetOption('clean'):
 
     mpich = env.Package('MPICH', env)
     mpich.pkg_dirs = ['mpich*', 'MPICH*']
+    mpich.lib_sub_dirs = ['', 'shared']
     mpich.hdrs = ['mpi.h']
     mpich.libs = ['mpich',
                   ('mpich', 'pmpich'),
@@ -176,7 +177,7 @@ if not env.GetOption('clean'):
 
     libxml = env.Package('libXML2', env)
     libxml.pkg_dirs = ['libxml2', 'libXML2']
-    libxml.hdr_sub_dir = 'libxml2'
+    libxml.hdr_sub_dirs = ['libxml2']
     libxml.hdrs = ['libxml/xmlIO.h']
     libxml.libs = ['libxml2']
 
@@ -236,7 +237,7 @@ if not env.GetOption('clean'):
     #
 
     ogl = env.Package('OpenGL', env)
-    ogl.hdr_sub_dir = 'GL'
+    ogl.hdr_sub_dirs = ['GL']
     ogl.hdrs = ['gl.h', 'glu.h']
     ogl.libs = [('GL', 'GLU')]
     ogl.frameworks = ['OpenGL']
diff -r 1e7bd9de39a2 -r 8868b2a3c2e3 SConsUtils
--- a/SConsUtils	Thu Feb 07 04:43:09 2008 +0000
+++ b/SConsUtils	Thu Feb 07 05:59:29 2008 +0000
@@ -194,8 +194,9 @@ return 0;
         self.sub_dirs = []
 
         # Some libraries pack headers under their own subdirectory
-        # (i.e. libXML2).
-        self.hdr_sub_dir = ''
+        # (i.e. libXML2). Same for library directories.
+        self.hdr_sub_dirs = []
+        self.lib_sub_dirs = []
 
         # Place any headers that should be checked for here.
         self.hdrs = []
@@ -227,6 +228,15 @@ return 0;
         self.env_opts = None
         self.opt_entries = None
         self.build_options()
+
+        # Setup some default locations we shouldn't try and override.
+        if self.system in ['Darwin', 'Linux']:
+            self.def_hdr_dirs = ['/usr/include']
+            self.def_lib_dirs = ['/usr/lib', '/usr/lib64']
+
+        else:
+            self.def_hdr_dirs = []
+            self.def_lib_dirs = []
 
     def build_options(self):
         # Build the command line options.
@@ -300,12 +310,33 @@ return 0;
         if not self.sub_dirs:
             # Now append any usual subdirectories to our list.
             if self.system in ['Darwin', 'Linux']:
-                lib_dir = 'lib' if self.bits == 32 else 'lib64'
-                self.sub_dirs = [('include', lib_dir)]
-                if self.hdr_sub_dir:
-                    self.sub_dirs += [(os.path.join('include',
-                                                    self.hdr_sub_dir),
-                                       lib_dir)]
+                # Figure out the order of library extension directories.
+                exts = []
+                if self.bits == 64:
+                    exts += ['lib64']
+                exts += ['lib']
+
+                # If we have library sub-directories, add them in.
+                if self.lib_sub_dirs:
+                    lib_dirs = []
+                    for d in self.lib_sub_dirs:
+                        lib_dirs += [os.path.join(e, d) for e in exts]
+                else:
+                    lib_dirs = exts
+
+                # If we have header sub-directories, add them in.
+                if self.hdr_sub_dirs:
+                    hdr_dirs = []
+                    for d in self.hdr_sub_dirs:
+                        hdr_dirs += [os.path.join('include', d)]
+                else:
+                    hdr_dirs = ['include']
+
+                # Compile our sub-directory tuples.
+                self.sub_dirs = []
+                for h in hdr_dirs:
+                    for l in lib_dirs:
+                        self.sub_dirs += [(h, l)]
 
             elif self.system == 'Windows':
                 pass # TODO
@@ -380,6 +411,10 @@ return 0;
                     else:
                         hdr_dir = [os.path.join(base, sub[0])]
 
+                    # Don't include it if it's a default location.
+                    hdr_dir = [h for h in hdr_dir \
+                                   if h not in self.def_hdr_dirs]
+
                 # Were we given library directories?
                 if olib_dir:
                     lib_dir = olib_dir
@@ -389,6 +424,10 @@ return 0;
                         lib_dir = [os.path.join(base, s) for s in sub[1]]
                     else:
                         lib_dir = [os.path.join(base, sub[1])]
+
+                    # Don't include it if it's a default location.
+                    lib_dir = [h for h in lib_dir \
+                                   if h not in self.def_lib_dirs]
 
                 # Permute with libraries.
                 for l in libs:
diff -r 1e7bd9de39a2 -r 8868b2a3c2e3 SConstruct
--- a/SConstruct	Thu Feb 07 04:43:09 2008 +0000
+++ b/SConstruct	Thu Feb 07 05:59:29 2008 +0000
@@ -80,33 +80,27 @@ env.BuildDir('build', '.', duplicate=0)
 
 env.clear_all()
 SConscript('build/StGermain/SConscript', exports='env')
-#env.Append(CPPPATH=['#build/include/StGermain'])
 env.Append(LIBS=['StGermain'])
 
 env.clear_all()
 SConscript('build/StgDomain/SConscript', exports='env')
-#env.Append(CPPPATH=['#build/include/StgDomain'])
 env.Append(LIBS=['StgDomain'])
 
 env.clear_all()
 SConscript('build/StgFEM/SConscript', exports='env')
-#env.Append(CPPPATH=['#build/include/StgFEM'])
 env.Append(LIBS=['StgFEM'])
 
 env.clear_all()
 SConscript('build/PICellerator/SConscript', exports='env')
-#env.Append(CPPPATH=['#build/include/PICellerator'])
 env.Append(LIBS=['PICellerator'])
 
 env.clear_all()
 SConscript('build/Underworld/SConscript', exports='env')
-#env.Append(CPPPATH=['#build/include/Underworld'])
 env.Append(LIBS=['Underworld'])
 
-env.clear_all()
-SConscript('build/Experimental/SConscript', exports='env')
-#env.Append(CPPPATH=['#build/include/Experimental'])
-env.Append(LIBS=['Underworld'])
+#env.clear_all()
+#SConscript('build/Magma/SConscript', exports='env')
+#env.Append(LIBS=['Magma'])
 
 env.clear_all()
 SConscript('build/gLucifer/SConscript', exports='env')



More information about the CIG-COMMITS mailing list