Skip to content

Commit

Permalink
Restoring compilation of ROOT runtime_cxxmodules
Browse files Browse the repository at this point in the history
  • Loading branch information
oshadura authored and vgvassilev committed Mar 21, 2018
1 parent 5b2a9ce commit a19b97d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
71 changes: 46 additions & 25 deletions root/tree/cloning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@ else()
set(ROOT_EVENT_DIR ${ROOT_SOURCE_DIR}/roottest/root/treeformula/event/)
endif()

# Generating dataset from roottest-treeformula-event-make test
# FIXME: it will be nice to move roottest-treeformula-event to CMake and add it as dependency
# To fix runtime_cxxmodules, we need to use already build artefacts.

if(TARGET onepcm)
set(EventDependencies "onepcm")
endif()

# Generating dataset from tree-treeformula-event test
# FIXME: it will be nice to move tree-treeformula-event to CMake and add it as dependency
ROOT_GENERATE_DICTIONARY(EventDict ${ROOT_EVENT_DIR}/Event.h
if(NOT TARGET eventexe)
ROOT_GENERATE_DICTIONARY(EventDict ${ROOT_EVENT_DIR}/Event.h
LINKDEF ${ROOT_EVENT_DIR}/EventLinkDef.h)

ROOT_LINKER_LIBRARY(EventTreeFormula TEST ${ROOT_EVENT_DIR}/Event.cxx EventDict.cxx
ROOT_LINKER_LIBRARY(EventTreeFormula TEST ${ROOT_EVENT_DIR}/Event.cxx EventDict.cxx
LIBRARIES Core Tree Hist MathCore)

ROOTTEST_GENERATE_EXECUTABLE(EventGenerate ${ROOT_EVENT_DIR}/MainEvent.cxx
ROOTTEST_GENERATE_EXECUTABLE(EventGenerate ${ROOT_EVENT_DIR}/MainEvent.cxx
LIBRARIES Core RIO Net Tree Hist MathCore EventTreeFormula)

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Event.root
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Event.root
COMMAND ./EventGenerate 6 0 0 1 30 > log
DEPENDS EventGenerate ${EventDependencies})
add_custom_target(event-generation ALL DEPENDS Event.root)

add_custom_command(
add_custom_target(event-generation ALL DEPENDS Event.root)

add_custom_command(
TARGET event-generation
COMMAND ${CMAKE_COMMAND} -E copy
Event.root
Expand All @@ -33,41 +37,58 @@ add_custom_command(
Event.root
event2.root)

set(RootExeOptions -e "gSystem->Load(\"libEventTreeFormula\")")

ROOTTEST_ADD_TEST(treeCloneTest
MACRO runEvent.C
PRECMD ${ROOT_root_CMD} -b -q -l ${CMAKE_CURRENT_SOURCE_DIR}/run.C
OUTREF references/treeCloneTest.ref)

else()
set(RootExeOptions -e "gSystem->Load(\"../test/libEvent\")")

ROOTTEST_ADD_TEST(treeCloneTest
PRECMD sh ${CMAKE_CURRENT_SOURCE_DIR}/generate-eventfile.sh ${ROOT_DIR}
COMMAND ${ROOT_root_CMD} -b -q -l ${CMAKE_CURRENT_SOURCE_DIR}/run.C -e "gSystem->Load(\"../test/libEvent\")"
POSTCMD ${ROOT_root_CMD} -b -q -l ${CMAKE_CURRENT_SOURCE_DIR}/runEvent.C -e "gSystem->Load(\"../test/libEvent\")"
OUTREF references/treeCloneTest.ref)

endif()

if(ROOTTEST_DIR)
set(ROOT_DIR ${ROOTSYS})
else()
set(ROOT_DIR ${ROOT_SOURCE_DIR})
endif()

add_custom_target(hsimple-file ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/hsimple.root)

if(TARGET hsimple)
set(HSimpleDependencies "hsimple")
add_dependencies(hsimple-file ${HSimpleDependencies})
endif()

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hsimple.root
if(NOT TARGET hsimple)
add_custom_target(hsimple-file ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/hsimple.root)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hsimple.root
COMMAND ${ROOT_root_CMD} -q -l -b ${ROOT_DIR}/tutorials/hsimple.C -e "{ TFile f(\"hsimple.root\"); TTree *ntuple; f.GetObject(\"ntuple\",ntuple); return ntuple ? 0 : 1; }" > hsimple.log
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${HSimpleDependencies}
VERBATIM)

add_custom_command(
add_custom_command(
TARGET hsimple-file
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/hsimple.root
hsimple1.root
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/hsimple.root
hsimple2.root)

set(RootExeOptions -e "gSystem->Load(\"libEventTreeFormula\")")

ROOTTEST_ADD_TEST(treeCloneTest
MACRO runEvent.C
PRECMD ${ROOT_root_CMD} -b -q -l ${CMAKE_CURRENT_SOURCE_DIR}/run.C
OUTREF references/treeCloneTest.ref)
else()
add_custom_target(hsimple-file ALL DEPENDS ${CMAKE_BINARY_DIR}/tutorials/hsimple.root)
set(HSimpleDependencies "hsimple")
add_dependencies(hsimple-file ${HSimpleDependencies})
add_custom_command(
TARGET hsimple-file
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/tutorials/hsimple.root
hsimple1.root
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/tutorials/hsimple.root
hsimple2.root)
endif()

ROOTTEST_ADD_TEST(runtreeCloneTest2
MACRO runtreeCloneTest2.C
Expand Down
7 changes: 7 additions & 0 deletions root/tree/cloning/generate-eventfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

ROOT_DIR=$1

${ROOT_DIR}/test/eventexe 6 0 0 1 30 > log
cp Event.root event1.root
cp Event.root event2.root

0 comments on commit a19b97d

Please sign in to comment.