A.6 On BuildFiles
Complete:
Detailed Review status
Package BuildFiles
SCRAM uses a file called CMS.BuildFile in each package directory which describes what the package will produce and what dependencies the package has. Consider the following CMS.BuildFile from the tutorial:
<use name="root"/>
<use name="DataFormats/HcalRecHit"/>
<use name="TBDataFormats/HcalTBObjects"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<flags EDM_PLUGIN="1"/>
The first part of the CMS.BuildFile tells SCRAM what packages or external libraries (e.g., ROOT) are needed to build this package. The
<flags>
line is needed because this package contains a framework module (in this case, your analyzer) which must be registered with the plugin system .
Other BuildFiles
Here we give some examples of CMS.BuildFile snippets for test executables, test libraries and normal (application) executables.
Public shared libraries
In the
MySubsystem/MyPackage/CMS.BuildFile
, defines shared libraries which others CMSSW packages can link using
<use name="MySubsystem/MyPackage"/>
in their BuildFiles. The convention for library names in CMSSW is
SubsystemPackage
, where the directory containing the BuildFile is
Subsystem/Package
. Those familiar with ORCA might be used to libraries named after only the Package, but this change was made to simplify code management in CMSSW.
<use name="root"/>
<use name="DataFormats/HcalRecHit"/>
<use name="TBDataFormats/HcalTBObjects"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<export>
<lib name="1"/>
</export>
EDM Plugins
In the
plugins
directory of a package, define
EDM plugins using
library
tags. More than one plugins can be defined. If they share dependencies, a common dependencies block can be used. If there are dependencies which are unique to one plugin, they should be placed inside the
library
tags:
<use name="tool1"/>
<use name="Subsystem/Package1"/>
<library name="myplugin1" file="plugin1.cc">
</library>
<library name="myplugin2" file="plugin2.cc">
<use name="tool3"/>
</library>
Test executables
In the
test/CMS.BuildFile
directory of a package, define a binary executable using "bin" tags.
<use name="tool1"/>
<use name="Subsystem/package1"/>
<bin name="mytest1" file="main.cpp"/>
</bin>
<bin name="mytest2" file="main.cpp">
<use name="tool3"/>
</bin>
Note that the same treatment of dependencies follows as described above in plugins.
Binary executables for real applications
Binary executables which are real applications should be executable from the command-line, i.e. they will be found in the user PATH after scram runtime is set. These executables are defined in a CMS.BuildFile in a
bin
directory in a package (i.e.
package/bin/CMS.BuildFile
). For example:
<bin name="myApp1" file="main.cpp">
<use name="tool1"/>
<use name="Subsystem/package1"/>
</bin>
Note that the same treatment of dependencies follows as described above in test.
Building binary and test executables from more than one source file
This might come up when linking a main() against a private class. Assume that the class is called
XYZ
, is declared in
XYZ.h
, and
XYZ.cc
contains the implementation:
<bin name="myPrivateApp1" file="main.cpp,XYZ.cc">
<use name="tool1"/>
<use name="Subsystem/package1"/>
<use name="Subsystem/package2"/>
</bin>
For more detail on SCRAM Buildfiles please read
SWGuideBuildFile
Review status
Responsible: ShahzadMuzaffar
Last reviewed by:
ShahzadMuzaffar - 17 Nov 2009