/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 1137 by gross, Thu May 10 08:11:31 2007 UTC revision 1217 by ksteube, Wed Jul 18 00:47:01 2007 UTC
# Line 29  IS_WINDOWS_PLATFORM = (os.name== "nt") Line 29  IS_WINDOWS_PLATFORM = (os.name== "nt")
29  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
30     tools_prefix="C:\\Program Files\\"     tools_prefix="C:\\Program Files\\"
31  else:  else:
32     tools_prefix="/usr/local/"     tools_prefix="/usr"
33    
34  #==============================================================================================      #==============================================================================================    
35  #      #    
36  #    get the iinstallation prefix  #    get the installation prefix
37  #  #
38  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
39    
40    # We may also need to know where python's site-packages subdirectory lives
41    python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
42    
43    if prefix == "/usr":
44       # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
45       if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):
46          dir_packages =  prefix+"/lib64/"+python_version+"/site-packages"
47          dir_libraries = prefix+"/lib64"
48       elif os.path.isdir(prefix+"/lib/"+python_version+"/site-packages"):
49          dir_packages =  prefix+"/lib/"+python_version+"/site-packages"
50          dir_libraries = prefix+"/lib"
51       else:
52          print "Install prefix is /usr but couldn't find python package directory in either"
53          print "/usr/lib64/"+python_version+"/site-packages or /usr/lib/"+python_version+"/site-packages"
54          sys.exit(1)
55       dir_examples = prefix+"/share/doc/esys"
56    else:
57       # Install using the usual escript directory structure
58       dir_packages = prefix
59       dir_libraries = prefix+"/lib"
60       dir_examples = prefix
61    dir_packages += "/esys"
62    dir_examples += "/examples"
63    
64  print "Install prefix is: ", prefix  print "Install prefix is: ", prefix
65    print " python packages will be installed in:   ", dir_packages
66    print " libraries will be installed in:     ", dir_libraries
67    print " examples will be installed in:      ", dir_examples
68    
69    #==============================================================================================    
70    
71  # Default options and options help text  # Default options and options help text
72  # These are defaults and can be overridden using command line arguments or an options file.  # These are defaults and can be overridden using command line arguments or an options file.
# Line 57  else: Line 87  else:
87           hostname+=s           hostname+=s
88        else:        else:
89           hostname+="_"           hostname+="_"
90     options_file = "scons"+os.sep+hostname+"_options.py"     options_file = os.path.join("scons",hostname+"_options.py")
91        
92  if os.path.isfile(options_file):  if os.path.isfile(options_file):
93     print "option file is ",options_file,"."     print "option file is ",options_file,"."
# Line 69  opts = Options(options_file, ARGUMENTS) Line 99  opts = Options(options_file, ARGUMENTS)
99  #  #
100  #   check if UMFPACK is installed on the system:  #   check if UMFPACK is installed on the system:
101  #  #
102  umf_path_default=None  uf_root=None
103  umf_lib_path_default=None  for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']:
104  umf_libs_default=None     if os.path.isdir(os.path.join(tools_prefix,'include',i)):
105  if IS_WINDOWS_PLATFORM:         uf_root=i
106     pass         print i," is used form ",tools_prefix
107  else:         break
108     if os.path.isdir('/opt/UMFPACK/Include') and os.path.isdir('/opt/UMFPACK/Lib'):  if not uf_root==None:
109        umf_path_default='/opt/UMFPACK/Include'     umf_path_default=os.path.join(tools_prefix,'include',uf_root)
110        umf_lib_path_default='/opt/UMFPACK/Lib'     umf_lib_path_default=os.path.join(tools_prefix,'lib')
111        umf_libs_default=['umfpack']     umf_libs_default=['umfpack']
112       amd_path_default=os.path.join(tools_prefix,'include',uf_root)
113  amd_path_default=None     amd_lib_path_default=os.path.join(tools_prefix,'lib')
114  amd_lib_path_default=None     amd_libs_default=['amd']
115  amd_libs_default=None     ufc_path_default=os.path.join(tools_prefix,'include',uf_root)
116  if IS_WINDOWS_PLATFORM:  else:
117     pass     umf_path_default=None
118  else:     umf_lib_path_default=None
119     if os.path.isdir('/opt/AMD/Include') and os.path.isdir('/opt/AMD/Lib'):     umf_libs_default=None
120        amd_path_default='/opt/AMD/Include'     amd_path_default=None
121        amd_lib_path_default='/opt/AMD/Lib'     amd_lib_path_default=None
122        amd_libs_default=['amd']     amd_libs_default=None
123       ufc_path_default=None
124  ufc_path_default=None  #
 if IS_WINDOWS_PLATFORM:  
    pass  
 else:  
    if os.path.isdir('/opt/UFconfig'):  
         ufc_path_default='/opt/UFconfig'  
125  #==========================================================================  #==========================================================================
126  #  #
127  #    python installation:  #    python installation:
128  #  #
129  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
130     python_path_default='C:\\Program Files\\python%s%s'%(sys.version_info[0],sys.version_info[1])+"\\include"     python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include")
131     python_lib_path_default='C:\\Program Files\\python%s%s'%(sys.version_info[0],sys.version_info[1])+"\\libs"     python_lib_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"libs")
132     python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])]     python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])]
133  else:  else:
134     python_path_default='/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])     python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1]))
135     python_lib_path_default='/usr/lib'     python_lib_path_default=os.path.join(tools_prefix,'lib')
136     python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])]     python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])]
137    
138  #==========================================================================  #==========================================================================
139  #  #
140  #    boost installation:  #    boost installation:
141  #  #
142  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
143     boost_libs_path_default='C:\\Program Files\\boost\\lib\\'     boost_libs_path_default=os.path.join(tools_prefix,'boost','lib')
144     boost_libs_default=None     boost_libs_default=None
145     for i in os.listdir(boost_libs_path_default):     for i in os.listdir(boost_libs_path_default):
146        name=os.path.splitext(i)        name=os.path.splitext(i)
# Line 123  if IS_WINDOWS_PLATFORM: Line 149  if IS_WINDOWS_PLATFORM:
149           boost_libs_default= [ name[0] ]           boost_libs_default= [ name[0] ]
150        else:        else:
151           if not name[0].find("-gd-"): boost_libs_default=[ name[0] ]           if not name[0].find("-gd-"): boost_libs_default=[ name[0] ]
152     boost_path_default='C:\\Program Files\\boost\\include\\boost-%s'%(boost_libs_default[0].split("-")[-1],)     boost_path_default=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],))
153  else:  else:
154     boost_path_default='/usr/include'     boost_path_default=os.path.join(tools_prefix,'include')
155     boost_libs_path_default='/usr/lib'     boost_libs_path_default=os.path.join(tools_prefix,'lib')
156     boost_libs_default=['boost_python']     boost_libs_default=['boost_python']
157  #==========================================================================  #==========================================================================
158  #  #
159  #    check if netCDF is installed on the system:  #    check if netCDF is installed on the system:
160  #  #
161  netCDF_path_default=None  if IS_WINDOWS_PLATFORM:
162  netCDF_lib_path_default=None      netcdf_dir=os.path.join(tools_prefix,'netcdf')
163  netCDF_libs_default=None      netCDF_path_default=os.path.join(netcdf_dir,'include')
164  useNetCDF_default='yes'      netCDF_lib_path_default=os.path.join(netcdf_dir,'lib')
165  if os.path.isdir(tools_prefix+'netcdf'+os.sep+'include') and os.path.isdir(tools_prefix+'netcdf'+os.sep+'lib'):  else:
166       netCDF_path_default=tools_prefix+'netcdf'+os.sep+'include'      netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
167       netCDF_lib_path_default=tools_prefix+'netcdf'+os.sep+'lib'      netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3')
168       netCDF_libs_default=['netcdf_cpp',  'netcdf' ]  
169    if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
170         useNetCDF_default='yes'
171         netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ]
172    else:
173       useNetCDF_default='no'       useNetCDF_default='no'
174         netCDF_path_default=None
175         netCDF_lib_path_default=None
176         netCDF_libs_default=None
177    
178    if IS_WINDOWS_PLATFORM:
179            useNetCDF_default='no' # be default netcdf is not supported on windows.
180  #==========================================================================  #==========================================================================
181  #  #
182  #    compile:  #    compile:
# Line 148  if os.path.isdir(tools_prefix+'netcdf'+o Line 184  if os.path.isdir(tools_prefix+'netcdf'+o
184  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
185      # cc_flags_default  = '/GR /EHsc /MD /Qc99 /Qopenmp /Qopenmp-report1 /O3 /G7 /Qprec /Qpar-report1 /QxP /QaxP'      # cc_flags_default  = '/GR /EHsc /MD /Qc99 /Qopenmp /Qopenmp-report1 /O3 /G7 /Qprec /Qpar-report1 /QxP /QaxP'
186      # cc_flags_debug_default  = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec'      # cc_flags_debug_default  = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec'
187      cc_flags_default  = '/FD /EHsc /GR  /wd4068 /O2 /Op /MT /W3'      cc_flags_default  = '/nologo /EHsc /GR  /wd4068 /O2 /Op /MT /W3 /Ob0 /Z7'
188      cc_flags_debug_default  ='/FD /EHsc /GR  /wd4068 /Od /RTC1 /MTd /ZI'      cc_flags_debug_default  ='/nologo /EHsc /GR  /wd4068 /Od /RTC1 /MTd /ZI /Ob0 /Z7'
189        
190        cc_flags_default  = '/nologo /EHsc /GR  /O2 /MT /W3 /Ob0 /Z7 /wd4068'
191        cc_flags_debug_default  ='/nologo /EHsc /GR /Od /RTC1 /MTd /W3 /Ob0 /Z7/wd4068'
192      cxx_flags_default = ''      cxx_flags_default = ''
193      cxx_flags_debug_default = ''      cxx_flags_debug_default = ''
194      cc_common_flags = '/FD /EHsc /GR /wd4068 '      cc_common_flags = '/FD /EHsc /GR /wd4068 '
# Line 165  else: Line 204  else:
204  # DO NOT CHANGE THEM HERE  # DO NOT CHANGE THEM HERE
205  opts.AddOptions(  opts.AddOptions(
206  # Where to install esys stuff  # Where to install esys stuff
207    ('incinstall', 'where the esys headers will be installed', prefix+'/include'),    ('incinstall', 'where the esys headers will be installed',             Dir('#.').abspath+'/include'),
208    ('libinstall', 'where the esys libraries will be installed', prefix+'/lib'),    ('libinstall', 'where the esys libraries will be installed',           dir_libraries),
209    ('pyinstall', 'where the esys python modules will be installed', prefix),    ('pyinstall', 'where the esys python modules will be installed',       dir_packages),
210    ('src_zipfile', 'the source zip file will be installed.', prefix+"/release/escript_src.zip"),    ('exinstall', 'where the esys examples will be installed',             dir_examples),
211    ('test_zipfile', 'the test zip file will be installed.', prefix+"/release/escript_tests.zip"),    ('src_zipfile', 'the source zip file will be installed.',              Dir('#.').abspath+"/release/escript_src.zip"),
212    ('src_tarfile', 'the source tar file will be installed.', prefix+"/release/escript_src.tar.gz"),    ('test_zipfile', 'the test zip file will be installed.',               Dir('#.').abspath+"/release/escript_tests.zip"),
213    ('test_tarfile', 'the test tar file will be installed.', prefix+"/release/escript_tests.tar.gz"),    ('src_tarfile', 'the source tar file will be installed.',              Dir('#.').abspath+"/release/escript_src.tar.gz"),
214    ('examples_tarfile', 'the examples tar file will be installed.', prefix+"/release/doc/escript_examples.tar.gz"),    ('test_tarfile', 'the test tar file will be installed.',               Dir('#.').abspath+"/release/escript_tests.tar.gz"),
215    ('examples_zipfile', 'the examples zip file will be installed.', prefix+"/release/doc/escript_examples.zip"),    ('examples_tarfile', 'the examples tar file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
216    ('guide_pdf', 'name of the user guide in pdf format', prefix+"/release/doc/user/guide.pdf"),    ('examples_zipfile', 'the examples zip file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.zip"),
217    ('api_epydoc', 'name of the epydoc api docs directory',prefix+"/release/doc/epydoc"),    ('guide_pdf', 'name of the user guide in pdf format',                  Dir('#.').abspath+"/release/doc/user/guide.pdf"),
218    ('guide_html', 'name of the directory for user guide in html format', prefix+"/release/doc/user/html"),    ('api_epydoc', 'name of the epydoc api docs directory',                Dir('#.').abspath+"/release/doc/epydoc"),
219      ('guide_html', 'name of the directory for user guide in html format',  Dir('#.').abspath+"/release/doc/user/html"),
220      ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
221  # Compilation options  # Compilation options
222    BoolOption('dodebug', 'Do you want a debug build?', 'no'),    BoolOption('dodebug', 'Do you want a debug build?', 'no'),
223    ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),    ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),
# Line 265  except KeyError: Line 306  except KeyError:
306     python_path = ''     python_path = ''
307    
308  try:  try:
309       omp_num_threads = os.environ['OMP_NUM_THREADS']
310    except KeyError:
311       omp_num_threads = 1
312    env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
313    
314    try:
315       env['ENV']['DISPLAY'] = os.environ['DISPLAY']
316       env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
317    except KeyError:
318       pass
319    
320    try:
321     path = os.environ['PATH']     path = os.environ['PATH']
322     env['ENV']['PATH'] = path     env['ENV']['PATH'] = path
323  except KeyError:  except KeyError:
# Line 298  except KeyError: Line 351  except KeyError:
351     incinstall = None     incinstall = None
352  try:  try:
353     libinstall = env['libinstall']     libinstall = env['libinstall']
354     env.Append(LIBPATH = [libinstall,]) # ksteube adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so     env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
355     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
356     if env['PLATFORM'] == "win32":     if env['PLATFORM'] == "win32":
357        env.PrependENVPath('PATH', libinstall)        env.PrependENVPath('PATH', libinstall)
# Line 306  try: Line 359  try:
359  except KeyError:  except KeyError:
360     libinstall = None     libinstall = None
361  try:  try:
362     pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc     pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
363     env.PrependENVPath('PYTHONPATH', env['pyinstall'])     env.PrependENVPath('PYTHONPATH', env['pyinstall'])
364  except KeyError:  except KeyError:
365     pyinstall = None     pyinstall = None
366  try:  try:
367       exinstall = env['exinstall']
368    except KeyError:
369       exinstall = None
370    try:
371     dodebug = env['dodebug']     dodebug = env['dodebug']
372  except KeyError:  except KeyError:
373     dodebug = None     dodebug = None
# Line 621  try: Line 678  try:
678  except KeyError:  except KeyError:
679     api_epydoc = None     api_epydoc = None
680    
681    try:
682       api_doxygen = env.Dir(env['api_doxygen'])
683    except KeyError:
684       api_doxygen = None
685    
686  # Zipgets  # Zipgets
687  env.Default(libinstall)  env.Default(libinstall)
688  env.Default(incinstall)  env.Default(incinstall)
689  env.Default(pyinstall)  env.Default(pyinstall)
690    ### env.Default(exinstall) # ksteube this causes dependency error
691  env.Alias('release_src',[ src_zipfile, src_tarfile ])  env.Alias('release_src',[ src_zipfile, src_tarfile ])
692  env.Alias('release_tests',[ test_zipfile, test_tarfile])  env.Alias('release_tests',[ test_zipfile, test_tarfile])
693  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
694    env.Alias('examples_zipfile',examples_zipfile)
695    env.Alias('examples_tarfile',examples_tarfile)
696  env.Alias('api_epydoc',api_epydoc)  env.Alias('api_epydoc',api_epydoc)
697    env.Alias('api_doxygen',api_doxygen)
698    env.Alias('guide_html_index',guide_html_index)
699  env.Alias('guide_pdf', guide_pdf)  env.Alias('guide_pdf', guide_pdf)
700  env.Alias('docs',[ 'release_examples', 'guide_pdf', guide_html_index, api_epydoc])  env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
701  env.Alias('release', ['release_src', 'release_tests', 'docs'])  env.Alias('release', ['release_src', 'release_tests', 'docs'])
702  env.Alias('build_tests')    # target to build all C++ tests  env.Alias('build_tests')    # target to build all C++ tests
703  env.Alias('build_py_tests') # target to build all python tests  env.Alias('build_py_tests') # target to build all python tests
# Line 644  init_target = env.Command(pyinstall+'/__ Line 711  init_target = env.Command(pyinstall+'/__
711  env.Alias(init_target)  env.Alias(init_target)
712    
713  # Allow sconscripts to see the env  # Allow sconscripts to see the env
714  Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF",  Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF",
715      "boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs",      "boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs",
716          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",
717          "guide_pdf", "guide_html_index", "api_epydoc", "useMPI" ])          "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ])
718    
719  # End initialisation section  # End initialisation section
720  # Begin configuration section  # Begin configuration section

Legend:
Removed from v.1137  
changed lines
  Added in v.1217

  ViewVC Help
Powered by ViewVC 1.1.26