...
By default, SCons provides a mechanism similar to automake that allows users to specify the location of external libraries and their headers using --with-blah-lib and --with-blah-include
Wiki Markup |
---|
There is now a with-GLAST-EXT option where a user can specify a GLAST_EXT style directory layout for our libraries. Any of those libraries can still be overridden with the with-LIBRARY\[-lib \| \-include\] options. |
The scons-specific file: externals.scons sets up the external libraries and adds the appropriate -L options to the baseEnv and specifies the specific libraries from the externals to include in a build. Currently this externals.scons file is devoid of any version information, it is currently left to the user to provide the appropriate paths to the external libraries they desire to build against. This clearly allows more flexibility on the part of users. Using this paradigm we'll have to be careful to provide specific instructions in the workbook to point to our recommended versions and point out any gotchas such as ROOT being built against a specific version of python for instance in helping users determine what may be safe in terms of providing a user-defined version of some of the externals.
...
After all the SConscript files have been called, and registerObjects updated for each package, scons is ready to compute the dependencies and start the build in the correct order.
Dependency Computation
A feature of SCons, called a Tool, needs to be used to have SCons compute library dependencies for us. To do this, each package that creates a Static/Shared Library needs to create a python file called <package_Name>Lib.py. This file needs to define 2 functions generate(env, **kw) and exists(env). The exists() function only returns 1 while the generate function adds its own library to the list of libraries needed to be linked and libraries it DIRECTLY depends on. A sample for flux package is:
Wiki Markup |
---|
def generate(env, \**kw):
env.AppendUnique(LIBS = \['flux'\])
env.Tool('xmlBaseLib', toolpath = \['#xmlBase'\])
env.Tool('astroLib', toolpath = \['#astro'\])
env.AppendUnique(LIBS = env\['clhepLibs'\])
env.AppendUnique(LIBS = env\['cfitsioLibs'\]) |
The ordering of these libraries still needs to be addressed. Currently ST won't compile because the ordering of those libraries is not correct. There's an issue with shared library which requires that shared libraries be built in a separate environment (minor inconvenience).
Interesting Python filesystem manipulation routines
os.path.join joins 'src' and '*.cxx' together in the correct way ie \ for windows and / for linux
glob.glob then takes the src/*.cxx and gets a list of files that match that pattern
Todo
Clean up the way source files are defined. Having a bunch of glob.glob and os.path.join functions creates a lot of clutter
Deal with CMT style overriding of packages
Define Swig builder so ST can build swig libraries
Setup CVS to allow SCons style checkouts