CMT Patterns defined in GlastPolicy

Contents

Introduction
Global patterns defined in GlastPolicy
Local patterns defined in GlastPolicy

Introduction

The requirements of GlastPolicy consist of three groups of definitions: tags, macros and patterns. They are used together with the fragments to define the build options for libraries and applications and the run conditions. The tags and macros are specific to Glast s/w and easily understandable from the requirements file. Patterns are more complicated. The patterns of GlastPolicy are largely the same as those defined in GaudiPolicy. Some patterns are defined to be private, which means that the definitions are available only within the scope of the package, which applies the pattern. This helps reducing the number of environment variables, and keeps paths shorter. Some patterns are for use within GlastPolicy. Typically they define package related names, which are then used by another pattern in GlastPolicy. The descriptions per pattern provide a list of these clients.

The examples use Gaudi packages; they show first the CMT statement from the requirements file, followed by the resulting CMT commands. For some patterns two steps of resolving are shown. CMT macros are resolved when building the Makefile or when using the command "cmt show macro .."; their resolved values are not shown in the examples. To check the patterns, macros or sets, use the "cmt show .." commands, for example

cmt show patterns   |  grep <package_name>
cmt show pattern  <pattern_name>
grep -H */*/cmt/requirements <pattern_name>     (issued e.g. from the top directory of Glast release)

cmt show macro_value <macro_name>   -tag=<tag>
eval make 'cmt show macros'   (on Linux only, creates file with macro values)
The patterns have local or global scope:
global patterns
are applied by default to all packages, which use the package defining the pattern (GlastPolicy).
If a global pattern should not be applied in a package : ignore_pattern <pattern_name>

local patterns
are applied on request : apply_pattern <pattern_name>
Not all patterns are used by the GLAST s/w; they may be removed in future.
Back to Top

Global patterns defined in GlastPolicy

include_none
removes automatic inclusion of ../src in the include search path; no -I compiler option will be generated. Specify your search path with pattern package_include or  include_dirs instead.

packageDir
builds the macro which points to the binary directory of the package
ex:  GaudiAlgDir = $GAUDIALGROOT/$BINDIR
Back to Top

Local patterns defined in GlastPolicy

Patterns which handle LD_LIBRARY_PATH and SoftLinks

package_libraries
builds softLinks to used package libraries (on Unix); library names are <package>, <package>Lib and <package>Dict
clients: (linker_path, now removed)

pattern ld_library_path
cleans up LD_LIBRARY_PATH and appends the package library path; for WIN32 only PATH is cleaned up and the search path for the library appended
clients: shared_library
ex (GaudiTools): apply_pattern   ld_library_path
Resolved:
path_remove LD_LIBRARY_PATH   "/GaudiTools/ "
path_append LD_LIBRARY_PATH     "$GAUDITOOLSROOT/$BINDIR"
WIN32 only:
path_remove PATH   "\GaudiTools\ "
path_append PATH     "$GAUDITOOLSROOT\$BINDIR"
Back to Top

Patterns which require the library name as argument
apply_pattern  <pattern>  library=<library>

libraryShr
sets an environment variable for name and path of a component library
clients: component_library, packageShr

library_stamps
builds the macro which points to the library time stamp
(see GlastPolicy mainpage for discussion of stamps)
clients: package_stamps, package_Lstamps, linker_library, shared_library

library_shlibflags
builds the macro which is used in building a linker shareable image
clients: package_Lshlibflags, shared_library

library_Clinkopts
extends the link options for a component library; can be used to force (-u) linking of imported libraries
clients: component_library, package_Clinkopts
ex: apply_pattern  library_Clinkopts  library=GaudiSvc   import HTL
Resolved:
macro prepend GaudiSvc_linkopts " "
Unix&static "$GaudiSvcDir/libGaudiSvc.a   -u   GaudiSvc_loadRef   $HTL_linkopts "

library_Cshlibflags
(private) redefines locally the macro <library>_shlibflags, which defines the flags used to build a component shareable image and adds the link options of the used packages
clients: component_library, package_Cshlibflags
ex (GaudiPython) : apply_pattern library_Cshlibflags library="Test"
Resolved:
private
macro Test_shlibflags " $componentshr_linkopts   $Testlinkopts   $GaudiPython_linkopts   $use_linkopts "
public

library_Llinkopts
extends the link options of a linker library to include the search path for the package libraries and the named library
clients: linker_library, package_linkopts, package_Llinkopts, shared_library

library_Lshlibflags
(private) redefines locally the macro <library>_shlibflags for shareable libraries and adds the link options of the used packages
clients: linker_library, package_shlibflags

library_Softlinks
builds the macro to be used for creating the soft link
clients: library_path, package_libraries

library_path
cleans up and sets LD_LIBRARY_PATH, prepares the softlink for <library>
clients: linker_library

component_library
builds a component library, which is a shared library using the Gaudi DLL construct.
ex: apply_pattern component_library library=GaudiGSL
Resolved:
apply_pattern libraryShr library=GaudiGSL
apply_pattern library_Clinkopts library=GaudiGSL
apply_pattern library_Cshlibflags library=GaudiGSL

linker_library
builds the link options, library search path (-L) and library (-l); cleans up  LD_LIBRARY_PATH, and builds time stamp and softlink(s)
Back to Top

Patterns using the package name as library name
apply_pattern     <pattern>

Patterns building one linker library

package_stamps
builds the macro which points to the library time stamp
ex (GaudiTools): apply_pattern package_stamps
Resolved:
apply_pattern library_stamps   library=GaudiTools
macro GaudiTools_stamps "$GAUDITOOLSROOT/$BINDIR/GaudiTools.stamp"

package_linkopts
builds the macro which defines the link options for a dynamic library, library search path (-L) and library (-l) or the unique path to the library
ex (GaudiTools): apply_pattern package_linkopts
Resolved:
apply_pattern library_Llinkopts library=GaudiTools
macro append GaudiTools_linkopts     "-L$GaudiToolsDir   -lGaudiTools"
  WIN32     "$GaudiToolsDir/GaudiTools.lib"
  Unix&static   "$GaudiToolsDir/libGaudiTools.a"

package_shlibflags
(private) locally modifies the macro, which defines the flags used to build a shareable image, including the link options of the used packages 
ex (GaudiTools): apply_pattern package_shlibflags
Resolved [1]:
apply_pattern library_Lshlibflags  library=GaudiTools
Resolved [2]:
private
macro_append   Gauditools_shlibflags   "$libraryshr_linkopts   $use_linkopts"
macro_remove  use_linkopts  "$GaudiTools_linkopts"
public
Back to Top

Patterns building one component library

packageShr
sets an environment variable used by Gaudi to access the component library
ex (GaudiSvc): apply_pattern packageShr
Resolved:
apply_pattern libraryShr   library=GaudiSvc
set GaudiSvcShr   " $GaudiSvcDir/libGaudiSvc"
WIN32   "$GaudiSvcDir/GaudiSvc"

package_Clinkopts
sets the link options for the component library, including the link options for possibly imported  packages
ex (GaudiAlg): apply_pattern package_Clinkopts
Resolved [1]:
apply_pattern library_Clinkopts library=GaudiAlg
Resolved [2]:
macro_prepend GaudiAlg_linkopts " "
Unix&static   "$GaudiAlgDir/libGaudiAlg.a  -u GaudiAlg_loadRef $_linkopts

package_Cshlibflags
(private) builds locally the macro, which defines the flags used to build a component shareable image, includes the link options for the used packages
ex (GaudiAlg): apply_pattern package_Cshlibflags
Resolved [1]:
apply-pattern library_Cshlibflags library=GaudiAlg
Resolved [2]:
private
macro GaudiAlg_shlibflags "$componentshr_linkopts $GaudiAlglinkopts $GaudiAlg_linkopts $use_linkopts"
public
Back to Top

Patterns building one component and one linker library per package

package_Lstamps
builds the macro which points to the linker library time stamp

package_Llinkopts
builds the link options of a linker library in a package, which builds a component and a linker library.
In this case the name of the linker library is   <package>Lib
ex (GaudiAlg): apply_pattern package_Llinkopts
Resolved [1]:
apply_pattern library_Llinkopts   library=GaudiAlgLib
Resolved [2]:
macro_append   GaudiAlgLib_linkopts   "-L$GaudiAlgDir -l GaudiAlgLib "
WIN32   "$GaudiAlgDir/$GaudiAlgLib.lib "
Unix&static   "$GaudiAlgDir/libGaudiAlgLib.a "

package_Lshlibflags
builds the macro which defines the flags used to build a linker shareable image
ex (GaudiDb): apply_pattern   package_Lshlibflags
Resolved [1]:
apply_pattern  library_shlibflags  library=GaudiDbLib
Resolved [2]:
macro  GaudiDbLib_shlibflags  $libraryshr_linkopts
Back to Top

Pattern building a non-Gaudi shared library

shared_library
defines the package root as search path, builds the link options of a shared library, including  linker search path (-L) and library (-l), updates the LD_LIBRARY_PATH and provides the time stamp. This pattern should be applied in GLAST packages, which build shared libraries without using the Gaudi DLL construct. The library name is <package>.
ex (xml): apply_pattern shared_library
Back to Top

Pattern building a static library

package_Slinkopts
builds the link options of a static library (not used in Gaudi)
Back to Top

Glast-specific patterns

package_include
defines the package root <package>/<version> as include search path
clients: shared_library

package_headers
(WIN32 only) defines the macro for the includes of header files as   ..\<package> and   ..\cmt

package_xmlfiles
(WIN32 only) defines the macro for the location of the xml data files

Back to Top

GLAST main and test programs

The macros GlastMain and TestGlastMain define the location of Glast default main programs (see mainpage.h)

userjobopts
sets the environment variable JOBOPTIONS to the default value ../src/joboptions.txt

package_test
defines the test application, test job options and run command

dummy_test
defines an empty test for packages with nothing to test

Back to Top

Revised: 08/14/03
e-mail: Traudl Kozanecki