Skip to content
Snippets Groups Projects
Commit 73f6fe21 authored by Edward Brash's avatar Edward Brash
Browse files

1. Implement changes in SCons to improve detection of ROOT installation

and SCons version checking (now checks for version 4.9.9 of SCons, which
is the newly implemented version number in the local SCons installation
(in podd).  Note that this change will now require use of that updated local version as
packaged with podd.

2.  Change to SConstruct.py to add -DHALLC_MODS defines (now consistent
with Makefile) for conditional compilation in certain parts of podd.

3.  Improvement in configuration for 64bit/32bit compilation on Linux.
parent 12abce8e
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,12 @@
import os
import re
import SCons.Util
Import ('baseenv')
Import ('pbaseenv')
######## ROOT Dictionaries #########
roothcdict = baseenv.subst('$HC_DIR')+'/HallCDict.C'
roothcobj = baseenv.subst('$HC_SRC')+'/HallCDict.so'
roothcdict = pbaseenv.subst('$HC_DIR')+'/HallCDict.C'
roothcobj = pbaseenv.subst('$HC_SRC')+'/HallCDict.so'
hcheaders = Split("""
src/THcInterface.h src/THcParmList.h src/THcAnalyzer.h src/THcHallCSpectrometer.h
src/THcDetectorMap.h src/THcRawHit.h src/THcHitList.h src/THcSignalHit.h src/THcHodoscope.h
......@@ -19,12 +19,10 @@ hcheaders = Split("""
src/THcRawShowerHit.h src/THcAerogel.h src/THcAerogelHit.h src/THcGlobals.h src/THcDCTrack.h
src/HallC_LinkDef.h
""")
baseenv.RootCint(roothcdict,hcheaders)
baseenv.SharedObject(target = roothcobj, source = roothcdict)
pbaseenv.RootCint(roothcdict,hcheaders)
pbaseenv.SharedObject(target = roothcobj, source = roothcdict)
####### Start of main SConscript ###########
analyzer = baseenv.Program(target = 'hcana', source = 'src/main.o')
baseenv.Install('./bin',analyzer)
baseenv.Alias('install',['./bin'])
analyzer = pbaseenv.Program(target = 'hcana', source = 'src/main.o')
pbaseenv.Install('./bin',analyzer)
pbaseenv.Alias('install',['./bin'])
......@@ -22,13 +22,17 @@ def rootcint(target,source,env):
return ok
baseenv = Environment(ENV = os.environ)
#dict = baseenv.Dictionary()
#keys = dict.keys()
#keys.sort()
#for key in keys:
# print "Construction variable = '%s', value = '%s'" % (key, dict[key])
####### Check SCons version ##################
print('!!! You should be using the local version of SCons, invoked with:')
print('!!! ./podd/scons/scons.py')
EnsureSConsVersion(4,9,9)
####### Hall A Build Environment #############
#
# Edit for the location of your root installation here ...
......@@ -75,18 +79,23 @@ if not conf.CheckFunc('printf'):
baseenv = conf.Finish()
######## ROOT Dictionaries #########
rootsys = baseenv['ENV']['ROOTSYS']
baseenv.Append(ROOTCONFIG = rootsys+'/bin/root-config')
baseenv.Append(ROOTCINT = rootsys+'/bin/rootcint')
baseenv.Append(ROOTCONFIG = 'root-config')
baseenv.Append(ROOTCINT = 'rootcint')
try:
baseenv.ParseConfig('$ROOTCONFIG --cflags')
baseenv.ParseConfig('$ROOTCONFIG --libs')
#baseenv.MergeFlags('-fPIC')
baseenv.ParseConfig('$ROOTCONFIG --cflags')
baseenv.ParseConfig('$ROOTCONFIG --libs')
baseenv.MergeFlags('-fPIC')
except OSError:
print "ROOT not found!!"
exit(1)
try:
baseenv.Replace(ROOTCONFIG = baseenv['ENV']['ROOTSYS'] + '/bin/root-config')
baseenv.Replace(ROOTCINT = baseenv['ENV']['ROOTSYS'] + '/bin/rootcint')
baseenv.ParseConfig('$ROOTCONFIG --cflags')
baseenv.ParseConfig('$ROOTCONFIG --libs')
baseenv.MergeFlags('-fPIC')
except KeyError:
print('!!! Cannot find ROOT. Check if root-config is in your PATH.')
Exit(1)
bld = Builder(action=rootcint)
baseenv.Append(BUILDERS = {'RootCint': bld})
......@@ -99,11 +108,16 @@ dclib = 'dc'
scalerlib = 'scaler'
baseenv.Append(LIBPATH=['$HC_DIR','$HA_DIR','$HC_SRC','$HA_SRC','$HA_DC','$HA_SCALER'])
baseenv.Append(LIBS=[hallclib,hallalib,dclib,scalerlib])
baseenv.Replace(SHLIBSUFFIX = '.so')
baseenv.Append(CPPDEFINES = '-DHALLC_MODS')
directorylist = ['./','src','podd','podd/src','podd/hana_decode','podd/hana_scaler']
SConscript(dirs = directorylist,name='SConscript.py',exports='baseenv')
pbaseenv=baseenv.Clone()
pbaseenv.Append(LIBS=[hallclib,hallalib,dclib,scalerlib])
baseenv.Append(LIBS=[hallalib,dclib,scalerlib])
Export('pbaseenv')
SConscript(dirs = directorylist,name='SConscript.py',exports='pbaseenv')
####### End of SConstruct #########
......@@ -6,44 +6,48 @@ def config(env,args):
if env['PLATFORM'] == 'posix':
if (platform.machine() == 'x86_64'):
print "Got a 64-bit processor, I can do a 64-bit build in theory..."
if args.get('32bit', 0):
print '32-bit Linux build'
env['MEMORYMODEL'] = '32bit'
#import linux6432
#linux6432.config(env, args)
elif args.get('64bit', 0):
env['MEMORYMODEL'] = '64bit'
#import linux64
#linux64.config(env, args)
else:
print 'Memory model not specified, so I\'m building 32-bit...'
env['MEMORYMODEL'] = '32bit'
import linux6432
linux6432.config(env, args)
for element in platform.architecture():
if (element == '32bit'):
print '32-bit Linux build'
env['MEMORYMODEL'] = '32bit'
import linux32
linux32.config(env, args)
break
elif (element == '64bit'):
print '64-bit Linux build'
env['MEMORYMODEL'] = '64bit'
import linux64
linux64.config(env, args)
break
else:
print 'Memory model not specified, so I\'m building 32-bit...'
env['MEMORYMODEL'] = '32bit'
import linux32
linux32.config(env, args)
else:
print '32-bit Linux Build.'
env['MEMORYMODEL'] = '32bit'
import linux32
linux32.config(env, args)
elif env['PLATFORM'] == 'win32':
if (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or (os.environ.has_key('PROCESSOR_ARCHITEW6432') and os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64')):
print "Got a 64-bit processor, I can do a 64-bit build in theory..."
if args.get('32bit', 0):
print '32-bit Windows build.'
#import win6432
#win6432.config(env, args)
elif args.get('64bit', 0):
print '64-bit Windows build.'
#import win64
#win64.config(env, args)
else:
print 'Memory model not specified, so I\'m building 32-bit.'
#import win6432
#win6432.config(env, args)
else:
print '32-bit Windows build.'
#import win32
#win32.config(env, args)
# elif env['PLATFORM'] == 'win32':
# if (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or (os.environ.has_key('PROCESSOR_ARCHITEW6432') and os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64')):
# print "Got a 64-bit processor, I can do a 64-bit build in theory..."
# if args.get('32bit', 0):
# print '32-bit Windows build.'
# #import win6432
# #win6432.config(env, args)
# elif args.get('64bit', 0):
# print '64-bit Windows build.'
# #import win64
# #win64.config(env, args)
# else:
# print 'Memory model not specified, so I\'m building 32-bit.'
# #import win6432
# #win6432.config(env, args)
# else:
# print '32-bit Windows build.'
# #import win32
# #win32.config(env, args)
elif env['PLATFORM'] == 'darwin':
print 'OS X Darwin is a 64-bit build.'
env['MEMORYMODEL'] = '64bit'
......
......@@ -14,7 +14,7 @@ def config(env,args):
if int(standalone):
env.Append(STANDALONE= '1')
env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual')
env.Append(CXXFLAGS = '-m32 -Wall -Woverloaded-virtual')
env.Append(CPPDEFINES = '-DLINUXVERS')
cxxversion = env.subst('$CXXVERSION')
......@@ -25,7 +25,7 @@ def config(env,args):
if float(cxxversion[0:2])>=3.0:
env.Append(CPPDEFINES = '-DHAS_SSTREAM')
env['SHLINKFLAGS'] = '$LINKFLAGS -shared'
env['SHLINKFLAGS'] = '$LINKFLAGS -m32 -shared'
env['SHLIBSUFFIX'] = '.so'
......
File moved
Subproject commit 5dbaea975ff82d567c1ec4ef866634dc97bb55b3
Subproject commit 19b46dc1681c8e4c3955b2eb3f7596e782bbabba
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment