Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

/
    SConstruct
    externals.scons            List of externals and their versions.  Can utilize GLAST_EXT or over-ride individual libraries.  Check scons -h for available options.
    (Likelihood)                  Directories are in ( )
    (facilities)
        SConscript
        facilitiesLib.py            <package>Lib.py lives in each package
    (site_scons)
        (site_tool)                  SCons looks here by default for tools
    (include)                       installation location for public headers
    (lib)                              installation location for libraries

automated dependencies

Recommended fix from SCons developers is to introduce a SCons tool (a python function) which is used to update the environment.  Tools are located in the site_tool directory by default, this can be over-ridden via an option when invoking the tool.  Rather than use the site_tool location, there is a <package>Lib.py file within each package.  Similar in function to CMT's "use" statements, this file lists what other packages this package requires.  Only lists direct dependencies, SCons figures out the rest.

...

Python imports:
import os, glob
Import('baseEnv')     Note the big "I" for a SCons import.  Also note that the objects are writable and changes will propogate to all.
Import('registerObjects'

Navid is looking for a way to make the objects read-only, but for now, we make a copy of the baseEnv so that clients will not modify it and muddy it for others.

...

Now to define the facilities static library, similiarly for a shared library.
facilitiesLib = env.StaticLibrary('facilities',                                               library name
                                             glob.glob(os.path.join('src', '.cxx'))  *       glob.glob explands wildcards  os.path.join inserts the appropriate slashes for each OS.
We can utilize subdirectories for the source location as well.

Wiki Markup*{_}registerObjects('facilities', {'libraries':\[facilitiesLib\], 'includes':\[glob.glob(os.path.join('facilities', '\*_{*}_._{*}{_}h'))_*

Each package contains a tool,  <package>Lib.py which defines a python function according to SCons' specific form.  The facilitiesLib.py file contains two functions:
generate which does the work, and exists which provides the ability to turn off the tool.

def generate(env, **kw):  dictionary of keywords, which is not used now for ST where single libraries are created but GR will create packages where libraries may have different dependencies.unmigrated-wiki-markup

env.Tool('addLibrary', library=\['facilities'\])&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; to call a tool&nbsp;&nbsp;&nbsp; addLibrary was created by Navid.&nbsp; This adds the facilities to a list of         to call a tool    addLibrary was created by Navid.  This adds the facilities to a list of libraries.

site_tools contains addLibrary
ordering in gcc matters for libs - can't find symbols otherwise.  The addLibrary tool allows developers to avoid worrying about the order themselves, since the tool reorders as necessary.   addLibrary makes sure the order is correct, if the item is not already the list, add it to the end, if it is already there, move it to the end.  Each library only appears once - this helps reduce the chance of creating a command line that is too long (which can occur when dealing with the Gaudi libraries).

Discussion

Wiki MarkupAfter building the libraries will exist in both the packages and in the installation lib directory.&nbsp;   After the build is completed, all we need is the include and lib directories for runtime. _\
[Actually this was true at the time of the discussion, but since then Navid has backed off having the SCons build perform the installation step and will copy the necessary files to the installation directories as a separate step.&nbsp;   Aug 20, 2007\]_

Jim reminded us that it would be helpful to provide a mechanism for tags such as rh9_gcc32 and rhel4, similarly for opt and debug builds.  Navid could implement subdirectories with expanded English names as he's found some users are confused by our use of rh9_gcc32 for instance, something like redhat9_optimized.

...

Import('baseEnv')
Import('registerObjects')
env = baseEnv.Copy()
env.Tool('LikelihoodLib')            The applications can depend on the Likelihood library, LikelihoodLib.py sets up the environment to handle this.

Wiki Markup*{_}LikelihoodLib = env.StaticLibrary('Likelihood', \ [glob.glob(os.path.join('src','.c')), glob.glob(os.path.join('src','.cxx'))\])_* *{_}gtlikelihoodBin =
gtlikelihoodBin = env.Program('gtlikelihood',glob.glob(os.path.join('src','likelihood','_{*}_.cxx')))_\*

The contents of LikelihoodLib.py:

Wiki Markup&nbsp;*{_}def  def generate(env, \ **kw):_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('addLibrary', library=\['Likelihood'\])_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('astroLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('xmlBaseLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('tipLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('evtbinLib')&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;_* <span style="color: #3300ff"><strong>The libraries can be added in any order, they will be sorted later</strong></span> *_&nbsp;&nbsp;&nbsp;                                                                   The libraries can be added in any order, they will be sorted later
    env.Tool('map_toolsLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('optimizersLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('optimizersLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('irfLoaderLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('st_facilitiesLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('dataSubselectorLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('hoopsLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('st_appLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('st_graphLib')_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('addLibrary', library=env\['cfitsioLibs'\])&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;_* <span style="color: #3300ff"><strong>Note how the external libraries are handled</strong></span> *_&nbsp;&nbsp;&nbsp; ])                     Note how the external libraries are handled
    env.Tool('addLibrary', library=env\['cppunitLibs'\])_* *_&nbsp;&nbsp;&nbsp;
    env.Tool('addLibrary', library=env\['fftwLibs'\])_*

 Navid also mentioned that ROOT libraries are setup similarly to how they are handled now with a standard set of RootLibs, and a set of GUI libs.

...