Skip to content

[roottest] improve ntuple cmake #19582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion roottest/root/ntuple/.rootrc

This file was deleted.

11 changes: 1 addition & 10 deletions roottest/root/ntuple/makeproject/rntuple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if(NOT ROOT_root7_FOUND)
return()
endif()

# Generate common dictionary for custom class
ROOTTEST_GENERATE_DICTIONARY(
rntuple_event_dict
Expand All @@ -15,16 +11,11 @@ ROOTTEST_GENERATE_DICTIONARY(
# Write the RNTuple with the custom class field
ROOTTEST_GENERATE_EXECUTABLE(
write_rntuple
write_rntuple.cxx rntuple_event_dict.cxx
LIBRARIES Core RIO ROOTNTuple
FIXTURES_REQUIRED generated_event_dictionary_rntuple
FIXTURES_SETUP write_rntuple_executable)

# Specify more than one input source for the generated executable
target_sources(
write_rntuple
PRIVATE write_rntuple.cxx rntuple_event_dict.cxx
)

ROOTTEST_ADD_TEST(write_rntuple
EXEC ./write_rntuple
FIXTURES_REQUIRED write_rntuple_executable
Expand Down
18 changes: 7 additions & 11 deletions roottest/root/ntuple/makeproject/ttree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ ROOTTEST_GENERATE_DICTIONARY(
# Write the TTree with the custom class branch
ROOTTEST_GENERATE_EXECUTABLE(
write_ttree
write_ttree.cxx ttree_event_dict.cxx
LIBRARIES Core RIO Tree
FIXTURES_REQUIRED generated_event_dictionary_ttree
FIXTURES_SETUP write_ttree_executable)

# Specify more than one input source for the generated executable
target_sources(
write_ttree
PRIVATE write_ttree.cxx ttree_event_dict.cxx
)
ROOTTEST_ADD_TEST(write_ttree
EXEC ./write_ttree
FIXTURES_REQUIRED write_ttree_executable
FIXTURES_SETUP written_ttree)
FIXTURES_SETUP makeproject_written_ttree)

# Call MakeProject on the output file
ROOTTEST_GENERATE_EXECUTABLE(
Expand All @@ -35,7 +31,7 @@ ROOTTEST_GENERATE_EXECUTABLE(

ROOTTEST_ADD_TEST(makeproject_ttree
EXEC ./makeproject_ttree
FIXTURES_REQUIRED "written_ttree;makeproject_ttree"
FIXTURES_REQUIRED makeproject_written_ttree makeproject_ttree
FIXTURES_SETUP makeproject_ttree_called)

# Read back the class instance thanks to the shared library generated by MakeProject.
Expand All @@ -51,7 +47,7 @@ ROOTTEST_GENERATE_EXECUTABLE(
read_ttree.cxx
LIBRARIES ${ROOT_LIBRARIES} GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ${TTREESTLTESTLIB}
FIXTURES_REQUIRED makeproject_ttree_called
FIXTURES_SETUP read_ttree_executable
FIXTURES_SETUP makeproject_read_ttree_executable
)
target_include_directories(read_ttree PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_directories(read_ttree PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/libttreestltest)
Expand All @@ -67,7 +63,7 @@ set(_roottest_env_librarypath ${ROOTTEST_ENV_LIBRARYPATH})
set(ROOTTEST_ENV_LIBRARYPATH "${ROOTTEST_ENV_LIBRARYPATH}:${CMAKE_CURRENT_BINARY_DIR}/libttreestltest")
ROOTTEST_ADD_TEST(read_ttree
EXEC ./read_ttree
FIXTURES_REQUIRED read_ttree_executable
# PATH is used on Windows to find libraries for loading
ENVIRONMENT PATH=${CMAKE_CURRENT_BINARY_DIR}/libttreestltest)
FIXTURES_REQUIRED makeproject_read_ttree_executable
# PATH is used on Windows to find libraries for loading
ENVIRONMENT PATH=${CMAKE_CURRENT_BINARY_DIR}/libttreestltest)
set(ROOTTEST_ENV_LIBRARYPATH ${_roottest_env_librarypath})
22 changes: 7 additions & 15 deletions roottest/root/ntuple/streamerfield/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ ROOTTEST_GENERATE_DICTIONARY(

ROOTTEST_GENERATE_EXECUTABLE(
write_event
write_event.cxx event_v2_dict.cxx
LIBRARIES Core RIO ROOTNTuple
FIXTURES_REQUIRED generated_event_v2_dictionary
FIXTURES_SETUP write_event_excutable)

target_sources(
write_event
PRIVATE write_event.cxx event_v2_dict.cxx
)
FIXTURES_SETUP streamerfield_write_event_excutable)

ROOTTEST_ADD_TEST(write_event
EXEC ./write_event
FIXTURES_REQUIRED write_event_excutable
FIXTURES_SETUP written_event)
FIXTURES_REQUIRED streamerfield_write_event_excutable
FIXTURES_SETUP streamerfield_written_event)

ROOTTEST_GENERATE_DICTIONARY(
event_v3_dict
Expand All @@ -32,15 +28,11 @@ ROOTTEST_GENERATE_DICTIONARY(

ROOTTEST_GENERATE_EXECUTABLE(
read_event
read_event.cxx event_v3_dict.cxx
LIBRARIES Core RIO ROOTNTuple
FIXTURES_REQUIRED generated_event_v3_dictionary
FIXTURES_SETUP read_event_executable)

target_sources(
read_event
PRIVATE read_event.cxx event_v3_dict.cxx
)
FIXTURES_SETUP streamerfield_read_event_executable)

ROOTTEST_ADD_TEST(read_event
EXEC ./read_event
FIXTURES_REQUIRED read_event_executable written_event)
FIXTURES_REQUIRED streamerfield_read_event_executable streamerfield_written_event)
2 changes: 1 addition & 1 deletion roottest/root/ntuple/test_basics.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Processing /home/jakob/Documents/CERN/ROOT/roottest/root/ntuple/basics.C...
Processing basics.C...

{
"E": 137
Expand Down
Loading