Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105189290
Sconstruct
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 15, 07:36
Size
2 KB
Mime Type
text/x-python
Expires
Mon, Mar 17, 07:36 (2 d)
Engine
blob
Format
Raw Data
Handle
24925267
Attached To
rTAMAAS tamaas
Sconstruct
View Options
import os,sys
path = '/usr/lib/scons/'
sys.path.append(path)
#from SCons import *
#from SCons.Environment import *
#from SCons.Variables import *
#from SCons.Util import *
#script_dir = GetOption('file')
#if script_dir == []:
# script_dir = '.'
#else:
# script_dir = script_dir[0]
colors = {}
colors['cyan'] = ''
colors['purple'] = ''
colors['blue'] = ''
colors['green'] = ''
colors['yellow'] = ''
colors['red'] = ''
colors['end'] = ''
#colors['cyan'] = '\033[96m'
#colors['purple'] = '\033[95m'
#colors['blue'] = '\033[94m'
#colors['green'] = '\033[92m'
#colors['yellow'] = '\033[93m'
#colors['red'] = '\033[91m'
#colors['end'] = '\033[0m'
main_env = Environment()
vars = Variables('build-setup.conf')
vars.Add('build_type', 'Could be RELEASE or DEBUG', 'release')
vars.Add('prefix', 'Prefix where to install', '/usr/local')
vars.Add('verbose', 'Activate verbosity', False)
vars.Update(main_env)
build_type = main_env['build_type'].lower()
build_dir = 'build-' + main_env['build_type'].lower()
print "Building in ", build_dir
if type(main_env['verbose']) is not bool:
main_env['verbose'] = (main_env['verbose'].lower() == 'true' or main_env['verbose'] == 1)
verbose = main_env['verbose']
if not verbose:
main_env['SHCXXCOMSTR'] = unicode('{0}[Compiling] {1}$SOURCE{2}'.format(colors['green'],colors['blue'],colors['end']))
main_env['SHLINKCOMSTR'] = unicode('{0}[Linking] {1}$TARGET{2}'.format(colors['purple'],colors['blue'],colors['end']))
main_env['SWIGCOMSTR'] = unicode('{0}[Swig] {1}$SOURCE{2}'.format(colors['yellow'],colors['blue'],colors['end']))
main_env['build_dir'] = build_dir
main_env.AppendUnique(CPPPATH=[Dir('#/src'),Dir('#/python')])
main_env.AppendUnique(CXXFLAGS=['-std=c++11', '-Wall', '-fopenmp'])
if build_type == 'debug': main_env.AppendUnique(CXXFLAGS='-g')
else : main_env.AppendUnique(CXXFLAGS='-O3')
main_env['LIBPATH'] = [os.path.abspath(os.path.join(build_dir,'src'))]
main_env['RPATH'] = "$LIBPATH"
main_env.AppendUnique(SHLINKFLAGS='-fopenmp')
# save new values
vars.Save('build-setup.conf', main_env)
Export('main_env')
SConscript('src/SConscript',variant_dir=os.path.join(build_dir,'src'),duplicate=False)
SConscript('python/SConscript',variant_dir=os.path.join(build_dir,'python'),duplicate=False)
# saving the env file
try:
env_file = open(os.path.join(build_dir,'tamaas_environement.sh'),'w')
env_file.write("""
export PYTHONPATH=$PYTHONPATH:{0}/python
""".format(os.path.abspath(build_dir)))
env_file.close()
except:
pass
Event Timeline
Log In to Comment