#-*- python -*-
"""
@brief Top-level SConstruct file for example checkout package build.
@author J. Chiang <jchiang@slac.stanford.edu>
"""
#
# $Header: /nfs/slac/g/glast/ground/cvs/users/jchiang/DeploySCons/SConstruct,v 1.7 2007/05/22 01:08:06 jchiang Exp $
#
import os, glob
baseDir = os.path.abspath(os.curdir)
if os.name == 'nt':
bindir = 'VC8debug'
env.Append(CCFLAGS=['/EHsc'])
env['ENV']['TMP'] = os.environ['TMP']
elif os.name == 'posix':
bindir = 'rh9_gcc32'
# bindir = 'rhel4_gcc34'
def srcFiles(path):
query = '/usr/bin/find %s -name \*.c\* -print' % path
files = [item.strip() for item in os.popen(query)
if item.find('./test') == -1]
query = '/usr/bin/find %s -name \*.h -print' % path
hfiles = [item.strip() for item in os.popen(query)
if item.find('./test') == -1]
cpppaths = {}
for item in hfiles:
cpppaths[os.path.abspath(os.path.split(item)[0])] = 1
return files, cpppaths.keys()
def packageSetup(package, env):
packagedir = os.path.abspath('..')
src_files, paths = srcFiles(os.curdir)
cpppath = [packagedir]
cpppath.extend(paths)
env.Append(CPPPATH=cpppath, CCFLAGS=['-g'])
library = env.StaticLibrary(package, src_files)
installdir = os.path.join(packagedir, bindir)
env.Install(installdir, library)
env.Alias(package, installdir)
env.Default(package)
Export('package', 'packagedir', 'env', 'installdir')
SConscript(os.path.join('test', 'SConstruct'))
def extlibEnv(package, version, libs=None):
packageDir = os.path.join(os.environ['GLAST_EXT'], package, version)
if libs is None:
libs = [package]
return Environment(CPPPATH=[os.path.join(packageDir, 'include')],
LIBPATH=[os.path.join(packageDir, 'lib')],
LIBS=libs)
CLHEP = extlibEnv('CLHEP', '1.9.2.2')
cfitsio = extlibEnv('cfitsio', 'v3006')
ROOT = extlibEnv('ROOT', os.path.join('v5.10.00', 'root'),
libs=['Core', 'Cint', 'Tree', 'Matrix', 'Physics',
'Graf', 'Graf3d', 'Gpad', 'Rint', 'Postscript',
'TreePlayer', 'Hist', 'pthread', 'm', 'dl'])
fftw = extlibEnv('fftw', '3.0.1')
pil = extlibEnv('pil', '2.0.1')
xerces = extlibEnv('xerces', '2.6.0')
cppunit = extlibEnv('cppunit', '1.10.2')
exports = ['bindir', 'packageSetup', 'cfitsio', 'CLHEP', 'ROOT',
'fftw', 'pil', 'xerces', 'cppunit']
def packageEnv(package, version):
packageDir = os.path.join(baseDir, package, version)
return Environment(CPPPATH=[os.path.join(packageDir)],
LIBPATH=[os.path.join(packageDir, bindir)],
LIBS=[package]), packageDir
packages = {'facilities' : 'v2r12p5',
'tip' : 'v2r12',
'astro' : 'v2r9',
'st_stream' : 'v0r5',
'hoops' : 'v0r4p5',
'st_graph' : 'v1r7',
'st_app' : 'v2'}
for package in packages:
exec('%s, %sDir = packageEnv("%s", "%s")' % (package, package,
package, packages[package]))
exports.append(package)
Export(*exports)
for package in packages:
exec('SConscript(os.path.join(%sDir, "src", "SConscript"))' % package)
|