/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1083 by johnpye, Tue Jan 9 13:12:37 2007 UTC revision 1399 by jpye, Sun Apr 22 05:02:24 2007 UTC
# Line 1  Line 1 
1  import sys, os, commands, platform, distutils.sysconfig, os.path, re  import sys, os, commands, platform, distutils.sysconfig, os.path, re
2    
3  version = "0.9.5.106"  version = "0.9.5.108"
4    
5  #------------------------------------------------------  #------------------------------------------------------
6  # OPTIONS  # OPTIONS
# Line 32  if platform.system()=="Windows": Line 32  if platform.system()=="Windows":
32      default_conopt_prefix = "c:\\Program Files\\CONOPT"      default_conopt_prefix = "c:\\Program Files\\CONOPT"
33      default_conopt_libpath="$CONOPT_PREFIX"      default_conopt_libpath="$CONOPT_PREFIX"
34      default_conopt_cpppath="$CONOPT_PREFIX"      default_conopt_cpppath="$CONOPT_PREFIX"
35        default_conopt_dlpath="$CONOPT_PREFIX"
36      default_conopt_lib="conopt3"      default_conopt_lib="conopt3"
37      default_conopt_envvar="CONOPT_PATH"      default_conopt_envvar="CONOPT_PATH"
38    
# Line 59  else: Line 60  else:
60      default_conopt_prefix="/usr"      default_conopt_prefix="/usr"
61      default_conopt_libpath="$CONOPT_PREFIX/lib"      default_conopt_libpath="$CONOPT_PREFIX/lib"
62      default_conopt_cpppath="$CONOPT_PREFIX/include"      default_conopt_cpppath="$CONOPT_PREFIX/include"
63        default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib"
64      default_conopt_lib="consub3"      default_conopt_lib="consub3"
65      default_conopt_envvar="CONOPT_PATH"      default_conopt_envvar="CONOPT_PATH"
66    
# Line 104  opts.Add(BoolOption( Line 106  opts.Add(BoolOption(
106      ,True      ,True
107  ))  ))
108    
109    opts.Add(BoolOption(
110        'WITH_SIGNALS'
111        ,"Whether to permit use of signals for flow control in the C-level code"
112        ,True
113    ))
114    
115  # You can turn off building of Tcl/Tk interface  # You can turn off building of Tcl/Tk interface
116  opts.Add(BoolOption(  opts.Add(BoolOption(
117      'WITH_TCLTK'      'WITH_TCLTK'
# Line 180  opts.Add(BoolOption( Line 188  opts.Add(BoolOption(
188      ,True      ,True
189  ))  ))
190    
   
 opts.Add(BoolOption(  
     'IDA_NEW_ANALYSE'  
     ,"Build with new IDA 'analyse' function? (see base/generic/solver/ida.c)"  
     ,False  
 ))  
   
191  #----- default paths -----  #----- default paths -----
192  opts.Add(PackageOption(  opts.Add(PackageOption(
193      'DEFAULT_PREFIX'      'DEFAULT_PREFIX'
# Line 268  opts.Add( Line 269  opts.Add(
269    
270  opts.Add(  opts.Add(
271      'CONOPT_LIBPATH'      'CONOPT_LIBPATH'
272      ,"Where is your CONOPT libraries installed?"      ,"Where is your CONOPT library installed?"
273      ,default_conopt_libpath      ,default_conopt_libpath
274  )  )
275    
276  opts.Add(  opts.Add(
277        'CONOPT_DLPATH'
278        ,"What is the default search path that ASCEND should use when dlopening the CONOPT library at runtime?"
279        ,default_conopt_dlpath
280    )
281    
282    opts.Add(
283      'CONOPT_ENVVAR'      'CONOPT_ENVVAR'
284      ,"What environment variable should be used at runtime to override the default search location for CONOPT DLL/SO?"      ,"What environment variable should be used at runtime to override the default search location for CONOPT DLL/SO?"
285      ,default_conopt_envvar      ,default_conopt_envvar
# Line 283  opts.Add( Line 290  opts.Add(
290  opts.Add(  opts.Add(
291      "F2C_LIB"      "F2C_LIB"
292      ,"F2C library (eg. g2c, gfortran, f2c)"      ,"F2C library (eg. g2c, gfortran, f2c)"
293      ,"g2c"      ,"gfortran" # the default is gfortran now
294  )  )
295    
296  opts.Add(PackageOption(  opts.Add(PackageOption(
# Line 292  opts.Add(PackageOption( Line 299  opts.Add(PackageOption(
299      ,"off"      ,"off"
300  ))  ))
301    
302    opts.Add(
303        "FORTRAN"
304        ,"Fortran compiler (eg g77, gfortran)"
305        ,"gfortran"
306    )
307    
308  #------- tcl/tk --------  #------- tcl/tk --------
309    
310  opts.Add(  opts.Add(
# Line 419  opts.Add( Line 432  opts.Add(
432  )  )
433    
434  opts.Add(  opts.Add(
     'INSTALL_DOC'  
     ,'Location to install documentation files'  
     ,"$INSTALL_SHARE/doc"  
 )  
   
 opts.Add(  
435      'INSTALL_ASCDATA'      'INSTALL_ASCDATA'
436      ,"Location of ASCEND shared data (TK, python, models etc)"      ,"Location of ASCEND shared data (TK, python, models etc)"
437      ,"$INSTALL_SHARE/ascend"      ,"$INSTALL_SHARE/ascend"
# Line 488  opts.Add(BoolOption( Line 495  opts.Add(BoolOption(
495      ,False      ,False
496  ))  ))
497    
498    #------ f --------
499    opts.Add(PackageOption(
500        'MFGRAPH_PREFIX'
501        ,"Where are your MFGRAPH files?"
502        ,default_prefix
503    ))
504    
505    opts.Add(PackageOption(
506        'MFGRAPH_CPPPATH'
507        ,"Where are your MFGRAPH include files?"
508        ,default_cpppath
509    ))
510    
511    opts.Add(PackageOption(
512        'MFGRAPH_LIBPATH'
513        ,"Where are your MFGRAPH libraries?"
514        ,default_libpath
515    ))
516    
517    opts.Add(BoolOption(
518        'WITH_MFGRAPH'
519        ,"Link to the MFGRAPH library (if available, for generating incidence graphs)"
520        ,True
521    ))
522    
523    
524    #------ ufsparse --------
525    opts.Add(PackageOption(
526        'UFSPARSE_PREFIX'
527        ,"Where are your UFSPARSE files?"
528        ,default_prefix
529    ))
530    
531    opts.Add(PackageOption(
532        'UFSPARSE_CPPPATH'
533        ,"Where are your UFSPARSE include files?"
534        ,default_cpppath
535    ))
536    
537    opts.Add(PackageOption(
538        'UFSPARSE_LIBPATH'
539        ,"Where are your UFSPARSE libraries?"
540        ,default_libpath
541    ))
542    
543    opts.Add(BoolOption(
544        'WITH_UFSPARSE'
545        ,"Link to the UFSPARSE library (if available, for additional sparse matrix routines)"
546        ,True
547    ))
548    
549  #-----------------------  #-----------------------
550    
551  opts.Add(  opts.Add(
# Line 555  def c_escape(str): Line 613  def c_escape(str):
613  envadditional={}  envadditional={}
614    
615  if platform.system()=="Windows":  if platform.system()=="Windows":
     import SCons.Util  
   
     print ">>> mingw32-gcc at",SCons.Util.WhereIs('mingw32-gcc')  
       
616      if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):      if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):
         print "Detected MINGW"  
617          envenv = os.environ;          envenv = os.environ;
618          tools = ['mingw','lex','yacc','fortran','swig','disttar','nsis']          tools = ['mingw','lex','yacc','fortran','swig','disttar','nsis']
619          #TODO removed 'doxygen' for SCons 0.96.93          #TODO removed 'doxygen' for SCons 0.96.93
# Line 594  env = Environment( Line 647  env = Environment(
647      , **envadditional      , **envadditional
648  )  )
649    
650    print "PATH =",os.environ['PATH']
651    
652  opts.Update(env)  opts.Update(env)
653  opts.Save('options.cache',env)  opts.Save('options.cache',env)
654    
# Line 617  without_scrollkeeper_reason = "disabled Line 672  without_scrollkeeper_reason = "disabled
672  with_dmalloc = env.get('WITH_DMALLOC')  with_dmalloc = env.get('WITH_DMALLOC')
673  without_dmalloc_reason = "disabled by options/config.py"  without_dmalloc_reason = "disabled by options/config.py"
674    
675    with_mfgraph = env.get('WITH_MFGRAPH')
676    without_mfgraph_reason = "disabled by options/config.py"
677    
678    with_ufsparse = env.get('WITH_UFSPARSE')
679    without_ufsparse_reason = "disabled by options/config.py"
680    
681  with_mmio = env.get('WITH_MMIO')  with_mmio = env.get('WITH_MMIO')
682  without_mmio_reason = "disabled by options/config.py"  without_mmio_reason = "disabled by options/config.py"
683    
684    with_signals = env.get('WITH_SIGNALS')
685    without_signals_reason = "disabled by options/config.py"
686    
687  if platform.system()=="Windows":  if platform.system()=="Windows":
688      with_installer=1      with_installer=1
689  else:  else:
# Line 655  if platform.system()=='Windows': Line 719  if platform.system()=='Windows':
719      can_install = False      can_install = False
720    
721  env['CAN_INSTALL']=can_install  env['CAN_INSTALL']=can_install
   
722  env['INSTALL_MODELS']=env['INSTALL_ASCDATA']+"/models/"  env['INSTALL_MODELS']=env['INSTALL_ASCDATA']+"/models/"
723    
724  print "TCL_CPPPATH =",env['TCL_CPPPATH']  print "TCL_CPPPATH =",env['TCL_CPPPATH']
# Line 956  def CheckDMalloc(context): Line 1019  def CheckDMalloc(context):
1019      return CheckExtLib(context,'dmalloc',dmalloc_test_text)      return CheckExtLib(context,'dmalloc',dmalloc_test_text)
1020    
1021  #----------------  #----------------
1022    # mfgraph test
1023    
1024    mfgraph_test_text = """
1025    #include <mfgraph/mfg_draw_graph.h>
1026    int main(void){
1027        using namespace mfg;
1028        DrawGraph g;
1029        return 0;
1030    }
1031    """
1032    
1033    def CheckMFGraph(context):
1034        return CheckExtLib(context,'mfgraph',mfgraph_test_text,ext=".cpp")
1035    
1036    #----------------
1037    # ufsparse test
1038    
1039    ufsparse_test_text = """
1040    #include <ufsparse/cs.h>
1041    int main(void){
1042        cs *A,*B,*C;
1043        C = cs_multiply(A,B);
1044        return 0;
1045    }
1046    """
1047    
1048    def CheckUFSparse(context):
1049        return CheckExtLib(context
1050            ,libname='cxsparse'
1051            ,varprefix='ufsparse'
1052            ,text=ufsparse_test_text
1053            ,ext=".c"
1054        )
1055    
1056    #----------------
1057  # MATH test  # MATH test
1058    
1059  math_test_text = """  math_test_text = """
# Line 1118  def CheckIDAVersion(context): Line 1216  def CheckIDAVersion(context):
1216          return 0          return 0
1217                    
1218      # good version      # good version
1219      context.Result(output+", good")      context.Result("%d.%d.%d, good" % (major,minor,patch))
1220      return 1      return 1
1221            
1222  #----------------  #----------------
# Line 1377  def CheckSigReset(context): Line 1475  def CheckSigReset(context):
1475      (is_ok,output) = context.TryRun(sigreset_test_text,'.c')      (is_ok,output) = context.TryRun(sigreset_test_text,'.c')
1476      if not is_ok:      if not is_ok:
1477          context.Result("ERROR")          context.Result("ERROR")
1478          return 0          return False
1479      if int(output)==1:      if int(output)==1:
1480          context.Result("required");          context.Result("required");
1481          context.env['ASC_RESETNEEDED'] = True          context.env['ASC_RESETNEEDED'] = True
# Line 1403  conf = Configure(env Line 1501  conf = Configure(env
1501          , 'CheckPythonLib' : CheckPythonLib          , 'CheckPythonLib' : CheckPythonLib
1502          , 'CheckCUnit' : CheckCUnit          , 'CheckCUnit' : CheckCUnit
1503          , 'CheckDMalloc' : CheckDMalloc          , 'CheckDMalloc' : CheckDMalloc
1504            , 'CheckMFGraph' : CheckMFGraph
1505            , 'CheckUFSparse' : CheckUFSparse
1506          , 'CheckTcl' : CheckTcl          , 'CheckTcl' : CheckTcl
1507          , 'CheckTclVersion' : CheckTclVersion          , 'CheckTclVersion' : CheckTclVersion
1508          , 'CheckTk' : CheckTk          , 'CheckTk' : CheckTk
# Line 1426  conf = Configure(env Line 1526  conf = Configure(env
1526  #   , config_h = "config.h"  #   , config_h = "config.h"
1527  )  )
1528    
1529    def sconsversioncheck():
1530    
1531    #   uncomment the following line to skip the version check:
1532    #   return 1
1533    
1534        import SCons
1535        v = SCons.__version__.split(".")
1536        if v[0] != '0':
1537            return 0
1538        if v[1] != '96':
1539            return 0
1540        micro = int(v[2])
1541        if micro == 92 or micro == 93 or micro == 96:
1542            return 1;
1543        return 0
1544    
1545    if not sconsversioncheck():
1546        print "Scons version is not OK. Please try version 0.96.92 or 0.96.93,"
1547        print "or consult the developers in the case of newer versions. Modify"
1548        print "the function 'sconsversioncheck' in the file SConstruct if you"
1549        print "want to *force* SCons to continue."
1550        Exit(1)
1551    
1552  # stdio -- just to check that compiler is behaving  # stdio -- just to check that compiler is behaving
1553    
1554  if not conf.CheckHeader('stdio.h'):  if not conf.CheckHeader('stdio.h'):
# Line 1437  if not conf.CheckHeader('stdio.h'): Line 1560  if not conf.CheckHeader('stdio.h'):
1560          print "%-30s%s" % ("%s :" % k, v)          print "%-30s%s" % ("%s :" % k, v)
1561      Exit(1)      Exit(1)
1562    
1563    if not conf.CheckFunc('snprintf'):
1564        print "Didn't find snprintf";
1565        exit(1)
1566    
1567  # Math library  # Math library
1568    
1569  if need_libm:  conf.env['HAVE_IEEE']=True
1570      if not conf.CheckMath():  
1571          print 'Did not find math library, exiting!'  if need_libm and not conf.CheckMath():
1572          Exit(1)      conf.env['HAVE_IEEE']=False
1573      #pass      print 'Did not find math library, exiting!'
1574        Exit(1)
1575    
1576  # Where is 'isnan'?  # Where is 'isnan'?
1577    
# Line 1463  if conf.CheckGcc(): Line 1591  if conf.CheckGcc():
1591    
1592  # Catching SIGINT  # Catching SIGINT
1593    
1594  if not conf.CheckSIGINT():  if env['WITH_SIGNALS']:
1595      print "SIGINT unable to be caught. Aborting."      if not conf.CheckSIGINT():
1596      exit(1)          with_signals = False
1597            without_signals_reason = "SIGINT uncatchable"
1598    
1599  # Catching SIGFPE  # Catching SIGFPE
1600    
# Line 1478  else: Line 1607  else:
1607    
1608  if not conf.CheckSigReset():  if not conf.CheckSigReset():
1609      print "Unable to determine if signal reset is required"      print "Unable to determine if signal reset is required"
1610      exit(1)      Exit(1)
1611    
1612  # YACC  # YACC
1613    
# Line 1552  if with_dmalloc: Line 1681  if with_dmalloc:
1681          without_dmalloc_reason = 'dmalloc not found'          without_dmalloc_reason = 'dmalloc not found'
1682          with_dmalloc = False          with_dmalloc = False
1683    
1684    # MFGRAPH
1685    
1686    if with_mfgraph:
1687        if not conf.CheckMFGraph():
1688            without_mfgraph_reason = 'mfgraph not found'
1689            with_mfgraph = False
1690            env['WITH_MFGRAPH'] = False
1691    
1692    # UFSPARSE
1693    
1694    if with_ufsparse:
1695        if not conf.CheckUFSparse():
1696            without_ufsparse_reason = 'mfgraph not found'
1697            with_ufsparse = False
1698            env['WITH_UFSPARSE'] = False
1699    
1700  # IDA  # IDA
1701    
1702  if not with_ida:  if not with_ida:
# Line 1594  else: Line 1739  else:
1739    
1740  if need_fortran:  if need_fortran:
1741      conf.env.Tool('fortran')      conf.env.Tool('fortran')
1742      detect_fortran = conf.env.Detect(['g77','f77','gfortran'])      detect_fortran = conf.env.Detect(['gfortran','g77'])
1743      if detect_fortran:      if detect_fortran:
1744          # For some reason, g77 doesn't get detected properly on MinGW          # For some reason, g77 doesn't get detected properly on MinGW
1745          if not env.has_key('F77') and not env.has_key('FORTRAN'):          if not env.has_key('F77') and not env.has_key('FORTRAN'):
1746                print "Fixing detection of F77 on MinGW...(?)"
1747              conf.env.Replace(F77=detect_fortran)              conf.env.Replace(F77=detect_fortran)
1748              conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')              conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')
1749              conf.env.Replace(F77FLAGS='')              conf.env.Replace(F77FLAGS='')
# Line 1610  if need_fortran: Line 1756  if need_fortran:
1756                  , src_suffix='.f'                  , src_suffix='.f'
1757              )              )
1758              conf.env.Append(BUILDERS={'Fortran':fortran_builder})              conf.env.Append(BUILDERS={'Fortran':fortran_builder})
1759            if platform.system()=="Linux":
1760                conf.env.Append(SHFORTRANFLAGS=['-fPIC'])
1761      else:      else:
1762          with_lsode=False;          with_lsode=False;
1763          without_lsode_reason="FORTRAN-77 required but not found"          without_lsode_reason="FORTRAN-77 required but not found"
# Line 1621  if need_fortran: Line 1769  if need_fortran:
1769    
1770  if need_fortran:  if need_fortran:
1771      if platform.system()=="Windows":      if platform.system()=="Windows":
1772          conf.env.Append(LIBPATH='c:\mingw\lib')          pass
1773            #conf.env.Append(LIBPATH='c:\mingw\lib')
1774    
1775  # scrollkeeper  # scrollkeeper
1776    
# Line 1675  subst_dict = { Line 1824  subst_dict = {
1824      , '@RELEASE@':release      , '@RELEASE@':release
1825      , '@DISTTAR_NAME@':env['DISTTAR_NAME']      , '@DISTTAR_NAME@':env['DISTTAR_NAME']
1826      , '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/'      , '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/'
1827      , '@ASC_SHLIBSUFFIX@':env['SHLIBSUFFIX']      , '@SHLIBSUFFIX@':env['SHLIBSUFFIX']
1828      , '@ASC_SHLIBPREFIX@':env['SHLIBPREFIX']      , '@SHLIBPREFIX@':env['SHLIBPREFIX']
1829      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
1830      , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir      , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir
1831      , '@PYTHON@' : python_exe      , '@PYTHON@' : python_exe
1832      , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')      , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')
1833      , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')      , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')
1834      , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_LIBPATH"))      , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_DLPATH"))
1835      , '@SOURCE_ROOT@':os.path.abspath(str(env.Dir("#")))      , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))
1836  }  }
1837    
1838  if env.get('WITH_LOCAL_HELP'):  if env.get('WITH_LOCAL_HELP'):
# Line 1692  if env.get('WITH_LOCAL_HELP'): Line 1841  if env.get('WITH_LOCAL_HELP'):
1841    
1842  # bool options...  # bool options...
1843  for k,v in {  for k,v in {
1844          'ABSOLUTE_PATHS' : 'ASC_ABSOLUTE_PATHS'          'ASC_WITH_IDA':with_ida
1845          ,'WITH_XTERM_COLORS' : 'ASC_XTERM_COLORS'          ,'ASC_WITH_DMALLOC':with_dmalloc
1846          ,'MALLOC_DEBUG' : 'MALLOC_DEBUG'          ,'ASC_WITH_MFGRAPH':with_mfgraph
1847  }.iteritems():          ,'ASC_WITH_UFSPARSE':with_ufsparse
1848      if env.get(k):          ,'ASC_WITH_CONOPT':with_conopt
1849  #       subst_dict['@'+v+'@']='1'          ,'ASC_WITH_LSODE':with_lsode
1850          subst_dict["/\\* #define "+v+' @'+v+"@ \\*/"]='# define '+v+' 1 '          ,'ASC_WITH_MMIO':with_mmio
1851            ,'ASC_SIGNAL_TRAPS':with_signals
1852  if with_ida:          ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')
1853      subst_dict["/\\* #define ASC_WITH_IDA @ASC_WITH_IDA@ \\*/"]='#define ASC_WITH_IDA '          ,'HAVE_C99FPE':env.get('HAVE_C99FPE')
1854            ,'HAVE_IEEE':env.get('HAVE_IEEE')
1855  if with_dmalloc:          ,'ASC_ABSOLUTE_PATHS':env.get('ASC_ABSOLUTE_PATHS')
1856      subst_dict["/\\* #define ASC_WITH_DMALLOC @ASC_WITH_DMALLOC@ \\*/"]='#define ASC_WITH_DMALLOC '          ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')
1857            ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')
1858  if with_conopt:          }.iteritems():
1859      subst_dict["/\\* #define ASC_WITH_CONOPT @ASC_WITH_CONOPT@ \\*/"]='#define ASC_WITH_CONOPT '          
1860        if v: subst_dict["/\\* #define %s @%s@ \\*/" % (k,k)]='# define %s 1 ' % k
 if with_lsode:  
     subst_dict["/\\* #define ASC_WITH_LSODE @ASC_WITH_LSODE@ \\*/"]='#define ASC_WITH_LSODE '  
   
 if with_mmio:  
     subst_dict["/\\* #define ASC_WITH_MMIO @ASC_WITH_MMIO@ \\*/"]='#define ASC_WITH_MMIO '  
1861    
1862  if with_python:  if with_python:
1863      subst_dict['@ASCXX_USE_PYTHON@']="1"      subst_dict['@ASCXX_USE_PYTHON@']="1"
# Line 1722  if with_python: Line 1866  if with_python:
1866  if env.has_key('HAVE_GCCVISIBILITY'):  if env.has_key('HAVE_GCCVISIBILITY'):
1867      subst_dict['@HAVE_GCCVISIBILITY@'] = "1"      subst_dict['@HAVE_GCCVISIBILITY@'] = "1"
1868    
 if env.get('ASC_RESETNEEDED'):  
     subst_dict["/\\* #define ASC_RESETNEEDED @ASC_RESETNEEDED@ \\*/"]='#define ASC_RESETNEEDED '  
   
 if env.get('HAVE_C99FPE'):  
     subst_dict["/\\* #define HAVE_C99FPE @HAVE_C99FPE@ \\*/"]='#define HAVE_C99FPE '  
   
1869  env.Append(SUBST_DICT=subst_dict)  env.Append(SUBST_DICT=subst_dict)
1870    
1871  #------------------------------------------------------  #for k,v in subst_dict.iteritems():
1872  # RECIPE: Fix up long command-line bug on Win2k  #   print "%-50s%s" % ("'%s'"%k,v)
   
 # Currently this is broken, awaiting help from the SCons users list  
1873    
1874  if 0 and env['PLATFORM'] == 'win32':  # REMOVED: long command-line support on Win2k
     import win32file  
     import win32event  
     import win32process  
     import win32security  
     import string  
   
     def my_spawn(sh, escape, cmd, args, spawnenv):  
         for var in spawnenv:  
             spawnenv[var] = spawnenv[var].encode('ascii', 'replace')  
   
         sAttrs = win32security.SECURITY_ATTRIBUTES()  
         StartupInfo = win32process.STARTUPINFO()  
         newargs = string.join(map(escape, args[1:]), ' ')  
         cmdline = cmd + " " + newargs  
   
         # check for any special operating system commands  
         if cmd == 'del':  
             for arg in args[1:]:  
                 win32file.DeleteFile(arg)  
             exit_code = 0  
         else:  
             # otherwise execute the command.  
             hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)  
             win32event.WaitForSingleObject(hProcess, win32event.INFINITE)  
             exit_code = win32process.GetExitCodeProcess(hProcess)  
             win32file.CloseHandle(hProcess);  
             win32file.CloseHandle(hThread);  
         return exit_code  
   
     env['SPAWN'] = my_spawn  
1875    
1876  #------------------------------------------------------  #------------------------------------------------------
1877  # RECIPE: SWIG scanner  # RECIPE: SWIG scanner
# Line 1810  def TOOL_SUBST(env): Line 1916  def TOOL_SUBST(env):
1916          except:          except:
1917              raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile              raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile
1918          for (k,v) in dict.items():          for (k,v) in dict.items():
1919              contents = re.sub(k, v, contents)              try:
1920                    #print "%s ---> %s" % (k,v)
1921                    contents = re.sub(k, v, contents)
1922                except Exception,e:
1923                    sys.stderr.write("Failed to substute '%s' with '%s': %s\n" % (k,v,e))
1924            
1925          try:          try:
1926              f = open(targetfile, 'wb')              f = open(targetfile, 'wb')
1927              f.write(contents)              f.write(contents)
# Line 1919  else: Line 2030  else:
2030    
2031  libascend_env = env.Copy()  libascend_env = env.Copy()
2032    
2033  dirs = ['general','utilities','compiler','solver','packages']  dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear']
2034    
2035  srcs = []  srcs = []
2036  for d in dirs:  for d in dirs:
# Line 1953  else: Line 2064  else:
2064  if with_dmalloc:  if with_dmalloc:
2065      libascend_env.Append(LIBS=['dmalloc'])      libascend_env.Append(LIBS=['dmalloc'])
2066    
2067    if with_ufsparse:
2068        libascend_env.Append(LIBS=['cxsparse'])
2069    
2070  libascend = libascend_env.SharedLibrary('ascend',srcs)  libascend = libascend_env.SharedLibrary('ascend',srcs)
2071    
2072  env.Alias('libascend',libascend)  env.Alias('libascend',libascend)
# Line 1961  env.Alias('libascend',libascend) Line 2075  env.Alias('libascend',libascend)
2075  # UNIT TESTS (C CODE)  # UNIT TESTS (C CODE)
2076    
2077  if with_cunit:  if with_cunit:
2078      testdirs = ['general','solver','utilities']      testdirs = ['general','solver','utilities','linear']
2079      testsrcs = []      testsrcs = []
2080      for testdir in testdirs:      for testdir in testdirs:
2081          path = 'base/generic/'+testdir+'/test/'          path = 'base/generic/'+testdir+'/test/'
# Line 1999  ascendconfig = env.SubstInFile('ascend-c Line 2113  ascendconfig = env.SubstInFile('ascend-c
2113    
2114  if env.get('CAN_INSTALL'):  if env.get('CAN_INSTALL'):
2115    
2116      dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE', 'INSTALL_DOC']      dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE']
2117      install_dirs = [env.Entry(env['INSTALL_ROOT']+env[d]) for d in dirs]      install_dirs = [env.Entry(env['INSTALL_ROOT']+env[d]) for d in dirs]
2118      install_dirs += modeldirs      install_dirs += modeldirs
2119    
# Line 2088  env.Default(default_targets) Line 2202  env.Default(default_targets)
2202  print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])  print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])
2203    
2204  # vim: set syntax=python:  # vim: set syntax=python:
   

Legend:
Removed from v.1083  
changed lines
  Added in v.1399

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22