22 |
import scons_extensions |
import scons_extensions |
23 |
|
|
24 |
#=============================================================== |
#=============================================================== |
|
# check on windows or linux platform |
|
|
# |
|
|
IS_WINDOWS_PLATFORM = (os.name== "nt") |
|
25 |
|
|
26 |
if IS_WINDOWS_PLATFORM: |
tools_prefix="/usr" |
|
tools_prefix="C:\\Program Files\\" |
|
|
else: |
|
|
tools_prefix="/usr" |
|
27 |
|
|
28 |
#============================================================================================== |
#============================================================================================== |
29 |
# |
# |
120 |
# |
# |
121 |
# python installation: |
# python installation: |
122 |
# |
# |
123 |
if IS_WINDOWS_PLATFORM: |
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
124 |
python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include") |
python_lib_path_default=os.path.join(tools_prefix,'lib') |
125 |
python_lib_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"libs") |
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])] |
|
|
else: |
|
|
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
|
|
python_lib_path_default=os.path.join(tools_prefix,'lib') |
|
|
python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])] |
|
126 |
|
|
127 |
#========================================================================== |
#========================================================================== |
128 |
# |
# |
129 |
# boost installation: |
# boost installation: |
130 |
# |
# |
131 |
if IS_WINDOWS_PLATFORM: |
boost_path_default=os.path.join(tools_prefix,'include') |
132 |
boost_libs_path_default=os.path.join(tools_prefix,'boost','lib') |
boost_libs_path_default=os.path.join(tools_prefix,'lib') |
133 |
boost_libs_default=None |
boost_libs_default=['boost_python'] |
|
for i in os.listdir(boost_libs_path_default): |
|
|
name=os.path.splitext(i) |
|
|
if name[1] == ".dll" and name[0].startswith("boost_python"): |
|
|
if boost_libs_default == None: |
|
|
boost_libs_default= [ name[0] ] |
|
|
else: |
|
|
if not name[0].find("-gd-"): boost_libs_default=[ name[0] ] |
|
|
boost_path_default=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],)) |
|
|
else: |
|
|
boost_path_default=os.path.join(tools_prefix,'include') |
|
|
boost_libs_path_default=os.path.join(tools_prefix,'lib') |
|
|
boost_libs_default=['boost_python'] |
|
134 |
#========================================================================== |
#========================================================================== |
135 |
# |
# |
136 |
# check if netCDF is installed on the system: |
# check if netCDF is installed on the system: |
137 |
# |
# |
138 |
if IS_WINDOWS_PLATFORM: |
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
139 |
netcdf_dir=os.path.join(tools_prefix,'netcdf') |
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
|
netCDF_path_default=os.path.join(netcdf_dir,'include') |
|
|
netCDF_lib_path_default=os.path.join(netcdf_dir,'lib') |
|
|
else: |
|
|
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
|
|
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
|
140 |
|
|
141 |
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
142 |
useNetCDF_default='yes' |
useNetCDF_default='yes' |
147 |
netCDF_lib_path_default=None |
netCDF_lib_path_default=None |
148 |
netCDF_libs_default=None |
netCDF_libs_default=None |
149 |
|
|
|
if IS_WINDOWS_PLATFORM: |
|
|
useNetCDF_default='no' # be default netcdf is not supported on windows. |
|
150 |
#========================================================================== |
#========================================================================== |
151 |
# |
# |
152 |
# compile: |
# compile: |
153 |
# |
# |
154 |
if IS_WINDOWS_PLATFORM: |
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
155 |
# cc_flags_default = '/GR /EHsc /MD /Qc99 /Qopenmp /Qopenmp-report1 /O3 /G7 /Qprec /Qpar-report1 /QxP /QaxP' |
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
156 |
# cc_flags_debug_default = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec' |
cxx_flags_default='--no-warn -ansi' |
157 |
cc_flags_default = '/nologo /EHsc /GR /wd4068 /O2 /Op /MT /W3 /Ob0 /Z7' |
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
|
cc_flags_debug_default ='/nologo /EHsc /GR /wd4068 /Od /RTC1 /MTd /ZI /Ob0 /Z7' |
|
|
|
|
|
cc_flags_default = '/nologo /EHsc /GR /O2 /MT /W3 /Ob0 /Z7 /wd4068' |
|
|
cc_flags_debug_default ='/nologo /EHsc /GR /Od /RTC1 /MTd /W3 /Ob0 /Z7/wd4068' |
|
|
cxx_flags_default = '' |
|
|
cxx_flags_debug_default = '' |
|
|
cc_common_flags = '/FD /EHsc /GR /wd4068 ' |
|
|
else: |
|
|
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
|
|
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
|
|
cxx_flags_default='--no-warn -ansi' |
|
|
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
|
158 |
#============================================================================================== |
#============================================================================================== |
159 |
# Default options and options help text |
# Default options and options help text |
160 |
# 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. |
243 |
# This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms) |
# This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms) |
244 |
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
245 |
# |
# |
246 |
|
IS_WINDOWS_PLATFORM = (os.name== "nt") |
247 |
|
|
248 |
if IS_WINDOWS_PLATFORM: |
if IS_WINDOWS_PLATFORM: |
249 |
env = Environment(tools = ['default', 'msvc'], options = opts) |
env = Environment(tools = ['default', 'msvc'], options = opts) |
250 |
else: |
else: |
255 |
else: |
else: |
256 |
env = Environment(tools = ['default'], options = opts) |
env = Environment(tools = ['default'], options = opts) |
257 |
Help(opts.GenerateHelpText(env)) |
Help(opts.GenerateHelpText(env)) |
258 |
|
|
259 |
#================================================================================================= |
#================================================================================================= |
260 |
# |
# |
261 |
# Initialise Scons Build Environment |
# Initialise Scons Build Environment |
295 |
py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True) |
py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True) |
296 |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
297 |
|
|
298 |
|
# TODO: use the inbuilt scons suffix variable. |
299 |
if IS_WINDOWS_PLATFORM: |
if IS_WINDOWS_PLATFORM: |
300 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
301 |
else: |
else: |