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 @@ ...@@ -4,12 +4,12 @@
import os import os
import re import re
import SCons.Util import SCons.Util
Import ('baseenv') Import ('pbaseenv')
######## ROOT Dictionaries ######### ######## ROOT Dictionaries #########
roothcdict = baseenv.subst('$HC_DIR')+'/HallCDict.C' roothcdict = pbaseenv.subst('$HC_DIR')+'/HallCDict.C'
roothcobj = baseenv.subst('$HC_SRC')+'/HallCDict.so' roothcobj = pbaseenv.subst('$HC_SRC')+'/HallCDict.so'
hcheaders = Split(""" hcheaders = Split("""
src/THcInterface.h src/THcParmList.h src/THcAnalyzer.h src/THcHallCSpectrometer.h 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 src/THcDetectorMap.h src/THcRawHit.h src/THcHitList.h src/THcSignalHit.h src/THcHodoscope.h
...@@ -19,12 +19,10 @@ hcheaders = Split(""" ...@@ -19,12 +19,10 @@ hcheaders = Split("""
src/THcRawShowerHit.h src/THcAerogel.h src/THcAerogelHit.h src/THcGlobals.h src/THcDCTrack.h src/THcRawShowerHit.h src/THcAerogel.h src/THcAerogelHit.h src/THcGlobals.h src/THcDCTrack.h
src/HallC_LinkDef.h src/HallC_LinkDef.h
""") """)
baseenv.RootCint(roothcdict,hcheaders) pbaseenv.RootCint(roothcdict,hcheaders)
baseenv.SharedObject(target = roothcobj, source = roothcdict) pbaseenv.SharedObject(target = roothcobj, source = roothcdict)
####### Start of main SConscript ########### ####### Start of main SConscript ###########
analyzer = pbaseenv.Program(target = 'hcana', source = 'src/main.o')
analyzer = baseenv.Program(target = 'hcana', source = 'src/main.o') pbaseenv.Install('./bin',analyzer)
baseenv.Install('./bin',analyzer) pbaseenv.Alias('install',['./bin'])
baseenv.Alias('install',['./bin'])
...@@ -22,13 +22,17 @@ def rootcint(target,source,env): ...@@ -22,13 +22,17 @@ def rootcint(target,source,env):
return ok return ok
baseenv = Environment(ENV = os.environ) baseenv = Environment(ENV = os.environ)
#dict = baseenv.Dictionary() #dict = baseenv.Dictionary()
#keys = dict.keys() #keys = dict.keys()
#keys.sort() #keys.sort()
#for key in keys: #for key in keys:
# print "Construction variable = '%s', value = '%s'" % (key, dict[key]) # 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 ############# ####### Hall A Build Environment #############
# #
# Edit for the location of your root installation here ... # Edit for the location of your root installation here ...
...@@ -75,18 +79,23 @@ if not conf.CheckFunc('printf'): ...@@ -75,18 +79,23 @@ if not conf.CheckFunc('printf'):
baseenv = conf.Finish() baseenv = conf.Finish()
######## ROOT Dictionaries ######### ######## ROOT Dictionaries #########
baseenv.Append(ROOTCONFIG = 'root-config')
rootsys = baseenv['ENV']['ROOTSYS'] baseenv.Append(ROOTCINT = 'rootcint')
baseenv.Append(ROOTCONFIG = rootsys+'/bin/root-config')
baseenv.Append(ROOTCINT = rootsys+'/bin/rootcint')
try: try:
baseenv.ParseConfig('$ROOTCONFIG --cflags') baseenv.ParseConfig('$ROOTCONFIG --cflags')
baseenv.ParseConfig('$ROOTCONFIG --libs') baseenv.ParseConfig('$ROOTCONFIG --libs')
#baseenv.MergeFlags('-fPIC') baseenv.MergeFlags('-fPIC')
except OSError: except OSError:
print "ROOT not found!!" try:
exit(1) 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) bld = Builder(action=rootcint)
baseenv.Append(BUILDERS = {'RootCint': bld}) baseenv.Append(BUILDERS = {'RootCint': bld})
...@@ -99,11 +108,16 @@ dclib = 'dc' ...@@ -99,11 +108,16 @@ dclib = 'dc'
scalerlib = 'scaler' scalerlib = 'scaler'
baseenv.Append(LIBPATH=['$HC_DIR','$HA_DIR','$HC_SRC','$HA_SRC','$HA_DC','$HA_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.Replace(SHLIBSUFFIX = '.so')
baseenv.Append(CPPDEFINES = '-DHALLC_MODS')
directorylist = ['./','src','podd','podd/src','podd/hana_decode','podd/hana_scaler'] 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 ######### ####### End of SConstruct #########
...@@ -6,44 +6,48 @@ def config(env,args): ...@@ -6,44 +6,48 @@ def config(env,args):
if env['PLATFORM'] == 'posix': if env['PLATFORM'] == 'posix':
if (platform.machine() == 'x86_64'): if (platform.machine() == 'x86_64'):
print "Got a 64-bit processor, I can do a 64-bit build in theory..." print "Got a 64-bit processor, I can do a 64-bit build in theory..."
if args.get('32bit', 0): for element in platform.architecture():
print '32-bit Linux build' if (element == '32bit'):
env['MEMORYMODEL'] = '32bit' print '32-bit Linux build'
#import linux6432 env['MEMORYMODEL'] = '32bit'
#linux6432.config(env, args) import linux32
elif args.get('64bit', 0): linux32.config(env, args)
env['MEMORYMODEL'] = '64bit' break
#import linux64 elif (element == '64bit'):
#linux64.config(env, args) print '64-bit Linux build'
else: env['MEMORYMODEL'] = '64bit'
print 'Memory model not specified, so I\'m building 32-bit...' import linux64
env['MEMORYMODEL'] = '32bit' linux64.config(env, args)
import linux6432 break
linux6432.config(env, args) else:
print 'Memory model not specified, so I\'m building 32-bit...'
env['MEMORYMODEL'] = '32bit'
import linux32
linux32.config(env, args)
else: else:
print '32-bit Linux Build.' print '32-bit Linux Build.'
env['MEMORYMODEL'] = '32bit' env['MEMORYMODEL'] = '32bit'
import linux32 import linux32
linux32.config(env, args) linux32.config(env, args)
elif env['PLATFORM'] == 'win32': # elif env['PLATFORM'] == 'win32':
if (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or (os.environ.has_key('PROCESSOR_ARCHITEW6432') and os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64')): # 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..." # print "Got a 64-bit processor, I can do a 64-bit build in theory..."
if args.get('32bit', 0): # if args.get('32bit', 0):
print '32-bit Windows build.' # print '32-bit Windows build.'
#import win6432 # #import win6432
#win6432.config(env, args) # #win6432.config(env, args)
elif args.get('64bit', 0): # elif args.get('64bit', 0):
print '64-bit Windows build.' # print '64-bit Windows build.'
#import win64 # #import win64
#win64.config(env, args) # #win64.config(env, args)
else: # else:
print 'Memory model not specified, so I\'m building 32-bit.' # print 'Memory model not specified, so I\'m building 32-bit.'
#import win6432 # #import win6432
#win6432.config(env, args) # #win6432.config(env, args)
else: # else:
print '32-bit Windows build.' # print '32-bit Windows build.'
#import win32 # #import win32
#win32.config(env, args) # #win32.config(env, args)
elif env['PLATFORM'] == 'darwin': elif env['PLATFORM'] == 'darwin':
print 'OS X Darwin is a 64-bit build.' print 'OS X Darwin is a 64-bit build.'
env['MEMORYMODEL'] = '64bit' env['MEMORYMODEL'] = '64bit'
......
...@@ -14,7 +14,7 @@ def config(env,args): ...@@ -14,7 +14,7 @@ def config(env,args):
if int(standalone): if int(standalone):
env.Append(STANDALONE= '1') env.Append(STANDALONE= '1')
env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual') env.Append(CXXFLAGS = '-m32 -Wall -Woverloaded-virtual')
env.Append(CPPDEFINES = '-DLINUXVERS') env.Append(CPPDEFINES = '-DLINUXVERS')
cxxversion = env.subst('$CXXVERSION') cxxversion = env.subst('$CXXVERSION')
...@@ -25,7 +25,7 @@ def config(env,args): ...@@ -25,7 +25,7 @@ def config(env,args):
if float(cxxversion[0:2])>=3.0: if float(cxxversion[0:2])>=3.0:
env.Append(CPPDEFINES = '-DHAS_SSTREAM') env.Append(CPPDEFINES = '-DHAS_SSTREAM')
env['SHLINKFLAGS'] = '$LINKFLAGS -shared' env['SHLINKFLAGS'] = '$LINKFLAGS -m32 -shared'
env['SHLIBSUFFIX'] = '.so' 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