@@ -69,13 +69,58 @@ MACRO(GEN_ROOT_DICT_LINKDEF_HEADER _namespace)
6969 SET (_input_headers ${ARGN} )
7070 SET (_linkdef_header "${ROOT_DICT_OUTPUT_DIR} /${_namespace} _Linkdef.h" )
7171
72+ #message ( STATUS "${_input_headers}" )
73+
74+ ######### This code is used to identify and add std:: lists that use a struct to LinkDef
75+ file (STRINGS "${_input_headers} " lines)
76+ string (FIND "${lines} " "struct" FOUND_STRUCT )
77+ set ( _structName "NONE" )
78+ if ( FOUND_STRUCT GREATER 0 )
79+ string (SUBSTRING "${lines} " ${FOUND_STRUCT} 50 subline)
80+ string (FIND "${subline} " "{" FOUND_OPEN_BRACE )
81+ # It helps to filter some undesired occurences of struct. But it limits the size of the struct name
82+ if ( FOUND_OPEN_BRACE GREATER 0 AND FOUND_OPEN_BRACE LESS 30 )
83+ string ( SUBSTRING "${subline} " 7 ${FOUND_OPEN_BRACE} _structName)
84+ string ( FIND "${_structName} " " {" FOUND_OPEN_BRACE )
85+ string ( SUBSTRING "${_structName} " 0 ${FOUND_OPEN_BRACE} _structName)
86+ endif ( FOUND_OPEN_BRACE GREATER 0 AND FOUND_OPEN_BRACE LESS 30 )
87+ endif ( FOUND_STRUCT GREATER 0 )
88+
89+ set ( FOUND_STD_STRUCT "NO" )
90+ if ( NOT _structName MATCHES "NONE" )
91+ #message( STATUS "Found::${_structName}::" )
92+ while (lines)
93+ list (POP_FRONT lines LINE)
94+ # message( STATUS "This is line::${LINE}::" )
95+ string ( FIND "${LINE} " "${_structName} " FOUND_STRUCT_NAME )
96+ string ( FIND "${LINE} " "std::" FOUND_STD )
97+ if ( FOUND_STRUCT_NAME GREATER 0 AND FOUND_STD GREATER 0 )
98+ string ( SUBSTRING "${LINE} " ${FOUND_STD} -1 LINE)
99+ string ( FIND "${LINE} " ">" FOUND_END REVERSE )
100+ if ( FOUND_END GREATER 0 AND FOUND_END LESS 80 )
101+ MATH (EXPR FOUND_END "${FOUND_END} +1" )
102+ string ( SUBSTRING "${LINE} " 0 ${FOUND_END} LINE)
103+ message ( STATUS "Adding ${LINE} to the dictionary!" )
104+ set ( FOUND_STD_STRUCT "${LINE} " )
105+ endif ( FOUND_END GREATER 0 AND FOUND_END LESS 80 )
106+ endif ( FOUND_STRUCT_NAME GREATER 0 AND FOUND_STD GREATER 0 )
107+
108+ string (FIND LINE "${_structName} " FOUND_STRUCT_NAME )
109+ endwhile ()
110+ endif ( NOT _structName MATCHES "NONE" )
111+ ######### This code is used to identify and add std:: lists that use a struct to LinkDef
112+
72113 FOREACH (_header ${_input_headers} )
73- SET (${_namespace} _file_contents "${${_namespace} _file_contents}#ifdef __CINT__ " \n)
114+ SET (${_namespace} _file_contents "${${_namespace} _file_contents}#ifdef __ROOTCLING__ " \n)
74115 SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link off all globals\; " \n)
75116 SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link off all classes\; " \n)
76117 SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link off all functions\; " \n)
77118 SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link C++ nestedclasses\; " \n)
78- SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link C++ nestedclasses\; " \n)
119+ SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link C++ nestedtypedef\; " \n)
120+ if ( NOT FOUND_STD_STRUCT MATCHES "NO" )
121+ SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link C++ class ${_structName} +\; " \n)
122+ SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link C++ class ${FOUND_STD_STRUCT} +\; " \n)
123+ endif ( NOT FOUND_STD_STRUCT MATCHES "NO" )
79124 SET (${_namespace} _file_contents "${${_namespace} _file_contents}#pragma link C++ class ${_namespace} +\; " \n)
80125 SET (${_namespace} _file_contents "${${_namespace} _file_contents}#endif" \n)
81126 ENDFOREACH ()
0 commit comments