Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rootcling-argparse.py
Go to the documentation of this file.
1import argparse
2import sys
3
4EPILOG = """
5The options -p, -c, -l, -cint and -gccxml are deprecated and currently ignored.
6
7
8
9IMPORTANT:
101) LinkDef.h must be the last argument on the rootcling command line.
112) Note that the LinkDef file name must contain the string:
12 LinkDef.h, Linkdef.h or linkdef.h, i.e. NA49_LinkDef.h.
13
14Before specifying the first header file one can also add include
15file directories to be searched and preprocessor defines, like:
16 -I$MYPROJECT/include -DDebug=1
17
18NOTA BENE: the dictionaries that will be used within the same project must
19have unique names
20
21
22
23The (optional) file LinkDef.h looks like:
24
25#ifdef __CLING__
26
27#pragma link off all globals;
28#pragma link off all classes;
29#pragma link off all functions;
30
31#pragma link C++ class TAxis;
32#pragma link C++ class TAttAxis-;
33#pragma link C++ class TArrayC-!;
34#pragma link C++ class AliEvent+;
35
36#pragma link C++ function StrDup;
37#pragma link C++ function operator+(const TString&,const TString&);
38
39#pragma link C++ global gROOT;
40#pragma link C++ global gEnv;
41
42#pragma link C++ enum EMessageTypes;
43
44#endif
45
46This file tells rootcling which classes will be persisted on disk and what
47entities will trigger automatic load of the shared library which contains
48it. A trailing - in the class name tells rootcling to not generate the
49Streamer() method. This is necessary for those classes that need a
50customized Streamer() method. A trailing ! in the class name tells rootcling
51to not generate the operator>>(TBuffer &b, MyClass *&obj) function. This is
52necessary to be able to write pointers to objects of classes not inheriting
53from TObject. See for an example the source of the TArrayF class.
54If the class contains a ClassDef macro, a trailing + in the class
55name tells rootcling to generate an automatic Streamer(), i.e. a
56streamer that let ROOT do automatic schema evolution. Otherwise, a
57trailing + in the class name tells rootcling to generate a ShowMember
58function and a Shadow Class. The + option is mutually exclusive with
59the - option. For legacy reasons it is not yet the default.
60When the linkdef file is not specified a default version exporting
61the classes with the names equal to the include files minus the .h
62is generated.
63
64The default constructor used by the ROOT I/O can be customized by
65using the rootcling pragma:
66 #pragma link C++ ioctortype UserClass;
67For example, with this pragma and a class named MyClass,
68this method will called the first of the following 3
69constructors which exists and is public:
70 MyClass(UserClass*);
71 MyClass(TRootIOCtor*);
72 MyClass(); // Or a constructor with all its arguments defaulted.
73
74When more than one pragma ioctortype is used, the first seen has
75priority. For example with:
76 #pragma link C++ ioctortype UserClass1;
77 #pragma link C++ ioctortype UserClass2;
78
79ROOT considers the constructors in this order:
80 MyClass(UserClass1*);
81 MyClass(UserClass2*);
82 MyClass(TRootIOCtor*);
83 MyClass(); // Or a constructor with all its arguments defaulted.
84"""
86 parser = argparse.ArgumentParser(add_help=False, prog='rootcling',
87 description = 'This program generates the dictionaries needed for performing I/O of classes.',
88 epilog = EPILOG
89)
90 parser.add_argument('-f', help='Overwrite an existing output file\nThe output file must have the .cxx, .C, .cpp, .cc or .cp extension.\n')
91 parser.add_argument('-v', help='Display all messages')
92 parser.add_argument('-v0', help='Display no messages at all')
93 parser.add_argument('-v1', help='Display only error messages')
94 parser.add_argument('-v2', help='Display error and warning messages (default).')
95 parser.add_argument('-v3', help='Display error, warning and note messages')
96 parser.add_argument('-v4', help='Display all messages\n')
97 parser.add_argument('-m', help="""Specify absolute or relative path Clang pcm file to be loaded
98The pcm file (module) produced by this invocation of rootcling
99will not include any of the declarations already included in the
100pcm files loaded via -m. There can be more than one -m
101""")
102 parser.add_argument('-rmf', help="""Rootmap file name
103Name of the rootmap file. In order to be picked up by ROOT it must
104have .rootmap extension
105""")
106 parser.add_argument('-rml', help="""Rootmap library name
107Specify the name of the library which contains the autoload keys. This
108switch can be specified multiple times to autoload several libraries in
109presence of a particular key
110""")
111 parser.add_argument('-split', help="""Split the dictionary
112Split the dictionary in two, putting the ClassDef functions in a separate
113file
114""")
115 parser.add_argument('-s', help="""Target library name
116The flag -s must be followed by the name of the library that will
117contain the object file corresponding to the dictionary produced by
118this invocation of rootcling.
119The name takes priority over the one specified for the rootmapfile.
120The name influences the name of the created pcm:
121 1) If it is not specified, the pcm is called libINPUTHEADER_rdict.pcm
122 2) If it is specified, the pcm is called libTARGETLIBRARY_rdict.pcm
123 Any "liblib" occurence is transformed in the expected "lib"
124 3) If this is specified in conjunction with --multiDict, the output is
125 libTARGETLIBRARY_DICTIONARY_rdict.pcm
126""")
127 parser.add_argument('-multiDict', help="""Enable support for multiple pcms in one library
128Needs the -s flag. See its documentation.
129""")
130 parser.add_argument('-inlineInputHeader', help="""Add the argument header to the code of the dictionary
131This allows the header to be inlined within the dictionary
132""")
133 parser.add_argument('-interpreteronly', help='No IO information in the dictionary\n')
134 parser.add_argument('-noIncludePaths', help="""Do not store the headers' directories in the dictionary
135Instead, rely on the environment variable $ROOT_INCLUDE_PATH at runtime
136""")
137 parser.add_argument('-excludePath', help="""Specify a path to be excluded from the include paths
138specified for building this dictionary
139""")
140 parser.add_argument('--lib-list-prefix', help="""Specify libraries needed by the header files parsed
141This feature is used by ACliC (the automatic library generator).
142Rootcling will read the content of xxx.in for a list of rootmap files (see
143rlibmap). Rootcling will read these files and use them to deduce a list of
144libraries that are needed to properly link and load this dictionary. This
145list of libraries is saved in the first line of the file xxx.out; the
146remaining lines contains the list of classes for which this run of
147rootcling produced a dictionary
148""")
149 return parser
150