From aa4defd23a32bcc9f563b7b1704c73d4c14d3e7c Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Wed, 23 Dec 2020 11:10:37 +0800
Subject: [PATCH] WIP: migrate GearSvc.

---
 CMakeLists.txt                                |  1 +
 Service/CMakeLists.txt                        |  3 +++
 Service/GearSvc/CMakeLists.txt                | 24 ++++++++++---------
 .../GearSvc/{ => include}/GearSvc/IGearSvc.h  |  0
 4 files changed, 17 insertions(+), 11 deletions(-)
 create mode 100644 Service/CMakeLists.txt
 rename Service/GearSvc/{ => include}/GearSvc/IGearSvc.h (100%)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7e2927f..b6719ff4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ add_subdirectory(Detector)
 add_subdirectory(Examples)
 add_subdirectory(Generator)
 # add_subdirectory(Reconstruction)
+add_subdirectory(Service)
 add_subdirectory(Simulation)
 add_subdirectory(Utilities)
 
diff --git a/Service/CMakeLists.txt b/Service/CMakeLists.txt
new file mode 100644
index 00000000..72a2446d
--- /dev/null
+++ b/Service/CMakeLists.txt
@@ -0,0 +1,3 @@
+# add_subdirectory(EventSeeder)
+add_subdirectory(GearSvc)
+# add_subdirectory(TrackSystemSvc)
diff --git a/Service/GearSvc/CMakeLists.txt b/Service/GearSvc/CMakeLists.txt
index ef21d420..b84ea097 100644
--- a/Service/GearSvc/CMakeLists.txt
+++ b/Service/GearSvc/CMakeLists.txt
@@ -1,19 +1,21 @@
-gaudi_subdir(GearSvc v0r0)
 
 find_package(GEAR REQUIRED)
 find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED)
 
-gaudi_depends_on_subdirs(
-    Detector/DetInterface
-)
+gaudi_add_header_only_library(GearSvc)
 
-set(GearSvc_srcs
-    src/*.cpp
+gaudi_add_module(GearSvcPlugins
+                 SOURCES src/GearSvc.cpp
+                 LINK GearSvc
+                      Gaudi::GaudiKernel
+                      ${GEAR_LIBRARIES}
+                      ${DD4hep_COMPONENT_LIBRARIES}
+                      DetInterface
 )
 
-gaudi_install_headers(GearSvc)
+install(TARGETS GearSvc GearSvcPlugins
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
 
-gaudi_add_module(GearSvc ${GearSvc_srcs}
-    INCLUDE_DIRS GaudiKernel gear
-    LINK_LIBRARIES GaudiKernel ${GEAR_LIBRARIES} ${DD4hep_COMPONENT_LIBRARIES}
-)
diff --git a/Service/GearSvc/GearSvc/IGearSvc.h b/Service/GearSvc/include/GearSvc/IGearSvc.h
similarity index 100%
rename from Service/GearSvc/GearSvc/IGearSvc.h
rename to Service/GearSvc/include/GearSvc/IGearSvc.h
-- 
GitLab