A.6 On BuildFiles

Complete: 5
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

Reviewer/Editor and Date (copy from screen) Comments
JohnStupak - 21-September-2013 Review
ShahzadMuzaffar - 17 Nov 2009 Fixed some BuildFiles examples, added BuildFiles examples for shared libs and plugins
AnneHeavey - 13 Nov 2006 update after review and additional content by Shaun Ashby
AnneHeavey - 17 Feb 2006 new page from J. Mans and P. Dudero

Responsible: ShahzadMuzaffar
Last reviewed by: ShahzadMuzaffar - 17 Nov 2009

Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r16 - 2017-05-22 - ShahzadMalikMuzaffar


ESSENTIALS

ADVANCED TOPICS


 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback