|
11 | 11 |
|
12 | 12 | include_guard() |
13 | 13 |
|
14 | | -configure_file(${CMAKE_CURRENT_LIST_DIR}/rootcling_wrapper.sh.in |
15 | | - ${CMAKE_BINARY_DIR}/rootcling_wrapper.sh @ONLY) |
| 14 | +set(O2_RUN_ROOTCLING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/RunRootcling.cmake) |
16 | 15 |
|
17 | 16 | # |
18 | 17 | # add_root_dictionary generates one dictionary to be added to a target. |
@@ -132,25 +131,37 @@ function(add_root_dictionary target) |
132 | 131 | set(includeDirs $<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>) |
133 | 132 | set(includeDirs $<REMOVE_DUPLICATES:${includeDirs}>) |
134 | 133 |
|
135 | | - list(LENGTH A_EXTRA_PATCH hasExtraPatch) |
136 | | - # add a custom command to generate the dictionary using rootcling |
| 134 | + # the pcm dependencies (-m) are only meaningful where the modules are actually |
| 135 | + # loaded from disk, which is not the case on macOS |
| 136 | + set(pcmDeps $<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target},O2_PCM_DEPS>>) |
| 137 | + if(APPLE) |
| 138 | + set(pcmDeps) |
| 139 | + endif() |
| 140 | + |
| 141 | + if(A_EXTRA_PATCH) |
| 142 | + set(extraPatch -DPATCH=${CMAKE_CURRENT_LIST_DIR}/${A_EXTRA_PATCH}) |
| 143 | + else() |
| 144 | + set(extraPatch) |
| 145 | + endif() |
| 146 | + |
| 147 | + # the arguments are joined with | so that they reach the script as a single |
| 148 | + # argument, see RunRootcling.cmake |
137 | 149 | # cmake-format: off |
| 150 | + set(rootclingArgs |
| 151 | + -f|${dictionaryFile}|-inlineInputHeader|-noGlobalUsingStd|-rmf|${rootmapFile}|-rml|$<TARGET_FILE_NAME:${target}>|-I$<JOIN:${includeDirs},|-I>$<$<BOOL:${prop}>:|-D$<JOIN:${prop},|-D>>$<$<BOOL:${pcmDeps}>:|-m|$<JOIN:${pcmDeps},|-m|>>|$<JOIN:${headers},|>) |
| 152 | + |
| 153 | + # add a custom command to generate the dictionary using rootcling |
138 | 154 | add_custom_command( |
139 | 155 | OUTPUT ${dictionaryFile} ${pcmFile} ${rootmapFile} |
140 | 156 | VERBATIM |
141 | 157 | COMMAND |
142 | | - ${CMAKE_BINARY_DIR}/rootcling_wrapper.sh |
143 | | - --rootmap_file ${rootmapFile} |
144 | | - --dictionary_file ${dictionaryFile} |
145 | | - --ld_library_path ${LD_LIBRARY_PATH} |
146 | | - --rootmap_library_name $<TARGET_FILE_NAME:${target}> |
147 | | - --include_dirs -I$<JOIN:${includeDirs},$<SEMICOLON>-I> |
148 | | - $<$<BOOL:${prop}>:--compile_defs> |
149 | | - $<$<BOOL:${prop}>:-D$<JOIN:${prop},$<SEMICOLON>-D>> |
150 | | - $<$<BOOL:${hasExtraPatch}>:--extra-patch> |
151 | | - $<$<BOOL:${hasExtraPatch}>:${CMAKE_CURRENT_LIST_DIR}/${A_EXTRA_PATCH}> |
152 | | - --pcmdeps "$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target},O2_PCM_DEPS>>" |
153 | | - --headers "${headers}" |
| 158 | + ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} |
| 159 | + ${CMAKE_COMMAND} |
| 160 | + -DROOTCLING=${ROOT_rootcling_CMD} |
| 161 | + -DDICTIONARY=${dictionaryFile} |
| 162 | + ${extraPatch} |
| 163 | + "-DARGS=${rootclingArgs}" |
| 164 | + -P ${O2_RUN_ROOTCLING_SCRIPT} |
154 | 165 | COMMAND |
155 | 166 | ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${pcmBase} ${pcmFile} |
156 | 167 | DEPENDS ${headers} "$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target},O2_PCM_DEPS>>" ${A_EXTRA_PATCH}) |
|
0 commit comments