From 7f2ac2e8b9ae272edbd89b72c2011a52885cad4d Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Wed, 23 Dec 2020 17:26:34 +0800
Subject: [PATCH] WIP: migrate GaudiPandora

---
 Reconstruction/CMakeLists.txt                 |  2 +-
 Reconstruction/PFA/CMakeLists.txt             |  2 +
 Reconstruction/PFA/Pandora/CMakeLists.txt     |  3 +
 .../PFA/Pandora/GaudiPandora/CMakeLists.txt   | 65 ++++++++++---------
 4 files changed, 39 insertions(+), 33 deletions(-)
 create mode 100644 Reconstruction/PFA/CMakeLists.txt
 create mode 100644 Reconstruction/PFA/Pandora/CMakeLists.txt

diff --git a/Reconstruction/CMakeLists.txt b/Reconstruction/CMakeLists.txt
index 293eaa30..e506b90c 100644
--- a/Reconstruction/CMakeLists.txt
+++ b/Reconstruction/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_subdirectory(DCHDedx)
 add_subdirectory(Digi_Calo)
-# add_subdirectory(PFA)
+add_subdirectory(PFA)
 add_subdirectory(SiliconTracking)
 add_subdirectory(Tracking)
diff --git a/Reconstruction/PFA/CMakeLists.txt b/Reconstruction/PFA/CMakeLists.txt
new file mode 100644
index 00000000..b3a1b426
--- /dev/null
+++ b/Reconstruction/PFA/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_subdirectory(Pandora)
diff --git a/Reconstruction/PFA/Pandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/CMakeLists.txt
new file mode 100644
index 00000000..c042acca
--- /dev/null
+++ b/Reconstruction/PFA/Pandora/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+add_subdirectory(GaudiPandora)
+# add_subdirectory(MatrixPandora)
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt
index 7b07fd67..bf3b0eeb 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt
@@ -1,48 +1,49 @@
-gaudi_subdir(GaudiPandora v0r0)
 
 find_package(LCIO REQUIRED ) 
 find_package(DD4hep COMPONENTS DDG4 REQUIRED)
 find_package(GEAR REQUIRED)
 find_package(CLHEP REQUIRED;CONFIG)
-message("ENV GEAR: $ENV{GEAR}")
 
 find_package(EDM4HEP REQUIRED )
-include_directories(${EDM4HEP_INCLUDE_DIR})
+find_package(k4FWCore REQUIRED )
 
 find_package(PandoraSDK REQUIRED ) 
-include_directories(${PandoraSDK_INCLUDE_DIRS})
-link_libraries(${PandoraSDK_LIBRARIES})
 find_package(LCContent REQUIRED ) 
-include_directories(${LCContent_INCLUDE_DIRS})
-link_libraries(${LCContent_LIBRARIES})
-
 
 find_package(ROOT COMPONENTS MathCore Physics GenVector Geom REQUIRED)
 
-
-gaudi_depends_on_subdirs(
-    Service/EventSeeder
-    Service/GearSvc
-    Utilities/DataHelper
-    Detector/DetInterface
+# Modules
+gaudi_add_module(GaudiPandora
+                 SOURCES src/PandoraPFAlg.cpp
+                         src/MCParticleCreator.cpp
+                         src/GeometryCreator.cpp
+                         src/CaloHitCreator.cpp
+                         src/TrackCreator.cpp
+                         src/PfoCreator.cpp
+                         src/Utility.cpp
+                 LINK EventSeeder
+                      GearSvc
+                      DataHelperLib
+                      DetInterface
+                      Gaudi::GaudiKernel
+                      k4FWCore::k4FWCore
+                      ${PandoraSDK_LIBRARIES}
+                      ${LCContent_LIBRARIES}
+                      ${CLHEP_LIBRARIES} 
+                      ${ROOT_LIBRARIES}
+                      ${LCIO_LIBRARIES}
+                      ${GEAR_LIBRARIES}
+                      ${DD4hep_COMPONENT_LIBRARIES}
+                      EDM4HEP::edm4hep EDM4HEP::edm4hepDict
 )
 
-set(dir_srcs
-    src/PandoraPFAlg.cpp
-    src/MCParticleCreator.cpp
-    src/GeometryCreator.cpp
-    src/CaloHitCreator.cpp
-    src/TrackCreator.cpp
-    src/PfoCreator.cpp
-    src/Utility.cpp
-)
-set(dir_include include)
-# Modules
-gaudi_add_module(GaudiPandora ${dir_srcs}
-    INCLUDE_DIRS ${dir_include} GaudiKernel k4FWCore CLHEP  ${LCIO_INCLUDE_DIRS} ROOT gear DD4hep 
-    LINK_LIBRARIES GaudiKernel k4FWCore CLHEP ROOT ${LCIO_LIBRARIES} ${GEAR_LIBRARIES} DataHelperLib DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec 
-      -Wl,--no-as-needed 
-      EDM4HEP::edm4hep EDM4HEP::edm4hepDict
-      -Wl,--as-needed 
+target_include_directories(GaudiPandora PUBLIC
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include
+  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
+
+install(TARGETS GaudiPandora
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
 
-)
-- 
GitLab