int main() {
printf("Hello, world!\n");
}
Program('helloworld.c')
StaticLibrary('foo', ['f1.c', 'f2.c', 'f3.c'])
SharedLibrary('foo2', ['f4.c', 'f5.c', 'f3.c'])
CMTPATH = zone1:zone2:zone3 ou CMTPROJECTPATH = zone1:zone2:zone3
Gestion des packages "à la CMT" :
|-- interfaces
| |-- CLHEP
| | |-- SConscript
| |-- HDF5
| | |-- SConscript
| |-- dld
| | |-- SConscript
| `-- zlib
| |-- SConscript
#
# File Interface/HDF5/SConcript
#
import os.path
import sys
Import('env')
# for HDF5 :
env.Replace(HDF5_native_version='1.6.5')
if (sys.platform == 'win32') :
env.Replace(HDF5_home='C:\usr\local\HDF5\$HDF5_native_version')
elif (sys.platform == 'darwin'):
env.Replace(HDF5_home='/usr/local/hdf5/')
else :
env.Replace(HDF5_home='/usr/local/hdf5-$HDF5_native_version')
env.Append(CPPPATH = ['$HDF5_home/$HDF5_native_version/include'])
env.Prepend(LIBPATH = ['$HDF5_home/$HDF5_native_version/lib'])
env.Prepend(LIBS = ['hdf5'])
if (sys.platform != 'win32') :
env.PrependENVPath('LD_LIBRARY_PATH', env.Dir('$HDF5_home/lib').abspath)
if (sys.platform == 'darwin') :
env.PrependENVPath('DYLD_LIBRARY_PATH', env.Dir('$HDF5_home/lib').abspath)
if (sys.platform != 'win32') :
env.PrependENVPath('PATH', env.Dir('$HDF5_home/bin').abspath)
else :
env.PrependENVPath('PATH', env.Dir('$HDF5_home\bin').abspath)
#
# File bhep/SConcript
#
import os.path
import glob
import sys
import SCons.Tool
#import version
#Export('version')
#EnsurePythonVersion(2,3)
# List of Interfaces
interfaces = ['CLHEP','HDF5','zlib','dld']
env = Environment()
# no DEBUG
debug=0
# Get Interfaces scripts
for dict in interfaces :
print "Reading Interfaces %s" % (dict)
SConscript('platform'+os.sep+'interfaces'+os.sep+'%s'%dict+os.sep+'SConscript', exports=['env','debug'])
env.Replace(BUILDTOP=['#Release'+os.sep+'${PLATFORM}'])
env.Replace(BINDIR = ['${BUILDTOP}'+os.sep+'bin'])
env.Replace(LIBDIR = ['${BUILDTOP}'+os.sep+'lib'])
env.Replace(INCDIR = ['${BUILDTOP}'+os.sep+'include'])
env.Replace(OBJDIR = ['${BUILDTOP}'+os.sep+'obj'])
# Set the sources to 'source directory
env.Replace(SRCDIR = ['sources'])
# set the cache dir
CacheDir('cache')
# Set the build dir of all cpp files in build directory
for projects in [
'.',
'base',
'util',
'converters',
'manager',
'examples',
'tutorials',
'histos',
'tools'] :
BuildDir(env.Dir('$OBJDIR').abspath+os.sep+projects,projects, duplicate=0)
# CPPPATH for my files
env.Append(CPPPATH = [env.Dir('$SRCDIR').abspath+os.sep+'.',
env.Dir('$SRCDIR').abspath+os.sep+'bhep',
env.Dir('$SRCDIR').abspath+os.sep+'examples',
env.Dir('$SRCDIR').abspath+os.sep+'tutorials'])
|
# REPOSITORY :
# but very strange comportment, dir 'base' will be checkout correctly, but 'util' won't...
# and a dir call 'bu' will and 'bus' won't... WHY ???
#svn = SCons.Tool.Tool('Subversion')
#svn(env)
#env.SourceCode('.', env.Subversion('svn://neutrinos1.ific.uv.es:/usr/local/svn/nautilus/bhep/tags/bhepv1r5p2'))
# PRINT EVERYTHING
#for key, val in env.items():
# print " %-20s %s" % (key, val)
print "CPPPATH =", env['CPPPATH']
print "CXXFLAGS =", env['CXXFLAGS']
print "CCFLAGS =", env['CCFLAGS']
print "CFLAGS =", env['CFLAGS']
# sources
bhep_sources = [
'version.cpp',
'base/event.cpp',
'base/hit.cpp',
'base/mparticle.cpp',
'base/particle.cpp',
'base/sparticle.cpp',
'base/track.cpp',
'util/particle_definition.cpp',
'util/ray.cpp',
'util/material.cpp',
'converters/event_cvt.cpp',
'converters/hit_cvt.cpp',
'converters/mparticle_cvt.cpp',
'converters/particle_cvt.cpp',
'converters/sparticle_cvt.cpp',
'converters/track_cvt.cpp',
'manager/base_reader.cpp',
'manager/bhep_svc.cpp',
'manager/brw.cpp',
'manager/converter_svc.cpp',
'manager/random_reader.cpp',
'manager/random_writer.cpp',
'manager/reader_gz.cpp',
'manager/reader_hdf5.cpp',
'manager/reader_txt.cpp',
'manager/sequential_reader.cpp',
'manager/sequential_writer.cpp',
'manager/writer_gz.cpp',
'manager/writer_hdf5.cpp',
'manager/writer_txt.cpp',
'examples/generate_event.cpp',
'tutorials/gevent.cpp',
'histos/axis.cpp',
'histos/histogram.cpp',
'tools/EventManager.cpp']
# 'tools/EventManager.cpp2']
bhep_sources = [os.path.join(env.Dir('$OBJDIR').abspath+os.sep, x) for x in bhep_sources]
bhep_sources = [x.replace('/',os.sep) for x in bhep_sources]
# name of the library
bhep_libname = 'bhep'
# shared lib :
env.SharedLibrary(target=bhep_libname,
source = bhep_sources)
# install the library
env['BHEP_LIBNAME'] = env.subst(env['SHLIBPREFIX'])+bhep_libname+env.subst(env['SHLIBSUFFIX'])
env.Install(env['LIBDIR'], env['BHEP_LIBNAME'])
|
Questions ?