Geant4 LTO Improvements / Fixes, main branch (2024.05.10.)
As @elmsheus found in ATLINFR-5372, !71255 (merged) managed to break our Clang nightly.
https://bigpanda.cern.ch/nview/?nightly=main_Athena_x86_64-el9-clang17-opt
It turns out that LTO doesn't come as easily to Clang as it does to GCC.
As described in ATLINFR-5372, I found that I would need to do two things:
- Turn off
ATLAS_GEANT4_USE_LTO
when check_ipo_supported(...) tells us to do so. This is what I did inAthena/CMakeLists.txt
andAthSimulation/CMakeLists.txt
. - Make sure that INTERPROCEDURAL_OPTIMIZATION would be set explicitly on all clients of the G4 OBJECT libraries. Since IPO/LTO is not a transitive property in CMake, and Clang's linking needs LTO to be enabled to understand what to do with the object files that were created using LTO.
During the latter I also found a package that escaped being merged into AtlasGeant4
: MuonSensitiveDetectorsR4. In this MR I'm adding that to AtlasGeant4
as well. But I'm not absolutely sure that I should...