Skip to content
Snippets Groups Projects
Commit d5e5572a authored by Ole Hansen's avatar Ole Hansen Committed by Stephen A. Wood
Browse files

Let Podd fetch local modules from Podd's site_scons

parent 03b66787
No related branches found
No related tags found
No related merge requests found
......@@ -3,12 +3,10 @@
###### Author: Edward Brash (brash@jlab.org) June 2013
import os
#import sys
import sys
#import platform
#import commands
import SCons
import configure
from rootcint import rootcint
import subprocess
####### Check SCons version ##################
......@@ -16,17 +14,17 @@ print('!!! Building the Hall C analyzer and libraries with SCons requires')
print('!!! SCons version 2.5.0 or newer.')
EnsureSConsVersion(2,5,0)
baseenv = Environment(ENV = os.environ,tools=["default"],toolpath=['site_scons'])
baseenv = Environment(ENV = os.environ,tools=["default"],toolpath=['podd/site_scons'])
####### Hall A Build Environment #############
#
baseenv.Append(HEAD_DIR= Dir('.').abspath)
baseenv.Append(HC_DIR= baseenv.subst('$HEAD_DIR'))
baseenv.Append(HC_SRC= baseenv.subst('$HC_DIR')+'/src ')
baseenv.Append(HA_DIR= baseenv.subst('$HC_DIR')+'/podd ')
baseenv.Append(HC_SRC= baseenv.subst('$HC_DIR')+'/src')
baseenv.Append(HA_DIR= baseenv.subst('$HC_DIR')+'/podd')
baseenv.Append(MAIN_DIR= baseenv.subst('$HEAD_DIR'))
baseenv.Append(HA_SRC= baseenv.subst('$HA_DIR')+'/src ')
baseenv.Append(HA_DC= baseenv.subst('$HA_DIR')+'/hana_decode ')
baseenv.Append(HA_SRC= baseenv.subst('$HA_DIR')+'/src')
baseenv.Append(HA_DC= baseenv.subst('$HA_DIR')+'/hana_decode')
baseenv.Append(MAJORVERSION = '1')
baseenv.Append(MINORVERSION = '6')
baseenv.Append(PATCH = '0')
......@@ -42,6 +40,10 @@ ivercode = 65536*int(float(baseenv.subst('$SOVERSION')))+ 256*int(10*(float(base
baseenv.Append(VERCODE = ivercode)
baseenv.Append(CPPPATH = ['$HC_SRC','$HA_SRC','$HA_DC'])
sys.path.insert(1,baseenv.subst('$HA_DIR'+'/site_scons'))
import configure
from rootcint import rootcint
configure.FindROOT(baseenv)
bld = Builder(action=rootcint)
......
import sys
import platform
import os
import subprocess
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..."
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'] == 'darwin':
print 'OS X Darwin is a 64-bit build.'
env['MEMORYMODEL'] = '64bit'
import darwin64
darwin64.config(env, args)
else:
print 'ERROR! unrecognized platform. Twonk.'
# which() utility
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
####### ROOT Definitions ####################
def FindROOT(env, need_glibs = True):
root_config = 'root-config'
try:
env.PrependENVPath('PATH',env['ENV']['ROOTSYS'] + '/bin')
except KeyError:
pass # ROOTSYS not defined
try:
if need_glibs:
env.ParseConfig(root_config + ' --cflags --glibs')
else:
env.ParseConfig(root_config + ' --cflags --libs')
if sys.version_info >= (2, 7):
cmd = root_config + ' --cxx'
env.Replace(CXX = subprocess.check_output(cmd, shell=True).rstrip())
cmd = root_config + ' --version'
env.Replace(ROOTVERS = subprocess.check_output(cmd, shell=True).rstrip())
else:
env.Replace(CXX = subprocess.Popen([root_config, '--cxx'],\
stdout=subprocess.PIPE).communicate()[0].rstrip())
env.Replace(ROOTVERS = subprocess.Popen([root_config,\
'--version'],stdout=subprocess.PIPE).communicate()[0].rstrip())
if platform.system() == 'Darwin':
try:
env.Replace(LINKFLAGS = env['LINKFLAGS'].remove('-pthread'))
except:
pass # '-pthread' was not present in LINKFLAGS
except OSError:
print('!!! Cannot find ROOT. Check if root-config is in your PATH.')
env.Exit(1)
#end configure.py
import platform
import os
def config(env,args):
debug = args.get('debug',0)
standalone = args.get('standalone',0)
cppcheck = args.get('cppcheck',0)
checkheaders = args.get('checkheaders',0)
if int(debug):
env.Append(CXXFLAGS = '-g -O0')
else:
env.Append(CXXFLAGS = '-O')
env.Append(CPPDEFINES= '-DNDEBUG')
if int(standalone):
env.Append(STANDALONE= '1')
if int(cppcheck):
env.Append(CPPCHECK= '1')
if int(checkheaders):
env.Append(CHECKHEADERS= '1')
#env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual -pthread -rdynamic')
env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual -pthread')
env.Append(CPPDEFINES = '-DMACVERS')
cxxversion = env.subst('$CXXVERSION')
# if float(cxxversion[0:2])>=4.0:
# env.Append(CXXFLAGS = '-Wextra -Wno-missing-field-initializers')
if float(cxxversion[0:2])>=3.0:
env.Append(CPPDEFINES = '-DHAS_SSTREAM')
env['SHLINKFLAGS'] = '$LINKFLAGS -shared -Wl,-undefined,dynamic_lookup'
env['SHLIBSUFFIX'] = '.so'
#end darwin64.py
import platform
import os
def config(env,args):
debug = args.get('debug',0)
standalone = args.get('standalone',0)
cppcheck = args.get('cppcheck',0)
checkheaders = args.get('checkheaders',0)
if int(debug):
env.Append(CXXFLAGS = '-g -O0')
else:
env.Append(CXXFLAGS = '-O')
env.Append(CPPDEFINES= '-DNDEBUG')
if int(standalone):
env.Append(STANDALONE= '1')
if int(cppcheck):
env.Append(CPPCHECK= '1')
if int(checkheaders):
env.Append(CHECKHEADERS= '1')
env.Append(CXXFLAGS = '-m32')
env.Append(CXXFLAGS = '-Wall')
env.Append(CXXFLAGS = '-Woverloaded-virtual')
env.Append(CPPDEFINES = '-DLINUXVERS')
cxxversion = env.subst('$CXXVERSION')
# if float(cxxversion[0:2])>=4.0:
# env.Append(CXXFLAGS = '-Wextra -Wno-missing-field-initializers')
if float(cxxversion[0:2])>=3.0:
env.Append(CPPDEFINES = '-DHAS_SSTREAM')
env['SHLINKFLAGS'] = '$LINKFLAGS -m32 -shared'
env['SHLIBSUFFIX'] = '.so'
#end linux32.py
import platform
import os
def config(env,args):
debug = args.get('debug',0)
standalone = args.get('standalone',0)
cppcheck = args.get('cppcheck',0)
checkheaders = args.get('checkheaders',0)
if int(debug):
env.Append(CXXFLAGS = '-g -O0')
else:
env.Append(CXXFLAGS = '-O')
env.Append(CPPDEFINES= '-DNDEBUG')
if int(standalone):
env.Append(STANDALONE= '1')
if int(cppcheck):
env.Append(CPPCHECK= '1')
if int(checkheaders):
env.Append(CHECKHEADERS= '1')
env.Append(CXXFLAGS = '-Wall')
env.Append(CXXFLAGS = '-Woverloaded-virtual')
env.Append(CPPDEFINES = '-DLINUXVERS')
cxxversion = env.subst('$CXXVERSION')
# if float(cxxversion[0:2])>=4.0:
# env.Append(CXXFLAGS = '-Wextra -Wno-missing-field-initializers')
if float(cxxversion[0:2])>=3.0:
env.Append(CPPDEFINES = '-DHAS_SSTREAM')
env['SHLINKFLAGS'] = '$LINKFLAGS -shared'
env['SHLIBSUFFIX'] = '.so'
#end linux6432.py
# rootcint.py
import os
def rootcint(target,source,env):
"""Executes the ROOT dictionary generator over a list of headers."""
dictname = target[0]
cpppath = env.subst('$_CCCOMCOM')
# ccflags = env.subst('$CCFLAGS')
# print ("Doing rootcint call now ...")
headers = ""
for f in source:
headers += str(f) + " "
command = "rootcint -f %s -c %s %s" % (dictname,cpppath,headers)
# print ('RootCint Command = %s\n' % command)
ok = os.system(command)
return ok
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