[cig-commits] r5061 - long/3D/Gale/trunk

walter at geodynamics.org walter at geodynamics.org
Tue Oct 17 07:34:05 PDT 2006


Author: walter
Date: 2006-10-17 07:34:04 -0700 (Tue, 17 Oct 2006)
New Revision: 5061

Added:
   long/3D/Gale/trunk/SConstruct_msvc
Modified:
   long/3D/Gale/trunk/
Log:
 r982 at earth:  boo | 2006-10-17 07:32:35 -0700
 Add SConstruct_msvc



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:977
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:982

Added: long/3D/Gale/trunk/SConstruct_msvc
===================================================================
--- long/3D/Gale/trunk/SConstruct_msvc	2006-10-17 11:00:23 UTC (rev 5060)
+++ long/3D/Gale/trunk/SConstruct_msvc	2006-10-17 14:34:04 UTC (rev 5061)
@@ -0,0 +1,276 @@
+# Builds everything for StGermain
+
+# Note that SConstruct is created by running configure.py over
+# SConstruct.in
+
+# Copyright (C) 2006 California Institute of Technology
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+import os
+import sys
+
+env=Environment(ENV=os.environ, CC='cl',LINK='link')
+
+#cflags='@CFLAGS@'
+#if len(cflags)!=0:
+#    env.Append(CCFLAGS=Split('@CFLAGS@'))
+
+env.Append(CCFLAGS=Split('/MT'))
+env.Append(CPPFLAGS=['/D_CRT_SECURE_NO_DEPRECATE','/Dstrcasecmp=_stricmp','/Dstrncasecmp=_strnicmp','/Disnan=_isnan','/Disinf=!_finite'])
+
+env.Append(CPPPATH=['#/build/include'])
+env.Append(CPPPATH=['#/build/include/StGermain'])
+env.Append(CPPFLAGS=['/DVERSION=\\"3519\\"'])
+#env.Append(SHLINKFLAGS=Split('@SHARED_LIBRARY_FLAG@'))
+# Only use shared libraries if so configured.
+with_shared=False
+env.Append(CPPFLAGS=['/DNOSHARED'])
+
+Export('with_shared')
+
+
+# Add in the MPI paths
+for path in ['C:/Program Files/MPICH2/include']:
+    env.Append(CPPPATH=['#/'+path])
+env.Append(LIBS=Split('mpich2'))
+for path in ['C:/Program Files/MPICH2/lib']:
+    env.Append(LIBPATH=['#/'+path])
+
+
+# Add in the libxml2 paths
+for path in Split('C:/cygwin/home/walter/libxml_local/include'):
+    env.Append(CPPPATH=['#/'+path])
+env.Append(LIBS=Split('libxml2_a'))
+for path in Split('C:/cygwin/home/walter/libxml_local/lib'):
+    env.Append(LIBPATH=['#/'+path])
+
+# Add in the petsc paths
+for path in ['C:/cygwin/home/walter/binary/petsc-2.3.1-p16/include','C:/cygwin/home/walter/binary/petsc-2.3.1-p16/bmake/cygwin-c-real-debug']:
+    env.Append(CPPPATH=['#/'+path])
+env.Append(LIBS=Split('libpetscksp libpetscdm libpetscmat libpetscvec libpetsc '))
+for path in ['C:/cygwin/home/walter/binary/petsc-2.3.1-p16/lib/cygwin-c-real-debug']:
+    env.Append(LIBPATH=['#/'+path])
+
+
+env.Append(LIBPATH=["C:/cygwin/home/walter/binary/petsc-2.3.1-p16/externalpackages/f2cblaslapack/cygwin-c-real-debug"])
+
+env.Append(LIBS=["libf2clapack","libf2cblas","Gdi32","User32","Advapi32","Kernel32","Ws2_32"])
+
+env.Append(CPPFLAGS=['/DLIBXML_STATIC'])
+env.Append(CPPFLAGS=['/D__func__=__FUNCTION__'])
+env.Append(CPPFLAGS=['/DNO_VA_COPY'])
+env.Append(CPPFLAGS=['/DNO_UNISTD'])
+env.Append(CPPFLAGS=['/DNO_ERF'])
+
+
+# Set up stuff for a static build
+
+env.Append(FRAMEWORKS=["vecLib"])
+
+if os.getenv("STATIC_BUILD"):
+    if with_shared:
+        print "Can not make a static build if you configured using --with-shared"
+        sys.exit(1)
+    env.Append(LINKFLAGS=Split("-static -shared-libgcc"))
+    env.Append(LIBS=Split('z g2c'))
+
+# Add the local "lib" directory to the linker path
+
+env.Append(LIBPATH=['#/build/lib'])
+
+#cppflags='@CPPFLAGS@'
+#if len(cppflags)!=0:
+#    env.Append(CPPFLAGS=Split('@CPPFLAGS@'))
+#ldflags='@LDFLAGS@'
+#if len(ldflags)!=0:
+#    env.Append(LINKFLAGS=Split('@LDFLAGS@'))
+
+# Store the signatures in a single file, because otherwise the install
+# target will install the .sconsign file
+SConsignFile()
+
+## ## We have to use these signatures to prevent spurious rebuilds
+## TargetSignatures('content')
+## SourceSignatures('MD5')
+
+extra_libs="@LIBS@"
+Export('extra_libs')
+
+## Figure out where everything is going to be put once it is built.
+
+import re
+
+outer_environ=os.environ
+
+if outer_environ.has_key('prefix'):
+    prefix=outer_environ['prefix']
+else:
+    prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+bin_dir="@bindir@"
+lib_dir="@libdir@"
+include_dir="@includedir@"
+
+if outer_environ.has_key('mandir'):
+    man_dir=outer_environ['mandir']+"/man1"
+else:
+    man_dir="@mandir@"+"/man1"
+
+exec_prefix=re.sub(r"\$\{prefix\}",prefix,exec_prefix)
+bin_dir=re.sub(r"\$\{exec_prefix\}",exec_prefix,bin_dir)
+lib_dir=re.sub(r"\$\{exec_prefix\}",exec_prefix,lib_dir)
+man_dir=re.sub(r"\$\{exec_prefix\}",exec_prefix,man_dir)
+include_dir=re.sub(r"\$\{exec_prefix\}",exec_prefix,include_dir)
+
+env["prefix"]=prefix
+env["exec_prefix"]=exec_prefix
+env["bin_dir"]=bin_dir
+env["lib_dir"]=lib_dir
+env["man_dir"]=man_dir
+env["include_dir"]=include_dir
+
+header_groups={}
+bin_objects=[]
+shared_lib_objects=[]
+static_lib_objects=[]
+
+Export('header_groups')
+Export('bin_objects')
+Export('shared_lib_objects')
+Export('static_lib_objects')
+
+def libs(shared_lib_objects,static_lib_objects):
+    if '':
+        return shared_lib_objects
+    return static_lib_objects
+Export('libs')
+
+
+python_lib=[]
+python_py=[]
+python_include_dir='@PYTHON_INCLUDE_DIR@'
+Export('python_lib')
+Export('python_py')
+Export('python_include_dir')
+
+
+# Create a new Builder to handle creating the -meta files.
+
+def create_meta(target, source, env):
+    output_file = file(str(target[0]),'wb')
+    output_file.write("#define XML_METADATA \"")
+    xml_file = file(str(source[0]))
+    xml_lines = xml_file.readlines()
+    for l in xml_lines:
+        output_file.write(l.replace('\"','\\\"')[:-1])
+    output_file.write("\"\n#define COMPONENT_NAME ")
+    for l in xml_lines:
+        start=l.find('<param name="Name">')
+        if start!=-1:
+            end=l.find('<',start+19)
+            if end==-1:
+                raise RunTimeError('Malformed XML file.  The file '
+                                   + str(source[0])
+                                   + ' does not close off <param name="Name"> on the same line.')
+            output_file.write(l[start+19:end])
+            output_file.write("\n")
+            break
+    template_file=file("meta-template.c")
+    output_file.write(template_file.read())
+
+def gen_suffix(env, sources):
+    return "-meta.c"
+
+env['BUILDERS']['Meta']=Builder(action=create_meta,src_suffix="meta",
+                                suffix=gen_suffix,single_source=True)
+
+Export('env')
+BuildDir('build','src',duplicate=0)
+SConscript('build/SConscript')
+
+# We have to do a fake install of the headers, because otherwise the
+# libraries won't build.  We have to do a fake install of the
+# libraries, because otherwise the binaries won't build.
+
+header_install=[]
+fake_header_install=[]
+for partial_dir, headers in header_groups.iteritems():
+    for h in headers:
+        # The petsc compatibility header is found in a different kind
+        # of place.
+
+        if(partial_dir=='StGermain/compatibility'):
+            source="StGermain/compatibility/libpetsc/"
+
+        # This is a hack because the top foo.h header files do
+        # not obey the usual naming construction.  They are in the
+        # libfoo directory.
+
+        elif(partial_dir=='StGermain'):
+            source="StGermain/libStGermain/src/"
+        elif(partial_dir=='StgFEM'):
+            source="StgFEM/libStG_FEM/src/"
+        elif(partial_dir=='PICellerator'):
+            source="PICellerator/libPICellerator/src/"
+        elif(partial_dir=='Underworld'):
+            source="Underworld/libUnderworld/src/"
+        elif(partial_dir=='Gale'):
+            source="Gale/libGale/src/"
+        else:
+            source=partial_dir + '/src/'
+
+        # StgFEM is put in a different place for historical reasons.
+        if(partial_dir[:6]=='StgFEM'):
+            target='StG_FEM' + partial_dir[6:]
+        else:
+            target=partial_dir
+
+        # Flatten the hierarchy of where plugins header files are
+        # found.
+        plugin_start=target.find('/plugins/')
+        if(plugin_start!=-1):
+            target=target[:plugin_start] + target[target.rfind('/'):]
+            # The directory for plugins does not have a "src/"
+            # component.
+            source=partial_dir + '/';
+
+
+        header_install+=[env.InstallAs(include_dir + '/' + target + '/' + h,
+                                       'src/' + source + h)]
+        fake_header_install+=[env.InstallAs('build/include/' + target
+                                            + '/' + h,
+                                            'src/' + source + h)]
+
+Depends(shared_lib_objects,fake_header_install)
+Depends(static_lib_objects,fake_header_install)
+
+if with_shared:
+    fake_lib_install=env.Install('build/lib',shared_lib_objects)
+    Depends(bin_objects,fake_lib_install)
+    lib_install=env.Install(lib_dir,shared_lib_objects)
+else:
+    lib_install=env.Install(lib_dir,static_lib_objects)
+
+bin_install=env.Install(bin_dir,bin_objects)
+
+env.Alias('install',bin_install)
+env.Alias('install',lib_install)
+env.Alias('install',header_install)
+
+
+Default(None)
+Default(bin_objects)


Property changes on: long/3D/Gale/trunk/SConstruct_msvc
___________________________________________________________________
Name: svn:executable
   + *



More information about the cig-commits mailing list