Skip to content
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

Make LCIO an optional dependency #328

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
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
28 changes: 25 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ find_package ( ROOT REQUIRED COMPONENTS Geom GenVector)
message ( STATUS "ROOT_VERSION: ${ROOT_VERSION}" )

find_package( Geant4 REQUIRED )
find_package( LCIO REQUIRED)
find_package( LCIO QUIET)
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
# Shim for older LCIO versions
if(NOT TARGET LCIO::lcio)
add_library(LCIO::lcio INTERFACE IMPORTED GLOBAL)
Expand All @@ -76,6 +76,23 @@ file(GLOB sources
./detector/PID/ARC_geo_o1_v01.cpp
)

if(NOT LCIO_FOUND)
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
file(GLOB lcio_sources
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
./detector/tracker/TrackerEndcap_o2_v05_geo.cpp
./detector/tracker/SiTrackerEndcap_o2_v02ext_geo.cpp
./detector/tracker/TrackerBarrel_o1_v03_geo.cpp
./detector/tracker/TrackerBarrel_o1_v04_geo.cpp
./detector/tracker/TrackerBarrel_o1_v05_geo.cpp
./detector/tracker/TrackerEndcap_o1_v05_geo.cpp
./detector/tracker/TrackerEndcap_o2_v06_geo.cpp
./detector/tracker/VertexBarrel_detailed_o1_v01_geo.cpp
./detector/tracker/VertexEndcap_o1_v05_geo.cpp
./detector/tracker/ZPlanarTracker_geo.cpp
)
list(REMOVE_ITEM sources ${lcio_sources})
message( STATUS "LCIO has NOT been found, some detectors that depend on LCIO will not be built: ${lcio_sources}")
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
endif()

file(GLOB G4sources
./plugins/TPCSDAction.cpp
./plugins/CaloPreShowerSDAction.cpp
Expand All @@ -94,8 +111,13 @@ add_library(lcgeo ALIAS k4geo)
target_include_directories(${PackageName} PRIVATE ${PROJECT_SOURCE_DIR}/detector/include )
target_include_directories(${PackageName}G4 PRIVATE ${PROJECT_SOURCE_DIR}/detector/include )

target_link_libraries(${PackageName} DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers ROOT::Core LCIO::lcio detectorSegmentations)
target_link_libraries(${PackageName}G4 DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers DD4hep::DDG4 ROOT::Core ${Geant4_LIBRARIES} LCIO::lcio)
target_link_libraries(${PackageName} DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers ROOT::Core detectorSegmentations)
target_link_libraries(${PackageName}G4 DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers DD4hep::DDG4 ROOT::Core ${Geant4_LIBRARIES})

if(LCIO_FOUND)
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
target_link_libraries(${PackageName} LCIO::lcio)
target_link_libraries(${PackageName}G4 LCIO::lcio)
endif()

#Create this_package.sh file, and install
dd4hep_instantiate_package(${PackageName})
Expand Down
Loading