Skip to content

Commit 7588a8a

Browse files
committed
[cxxmodules] Also preload TMVA/TreePlayer/Graf
ROOT can't autoparse classes inside namespaces with the rootmap system (as the loading callbacks don't correctly land where they are supposed to land with our injected namespaces). As this turns out to be a feature of some kind, let's preload TMVA/TreePlayer/Graf to fix all failing tests that are related to this feature/bug with modules enabled. This commit can be dropped if we solve on of those problems: 1. figure out how to fix this bug in the rootmap-based loading without regressin in performance. 2. replace the rootmap system with something else like attaching all C++ modules on startup. Note that we already do something like this in normal ROOT by including these packages into the PCH which also makes those decls available in the normal clang lookup.
1 parent 5b3c6d5 commit 7588a8a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,11 @@ endif()
343343

344344
if(runtime_cxxmodules)
345345
# Dummy target that does nothing, we don't need a PCH for modules.
346-
add_custom_target(onepcm)
346+
# However, we require that TMVA/Graf/Treeplayer are built here as
347+
# we will always load them to workaround the fact that we can't
348+
# load the decls in them via rootmap files (as they are inside
349+
# namespaces which isn't supported).
350+
add_custom_target(onepcm DEPENDS TreePlayer TMVA Graf)
347351
else()
348352
add_custom_command(OUTPUT etc/allDict.cxx.pch
349353
COMMAND ${CMAKE_COMMAND} -E env ROOTIGNOREPREFIX=1 ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch ${__allIncludes} -I${CMAKE_BINARY_DIR}/include

core/metacling/src/TCling.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,9 @@ TCling::~TCling()
13721372
void TCling::Initialize()
13731373
{
13741374
fClingCallbacks->Initialize();
1375+
// Load modules that we can't automatically load via rootmap files as they
1376+
// contain decls in namespaces which aren't supported.
1377+
LoadModules({"TMVA", "TreePlayer", "Graf"}, fInterpreter);
13751378
}
13761379

13771380
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)