/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 797 by johnpye, Mon Jul 31 10:52:34 2006 UTC revision 800 by johnpye, Tue Aug 1 12:22:09 2006 UTC
# Line 1  Line 1 
1  import os, commands, platform, distutils.sysconfig, os.path  import os, commands, platform, distutils.sysconfig, os.path, re
2    
3  version = "0.9.5.96"  version = "0.9.5.96"
4    
# Line 29  if platform.system()=="Windows": Line 29  if platform.system()=="Windows":
29      if not os.path.exists(default_ida_prefix):      if not os.path.exists(default_ida_prefix):
30          default_ida_prefix = None          default_ida_prefix = None
31    
32      default_conopt_prefix = "c:\\MinGW"      default_conopt_prefix = "c:\\Program Files\\CONOPT"
33        default_conopt_libpath="$CONOPT_PREFIX"
34        default_conopt_cpppath="$CONOPT_PREFIX"
35        default_conopt_lib="conopt3"
36        default_conopt_envvar="CONOPT_PATH"
37        
38      if not os.path.exists(default_conopt_prefix):      if not os.path.exists(default_conopt_prefix):
39          default_conopt_prefix = None          default_conopt_prefix = None
40                    
# Line 47  else: Line 52  else:
52      default_absolute_paths = True      default_absolute_paths = True
53      default_ida_prefix="/usr/local"      default_ida_prefix="/usr/local"
54      default_conopt_prefix="/usr"      default_conopt_prefix="/usr"
55        default_conopt_libpath="$CONOPT_PREFIX/lib"
56        default_conopt_cpppath="$CONOPT_PREFIX/include"
57        default_conopt_lib="consub3"
58        default_conopt_envvar="LD_LIBRARY_PATH"
59    
60      need_libm = True      need_libm = True
61      if not os.path.isdir(default_tcl):      if not os.path.isdir(default_tcl):
62          default_tcl = '/usr'          default_tcl = '/usr'
# Line 196  opts.Add( Line 206  opts.Add(
206  opts.Add(PackageOption(  opts.Add(PackageOption(
207      "CONOPT_PREFIX"      "CONOPT_PREFIX"
208      ,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"      ,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"
209      ,default_ida_prefix      ,default_conopt_prefix
210  ))  ))
211    
212  opts.Add(  opts.Add(
213      "CONOPT_LIB"      "CONOPT_LIB"
214      ,"Library linked to for CONOPT"      ,"Library linked to for CONOPT"
215      ,'consub3'      ,default_conopt_lib
216  )  )
217    
218  opts.Add(  opts.Add(
219      'CONOPT_CPPPATH'      'CONOPT_CPPPATH'
220      ,"Where is your conopt.h?"      ,"Where is your conopt.h?"
221      ,"$CONOPT_PREFIX/include"      ,default_conopt_cpppath
222  )  )
223    
224  opts.Add(  opts.Add(
225      'CONOPT_LIBPATH'      'CONOPT_LIBPATH'
226      ,"Where is your CONOPT libraries installed?"      ,"Where is your CONOPT libraries installed?"
227      ,"$CONOPT_PREFIX/lib"      ,default_conopt_libpath
228    )
229    
230    opts.Add(
231        'CONOPT_ENVVAR'
232        ,"What environment variable should be used at runtime to override the default search location for CONOPT DLL/SO?"
233        ,default_conopt_envvar
234  )  )
235    
236  opts.Add(  opts.Add(
# Line 439  if platform.system()!="Windows": Line 455  if platform.system()!="Windows":
455    
456  # Import the outside environment  # Import the outside environment
457    
458    def c_escape(str):
459            return re.sub("\\\\","/",str)
460    
461    envadditional={}
462  if os.environ.get('OSTYPE')=='msys':  if os.environ.get('OSTYPE')=='msys':
463      env = Environment(      envenv = os.environ;
464          ENV=os.environ      tools = ['mingw','lex','yacc','fortran','swig','disttar','nsis','doxygen']
465          , tools=['mingw','lex','yacc','fortran','swig','disttar','nsis','doxygen']      envadditional['IS_MINGW']=True
         , toolpath=['scons']  
     )  
     env['IS_MINGW']=True  
466    
467  elif platform.system()=="Windows":  elif platform.system()=="Windows":
468      env = Environment(      envenv = {
469          ENV={          'PATH':os.environ['PATH']
470              'PATH':os.environ['PATH']          ,'INCLUDE':os.environ['INCLUDE']
471              ,'INCLUDE':os.environ['INCLUDE']          ,'LIB':os.environ['LIB']
472              ,'LIB':os.environ['LIB']          ,'MSVS_IGNORE_IDE_PATHS':1
473              ,'MSVS_IGNORE_IDE_PATHS':1      }
474          }      tools=['default','lex','yacc','fortran','swig','disttar','nsis','doxygen']  
475          , tools = ['default','lex','yacc','fortran','swig','disttar','nsis','doxygen']      envadditional['CPPDEFINES']=['_CRT_SECURE_NO_DEPRECATE']
         , toolpath = ['scons']  
     )  
     env.Append(CPPDEFINES=['_CRT_SECURE_NO_DEPRECATE'])  
476  else:  else:
477      env = Environment(      envenv = os.environ
478          ENV=os.environ      tools=['default','lex','yacc','fortran','swig','disttar','nsis','doxygen']
479          , tools=['default','lex','yacc','fortran','swig','disttar','nsis','doxygen']      
480          , toolpath=['scons']  env = Environment(
481      )      ENV=envenv
482        , toolpath=['scons']
483        , tools=tools
484        , **envadditional
485    )
486    
487  opts.Update(env)  opts.Update(env)
488  opts.Save('options.cache',env)  opts.Save('options.cache',env)
# Line 589  class KeepContext: Line 607  class KeepContext:
607                    
608          if context.env.has_key(varprefix+'_CPPPATH'):          if context.env.has_key(varprefix+'_CPPPATH'):
609              context.env.AppendUnique(CPPPATH=[env[varprefix+'_CPPPATH']])              context.env.AppendUnique(CPPPATH=[env[varprefix+'_CPPPATH']])
610              #print "Adding '"+str(cpppath_add)+"' to cpp path"              #print "Adding '"+str(env[varprefix+'_CPPPATH'])+"' to cpp path"
611    
612          if static:          if static:
613              staticlib=env[varprefix+'_LIB']              staticlib=env[varprefix+'_LIB']
# Line 600  class KeepContext: Line 618  class KeepContext:
618          else:          else:
619              if context.env.has_key(varprefix+'_LIBPATH'):              if context.env.has_key(varprefix+'_LIBPATH'):
620                  context.env.Append(LIBPATH=[env[varprefix+'_LIBPATH']])                  context.env.Append(LIBPATH=[env[varprefix+'_LIBPATH']])
621                  #print "Adding '"+str(libpath_add)+"' to lib path"                  #print "Adding '"+str(env[varprefix+'_LIBPATH'])+"' to lib path"
622    
623              if context.env.has_key(varprefix+'_LIB'):              if context.env.has_key(varprefix+'_LIB'):
624                  context.env.Append(LIBS=[env[varprefix+'_LIB']])                  context.env.Append(LIBS=[env[varprefix+'_LIB']])
# Line 820  def CheckIDA(context): Line 838  def CheckIDA(context):
838  # CONOPT test  # CONOPT test
839    
840  conopt_test_text = """  conopt_test_text = """
841  #define FNAME_LCASE_DECOR  #ifndef __MINGW32__
842    # error "where is mingw?"
843    #endif
844    
845    #if !defined(_WIN32)
846    # define FNAME_LCASE_DECOR
847    #endif
848    
849  #include <conopt.h>  #include <conopt.h>
850  #include <stdlib.h>  #include <stdlib.h>
851  int main(){  int main(){
# Line 1174  release = env.get('RELEASE') Line 1199  release = env.get('RELEASE')
1199  if release=="0.":  if release=="0.":
1200      release="0"      release="0"
1201    
1202    #print "SUBSTITUTED CONOPT_LIBPATH:",c_escape(env.subst("$CONOPT_LIBPATH"))
1203    
1204  subst_dict = {  subst_dict = {
1205      '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']      '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']
1206      , '@GLADE_FILE@':'ascend.glade'      , '@GLADE_FILE@':'ascend.glade'
# Line 1194  subst_dict = { Line 1221  subst_dict = {
1221      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
1222      , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir      , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir
1223      , '@PYTHON@' : python_exe      , '@PYTHON@' : python_exe
1224        , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')
1225        , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')
1226        , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_LIBPATH"))
1227  }  }
1228    
1229  if env.get('WITH_LOCAL_HELP'):  if env.get('WITH_LOCAL_HELP'):

Legend:
Removed from v.797  
changed lines
  Added in v.800

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