|
5 | 5 | # if dictionary is a TARGET (e.g., created with add_library), we inherit the INCLUDE_DIRECTORES and |
6 | 6 | # COMPILE_DEFINITIONS properties |
7 | 7 | # |
8 | | -# This is a copy from REFLEX_GENERATE_DICTIONARY from the RootMacros in Root v6.22 |
9 | | -# Copied here to allow creating dictionaries based on target properties |
10 | | -#--------------------------------------------------------------------------------------------------- |
| 8 | +# This is effectively a wrapper around REFLEX_GENERATE_DICTIONARY from the RootMacros. |
| 9 | +# |
| 10 | +# Originally this was a re-implementation / backporting of that to deal with |
| 11 | +# oler ROOT versions, but since we now depend on a newer ROOT version in any |
| 12 | +# case we keep this to not break the CMake API of podio. |
| 13 | +# --------------------------------------------------------------------------------------------------- |
11 | 14 | function(PODIO_GENERATE_DICTIONARY dictionary) |
12 | | - CMAKE_PARSE_ARGUMENTS(ARG "" "SELECTION" "OPTIONS;DEPENDS" ${ARGN}) |
13 | | - #---Get List of header files--------------- |
14 | | - set(headerfiles) |
15 | | - foreach(fp ${ARG_UNPARSED_ARGUMENTS}) |
16 | | - file(GLOB files inc/${fp}) |
17 | | - if(files) |
18 | | - foreach(f ${files}) |
19 | | - if(NOT f MATCHES LinkDef) |
20 | | - set(headerfiles ${headerfiles} ${f}) |
21 | | - endif() |
22 | | - endforeach() |
23 | | - elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${fp}) |
24 | | - set(headerfiles ${headerfiles} ${CMAKE_CURRENT_SOURCE_DIR}/${fp}) |
25 | | - else() |
26 | | - set(headerfiles ${headerfiles} ${fp}) |
27 | | - endif() |
28 | | - endforeach() |
29 | | - #---Get Selection file------------------------------------ |
30 | | - if(IS_ABSOLUTE ${ARG_SELECTION}) |
31 | | - set(selectionfile ${ARG_SELECTION}) |
32 | | - else() |
33 | | - set(selectionfile ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SELECTION}) |
34 | | - endif() |
35 | | - |
36 | | - set(gensrcdict ${dictionary}.cxx) |
| 15 | + REFLEX_GENERATE_DICTIONARY(${ARGV}) |
37 | 16 |
|
38 | | - #---roottest compability--------------------------------- |
39 | | - if(CMAKE_ROOTTEST_NOROOTMAP) |
40 | | - set(rootmapname ) |
41 | | - set(rootmapopts ) |
42 | | - elseif(DEFINED CMAKE_ROOTTEST_NOROOTMAP) # Follow the roottest dictionary library naming |
43 | | - set(rootmapname ${dictionary}.rootmap) |
44 | | - set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}_dictrflx) |
45 | | - else() |
46 | | - set(rootmapname ${dictionary}Dict.rootmap) |
47 | | - set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict) |
48 | | - endif() |
49 | | - |
50 | | - set(include_dirs ${CMAKE_CURRENT_SOURCE_DIR}) |
51 | | - get_directory_property(incdirs INCLUDE_DIRECTORIES) |
52 | | - foreach(d ${incdirs}) |
53 | | - if(NOT "${d}" MATCHES "^(AFTER|BEFORE|INTERFACE|PRIVATE|PUBLIC|SYSTEM)$") |
54 | | - list(APPEND include_dirs ${d}) |
55 | | - endif() |
56 | | - endforeach() |
57 | | - |
58 | | - get_directory_property(defs COMPILE_DEFINITIONS) |
59 | | - foreach( d ${defs}) |
60 | | - list(APPEND definitions ${d}) |
61 | | - endforeach() |
62 | | - |
63 | | - IF(TARGET ${dictionary}) |
64 | | - LIST(APPEND include_dirs $<TARGET_PROPERTY:${dictionary},INCLUDE_DIRECTORIES>) |
65 | | - LIST(APPEND definitions $<TARGET_PROPERTY:${dictionary},COMPILE_DEFINITIONS>) |
66 | | - ENDIF() |
67 | | - |
68 | | - add_custom_command( |
69 | | - OUTPUT ${gensrcdict} ${rootmapname} |
70 | | - COMMAND ${ROOT_genreflex_CMD} |
71 | | - ARGS ${headerfiles} -o ${gensrcdict} ${rootmapopts} --select=${selectionfile} |
72 | | - --gccxmlpath=${GCCXML_home}/bin ${ARG_OPTIONS} |
73 | | - "-I$<JOIN:${include_dirs},;-I>" |
74 | | - "$<$<BOOL:$<JOIN:${definitions},>>:-D$<JOIN:${definitions},;-D>>" |
75 | | - DEPENDS ${headerfiles} ${selectionfile} ${ARG_DEPENDS} |
76 | | - |
77 | | - COMMAND_EXPAND_LISTS |
78 | | - ) |
79 | | - IF(TARGET ${dictionary}) |
80 | | - target_sources(${dictionary} PRIVATE ${gensrcdict}) |
81 | | - ENDIF() |
82 | | - set(gensrcdict ${dictionary}.cxx PARENT_SCOPE) |
| 17 | + # Dictionary payloads become very large for our generated EDMs, so we |
| 18 | + # explicitly silence this warning here. |
83 | 19 | set_source_files_properties(${gensrcdict} |
84 | 20 | PROPERTIES |
85 | 21 | GENERATED TRUE |
86 | 22 | COMPILE_FLAGS "-Wno-overlength-strings" |
87 | | - ) |
88 | | - |
89 | | - #---roottest compability--------------------------------- |
90 | | - if(CMAKE_ROOTTEST_DICT) |
91 | | - ROOTTEST_TARGETNAME_FROM_FILE(targetname ${dictionary}) |
92 | | - |
93 | | - set(targetname "${targetname}-dictgen") |
94 | | - |
95 | | - add_custom_target(${targetname} DEPENDS ${gensrcdict} ${ROOT_LIBRARIES}) |
96 | | - else() |
97 | | - set(targetname "${dictionary}-dictgen") |
98 | | - # Creating this target at ALL level enables the possibility to generate dictionaries (genreflex step) |
99 | | - # well before the dependent libraries of the dictionary are build |
100 | | - add_custom_target(${targetname} ALL DEPENDS ${gensrcdict}) |
101 | | - endif() |
| 23 | + ) |
102 | 24 |
|
103 | 25 | # We are not going to be able to fix these in any case, so disable clang-tidy |
104 | 26 | # for the generated dictionaries |
|
0 commit comments