/[escript]/branches/RW_WIN32/SConstruct
ViewVC logotype

Diff of /branches/RW_WIN32/SConstruct

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

revision 305 by robwdcock, Sat Dec 3 05:05:25 2005 UTC revision 332 by phornby, Wed Dec 7 07:50:18 2005 UTC
# Line 2  import scons_ext Line 2  import scons_ext
2    
3  opts = Options('custom.py')  opts = Options('custom.py')
4  opts.AddOptions(  opts.AddOptions(
5     BoolOption('RELEASE', 'Set to build for release', 0),      BoolOption('RELEASE', 'Set to build for release', False),
6     PathOption('PYTHON_HOME','Path to python home','/usr/lib/python2.3'),      PathOption('PYTHON_INC','Path to python includes','/usr/include/python2.3'),
7     PathOption('BOOST_HOME','Path to boost home','/usr/include/boost')      PathOption('PYTHON_LIB','Path to python includes','/usr/lib'),
8        PathOption('BOOST_INC','Path to boost includes','/usr/include'),
9        PathOption('BOOST_LIB','Path to boost includes','/usr/lib'),
10    
11        # CC and CXX overrides of default environments
12        ('CC_PATH','override CC',False),
13        ('CXX_PATH','override CXX',False)
14  )  )
15    
16  env = Environment(tools = ['default'],options = opts)  env = Environment(tools = ['default'],options = opts)
17    
18    if env['CC_PATH'] :
19        env['CC'] = env['CC_PATH']
20    
21    if env['CXX_PATH'] :
22        env['CXX'] = env['CXX_PATH']
23    
24  Help(opts.GenerateHelpText(env))  Help(opts.GenerateHelpText(env))
25    
26  py_builder = Builder(action = scons_ext.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  py_builder = Builder(action = scons_ext.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
27  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
28    
29  if env['PLATFORM'] == "win32":  if env['PLATFORM'] == "win32":
30     runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)      runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
31  else:  else:
32     runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', single_source=True)      runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', single_source=True)
33  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
34    
35  runPyUnitTest_builder = Builder(action = scons_ext.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  runPyUnitTest_builder = Builder(action = scons_ext.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
# Line 28  print "PLATFORM is:", env['PLATFORM'] Line 40  print "PLATFORM is:", env['PLATFORM']
40    
41  EnsurePythonVersion(2,3)  EnsurePythonVersion(2,3)
42    
 #TODO: How do I convert these to options?  
 #TODO: Is there a more compact way of setting up the include paths?  
   
43  # Third-Party libraries  # Third-Party libraries
44  boost_home = env['BOOST_HOME']  python_inc = env['PYTHON_INC']
45  python_home = env['PYTHON_HOME']  python_lib = env['PYTHON_LIB']
46    boost_inc = env['BOOST_INC']
47    boost_lib = env['BOOST_LIB']
48    
49  # Where to install (and find) esys includes and libraries  # Where to install (and find) esys includes and libraries
50  # Note: #/ means relative to the top of source tree  # Note: #/ means relative to the top of source tree
# Line 43  esys_lib = '#/lib' Line 54  esys_lib = '#/lib'
54  env.Default(esys_lib)  env.Default(esys_lib)
55  env.Alias('py_test')  env.Alias('py_test')
56    
 # Derived paths  
 if env['PLATFORM'] == "win32":  
    python_inc = python_home + '/include'  
    python_lib = python_home + '/libs'  
    boost_inc = boost_home  
    boost_lib = boost_home + '/windows_binary/lib'  
 elif  env['PLATFORM'] == "posix":  
    python_inc = '/usr/include/python2.3'  
    python_lib = '/usr/lib'  
    boost_inc = '/usr/include'  
    boost_lib = '/usr/lib'  
   
57  incdir = [ boost_inc, python_inc, esys_inc ]  incdir = [ boost_inc, python_inc, esys_inc ]
58  libdir = [ boost_lib, python_lib, esys_lib ]  libdir = [ boost_lib, python_lib, esys_lib ]
59    
60  env.Append(CPPPATH=incdir)  env.Append(CPPPATH=incdir)
61  env.Append(LIBPATH=libdir)  env.Append(LIBPATH=libdir)
62    
63    if not env['RELEASE'] :
64        env.Append(CPPDEFINES = ['DOASSERT' 'DOPROF'])
65    
66  if env['PLATFORM'] == "win32":  if  env['CC'].find('cl.exe') >= 0 :
67     env.Append(CCFLAGS = ' /GR /EHsc /TP /wd4068')      env.Append(CCFLAGS = ' /GR /EHsc /TP /wd4068')
68     env.Append(CPPDEFINES = ['MSVC', 'WIN32'])      env.Append(CPPDEFINES = ['MSVC', 'WIN32'])
69     if False :      if env['RELEASE'] :
70        print "RELEASE build"          print "RELEASE build"
71     else:      else:
72        print "DEBUG build"         print "DEBUG build"
73        env.Append(CPPDEFINES = ['DOASSERT'])         env.Append(CCFLAGS = ' /Od /MDd /RTC1')
74        env.Append(CCFLAGS = ' /Od /MDd /RTC1')         env.Append(CPPDEFINES = ['_DEBUG'])
75        env.Append(CPPDEFINES = ['_DEBUG'])         boost_lib_name = 'boost_python-vc71-mt-sgd'
76        boost_lib_name = 'boost_python-vc71-mt-sgd'  
77  elif env['PLATFORM'] == "posix":  elif env['CC'].find('gcc') >= 0 :
78     env.Append(CC = ' -std=c99')      env.Append(CC = ' -std=c99')
79     env.Append(CCFLAGS = ' -c -fpic -W -Wall -Wno-unknown-pragmas')      env.Append(CCFLAGS = ' -c -fpic -W -Wall -Wno-unknown-pragmas')
80     boost_lib_name = 'boost_python'      boost_lib_name = 'boost_python'
81     if False :      if env['RELEASE'] :
82        print "RELEASE build"          print "RELEASE build"
83     else:          env.Prepend(CCFLAGS = ' -O3')
84        print "DEBUG build"      else:
85        env.Append(CPPDEFINES = ['DOASSERT', 'DOPROF'])          print "DEBUG build"
86        env.Prepend(CCFLAGS = ' -g -O0')          env.Prepend(CCFLAGS = ' -g -O0')
87    
88    elif env['CC'].find('icc') >= 0 :
89        env.Append(CC = ' -c99')
90        env.Append(CXX = ' -ansi')
91        env.Append(CCFLAGS = '  -openmp -openmp_report0 -mp1 -tpp2 -ansi_alias -no-gcc -fpic -w1')
92        env.Append(CPPDEFINES = ['SCSL'])
93        boost_lib_name = 'boost_python'
94        if env['RELEASE'] :
95            print "RELEASE build"
96            env.Prepend(CCFLAGS = ' -O3 -IPF_fma -ftz')
97        else:
98            print "DEBUG build"
99            env.Prepend(CCFLAGS = ' -g -O0')
100    
101  Export(["env", "incdir", "esys_inc", "esys_lib", "boost_lib_name" ])  Export(["env", "incdir", "esys_inc", "esys_lib", "boost_lib_name" ])
102    
# Line 97  env.SConscript(dirs = ['finley/src/finle Line 111  env.SConscript(dirs = ['finley/src/finle
111  env.SConscript(dirs = ['finley/src/CPPAdapter'], build_dir='build/$PLATFORM/finley/CPPAdapter', duplicate=0)  env.SConscript(dirs = ['finley/src/CPPAdapter'], build_dir='build/$PLATFORM/finley/CPPAdapter', duplicate=0)
112    
113  if env['PLATFORM'] == "win32":  if env['PLATFORM'] == "win32":
114     env.SConscript(dirs = ['win32/win32_utils'], build_dir='build/$PLATFORM/win32_utils', duplicate=0)      env.SConscript(dirs = ['win32/win32_utils'], build_dir='build/$PLATFORM/win32_utils', duplicate=0)
115    
116  # Unit Tests  # Unit Tests
117  env.SConscript(dirs = ['esysUtils/test/EsysException'], build_dir='build/$PLATFORM/esysUtils/test/EsysException', duplicate=0)  env.SConscript(dirs = ['esysUtils/test/EsysException'], build_dir='build/$PLATFORM/esysUtils/test/EsysException', duplicate=0)
# Line 106  env.SConscript(dirs = ['bruce/test'], bu Line 120  env.SConscript(dirs = ['bruce/test'], bu
120  env.SConscript(dirs = ['finley/test'], build_dir='build/$PLATFORM/finley/test', duplicate=0)  env.SConscript(dirs = ['finley/test'], build_dir='build/$PLATFORM/finley/test', duplicate=0)
121    
122  # Python  # Python
 env.SConscript(dirs = ['esys/py_src'], build_dir='build/$PLATFORM/esys/py', duplicate=0)  
123    env.SConscript(dirs = ['esys/py_src'], build_dir='build/$PLATFORM/esys/py', duplicate=0)

Legend:
Removed from v.305  
changed lines
  Added in v.332

  ViewVC Help
Powered by ViewVC 1.1.26