Skip to content

Commit d0adb5a

Browse files
committed
Get rid of wrapper script for creating ROOT dictionaries
The sole need for the wrapper was to properly handle warnings and complain on missing options. Since long rootcling is now gracefully handling both, so we remove the wrapper.
1 parent 223b8d0 commit d0adb5a

4 files changed

Lines changed: 53 additions & 162 deletions

File tree

cmake/AddRootDictionary.cmake

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
include_guard()
1313

14-
configure_file(${CMAKE_CURRENT_LIST_DIR}/rootcling_wrapper.sh.in
15-
${CMAKE_BINARY_DIR}/rootcling_wrapper.sh @ONLY)
14+
set(O2_ROOT_DICTIONARY_APPEND_SCRIPT
15+
${CMAKE_CURRENT_LIST_DIR}/AppendToRootDictionary.cmake)
1616

1717
#
1818
# add_root_dictionary generates one dictionary to be added to a target.
@@ -132,25 +132,43 @@ function(add_root_dictionary target)
132132
set(includeDirs $<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>)
133133
set(includeDirs $<REMOVE_DUPLICATES:${includeDirs}>)
134134

135-
list(LENGTH A_EXTRA_PATCH hasExtraPatch)
135+
# the pcm dependencies (-m) are only meaningful where the modules are actually
136+
# loaded from disk, which is not the case on macOS
137+
set(pcmDeps $<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target},O2_PCM_DEPS>>)
138+
if(APPLE)
139+
set(pcmDeps)
140+
endif()
141+
142+
if(A_EXTRA_PATCH)
143+
set(extraPatchCommand
144+
COMMAND ${CMAKE_COMMAND}
145+
-DDICTIONARY=${dictionaryFile}
146+
-DPATCH=${CMAKE_CURRENT_LIST_DIR}/${A_EXTRA_PATCH}
147+
-P ${O2_ROOT_DICTIONARY_APPEND_SCRIPT})
148+
else()
149+
set(extraPatchCommand)
150+
endif()
151+
136152
# add a custom command to generate the dictionary using rootcling
137153
# cmake-format: off
138154
add_custom_command(
139155
OUTPUT ${dictionaryFile} ${pcmFile} ${rootmapFile}
140156
VERBATIM
157+
COMMAND_EXPAND_LISTS
141158
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>
159+
${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
160+
${ROOT_rootcling_CMD}
161+
-f ${dictionaryFile}
162+
-inlineInputHeader
163+
-noGlobalUsingStd
164+
-failOnWarnings
165+
-rmf ${rootmapFile}
166+
-rml $<TARGET_FILE_NAME:${target}>
167+
-I$<JOIN:${includeDirs},$<SEMICOLON>-I>
149168
$<$<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}"
169+
$<$<BOOL:${pcmDeps}>:-m$<SEMICOLON>$<JOIN:${pcmDeps},$<SEMICOLON>-m$<SEMICOLON>>>
170+
${headers}
171+
${extraPatchCommand}
154172
COMMAND
155173
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${pcmBase} ${pcmFile}
156174
DEPENDS ${headers} "$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target},O2_PCM_DEPS>>" ${A_EXTRA_PATCH})

cmake/AppendToRootDictionary.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
# All rights not expressly granted are reserved.
4+
#
5+
# This software is distributed under the terms of the GNU General Public
6+
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
#
8+
# In applying this license CERN does not waive the privileges and immunities
9+
# granted to it by virtue of its status as an Intergovernmental Organization
10+
# or submit itself to any jurisdiction.
11+
12+
# Appends PATCH to the end of DICTIONARY. Run with cmake -P, as CMake has no
13+
# `cmake -E` equivalent of `cat a >> b`.
14+
15+
if(NOT DICTIONARY OR NOT PATCH)
16+
message(FATAL_ERROR "Both DICTIONARY and PATCH must be given")
17+
endif()
18+
19+
file(READ ${PATCH} patchContent)
20+
file(APPEND ${DICTIONARY} "${patchContent}")

cmake/rootcling_wrapper.sh.in

Lines changed: 0 additions & 138 deletions
This file was deleted.

packaging/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,7 @@ install(EXPORT O2Targets
1717
FILE O2Targets.cmake)
1818

1919
install(FILES O2Config.cmake ../cmake/AddRootDictionary.cmake
20+
../cmake/AppendToRootDictionary.cmake
2021
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2)
2122

22-
install(FILES ../cmake/rootcling_wrapper.sh.in
23-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2
24-
PERMISSIONS OWNER_READ
25-
OWNER_WRITE
26-
OWNER_EXECUTE
27-
GROUP_READ
28-
GROUP_EXECUTE
29-
WORLD_READ
30-
WORLD_EXECUTE)
31-
3223
install(DIRECTORY ../dependencies/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2)

0 commit comments

Comments
 (0)