Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
rootcling-argparse.py
Go to the documentation of this file.
1 import argparse
2 import sys
3 
4 EPILOG = """
5 The options -p, -c, -l, -cint and -gccxml are deprecated and currently ignored.
6 
7 
8 
9 IMPORTANT:
10 1) LinkDef.h must be the last argument on the rootcling command line.
11 2) Note that the LinkDef file name must contain the string:
12  LinkDef.h, Linkdef.h or linkdef.h, i.e. NA49_LinkDef.h.
13 
14 Before specifying the first header file one can also add include
15 file directories to be searched and preprocessor defines, like:
16  -I$MYPROJECT/include -DDebug=1
17 
18 NOTA BENE: the dictionaries that will be used within the same project must
19 have unique names
20 
21 
22 
23 The (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 
46 This file tells rootcling which classes will be persisted on disk and what
47 entities will trigger automatic load of the shared library which contains
48 it. A trailing - in the class name tells rootcling to not generate the
49 Streamer() method. This is necessary for those classes that need a
50 customized Streamer() method. A trailing ! in the class name tells rootcling
51 to not generate the operator>>(TBuffer &b, MyClass *&obj) function. This is
52 necessary to be able to write pointers to objects of classes not inheriting
53 from TObject. See for an example the source of the TArrayF class.
54 If the class contains a ClassDef macro, a trailing + in the class
55 name tells rootcling to generate an automatic Streamer(), i.e. a
56 streamer that let ROOT do automatic schema evolution. Otherwise, a
57 trailing + in the class name tells rootcling to generate a ShowMember
58 function and a Shadow Class. The + option is mutually exclusive with
59 the - option. For legacy reasons it is not yet the default.
60 When the linkdef file is not specified a default version exporting
61 the classes with the names equal to the include files minus the .h
62 is generated.
63 
64 The default constructor used by the ROOT I/O can be customized by
65 using the rootcling pragma:
66  #pragma link C++ ioctortype UserClass;
67 For example, with this pragma and a class named MyClass,
68 this method will called the first of the following 3
69 constructors which exists and is public:
70  MyClass(UserClass*);
71  MyClass(TRootIOCtor*);
72  MyClass(); // Or a constructor with all its arguments defaulted.
73 
74 When more than one pragma ioctortype is used, the first seen has
75 priority. For example with:
76  #pragma link C++ ioctortype UserClass1;
77  #pragma link C++ ioctortype UserClass2;
78 
79 ROOT 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 """
85 def get_argparse():
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
98 The pcm file (module) produced by this invocation of rootcling
99 will not include any of the declarations already included in the
100 pcm files loaded via -m. There can be more than one -m
101 """)
102  parser.add_argument('-rmf', help="""Rootmap file name
103 Name of the rootmap file. In order to be picked up by ROOT it must
104 have .rootmap extension
105 """)
106  parser.add_argument('-rml', help="""Rootmap library name
107 Specify the name of the library which contains the autoload keys. This
108 switch can be specified multiple times to autoload several libraries in
109 presence of a particular key
110 """)
111  parser.add_argument('-split', help="""Split the dictionary
112 Split the dictionary in two, putting the ClassDef functions in a separate
113 file
114 """)
115  parser.add_argument('-s', help="""Target library name
116 The flag -s must be followed by the name of the library that will
117 contain the object file corresponding to the dictionary produced by
118 this invocation of rootcling.
119 The name takes priority over the one specified for the rootmapfile.
120 The 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
128 Needs the -s flag. See its documentation.
129 """)
130  parser.add_argument('-inlineInputHeader', help="""Add the argument header to the code of the dictionary
131 This 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
135 Instead, 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
138 specified for building this dictionary
139 """)
140  parser.add_argument('--lib-list-prefix', help="""Specify libraries needed by the header files parsed
141 This feature is used by ACliC (the automatic library generator).
142 Rootcling will read the content of xxx.in for a list of rootmap files (see
143 rlibmap). Rootcling will read these files and use them to deduce a list of
144 libraries that are needed to properly link and load this dictionary. This
145 list of libraries is saved in the first line of the file xxx.out; the
146 remaining lines contains the list of classes for which this run of
147 rootcling produced a dictionary
148 """)
149  return parser
150