Skip to content

Conversation

@wdconinc
Copy link
Member

JANA2 by default links against ROOT_LIBRARIES, which is much broader than needed (it includes all of Core Imt RIO Net Hist Graf Graf3d Gpad ROOTDataFrame Tree TreePlayer Rint Postscript Matrix Physics MathCore Thread MultiProc ROOTVecOps). (Yes, as-needed can get rid of some of this.)

This PR restricts the link target to ROOT::Core only, which is sufficient for everything in the project. ROOT IO is not implemented in the examples, but an extra target would need to be added to future targets that explicitly use it. The podioRootIO target links transitively to the necessary ROOT IO libraries, and they do not need to specified explicitly.

Copilot AI review requested due to automatic review settings December 19, 2025 17:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restricts JANA2's ROOT dependency from the broad ROOT_LIBRARIES variable to the more specific ROOT::Core target, reducing unnecessary library linkage. The broader ROOT_LIBRARIES includes many unneeded components like RIO, Net, Hist, Graf, Tree, etc.

  • Replaced ${ROOT_LIBRARIES} with ROOT::Core for direct ROOT usage
  • Removed explicit ROOT library linking when using podio, as podio::podioRootIO provides necessary ROOT IO libraries transitively
  • Applied changes consistently across all library targets and examples

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/libraries/JANA/CMakeLists.txt Updated jana2, jana2_static_lib, and jana2_shared_lib targets to link against ROOT::Core instead of ROOT_LIBRARIES, and removed redundant ROOT library specification when using podio
src/examples/misc/RootDatamodelExample/CMakeLists.txt Updated RootDatamodelExample plugin to link against ROOT::Core instead of ROOT_LIBRARIES
CMakeLists.txt Updated global link_libraries directive to use ROOT::Core instead of ROOT_LIBRARIES

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wdconinc wdconinc force-pushed the link-libraries-root-core-only branch from 3ec9f51 to 37af9e6 Compare January 1, 2026 21:01
@nathanwbrei
Copy link
Collaborator

Does this affect how much of ROOT you have to build? I naively assumed that ROOT_LIBRARIES is set to only include the ROOT libraries that were actually built and installed. I'd hate for you to have to build the entirety of ROOT, including dependencies such as Qt, simply so that JANA can EnableGetAs<TObject>(), which EICrecon doesn't even use.

Or is this PR more about getting us off of old-style CMake?

@nathanwbrei
Copy link
Collaborator

nathanwbrei commented Jan 2, 2026

Any idea how much of an effect this change has on EICrecon's compilation time?

@wdconinc
Copy link
Member Author

wdconinc commented Jan 2, 2026

Or is this PR more about getting us off of old-style CMake?

Yes, this is more of that :-) Just general minimal dependencies where possible. Shorter linking lines too.

I don't think it affects compilation time too much (if ROOT is on cvmfs like for EICrecon inside eic-shell, then it pulls the libraries since they are on the command line, only to ignore them during linking).

@wdconinc
Copy link
Member Author

wdconinc commented Jan 2, 2026

It really started out of an attempt at building all of EICrecon (or as much as possible) with C++20 modules. That would have an impact on compilation time since we have JANA as the most expensive headers and they are included in a whole bunch of places. It's likely going to be easier to get ROOT::Core to support modules than all of ROOT_LIBRARIES.

@nathanwbrei
Copy link
Collaborator

I'm curious to hear how your adventures with modules go!

@nathanwbrei nathanwbrei merged commit 9cb4937 into JeffersonLab:master Jan 6, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants