diff --git a/CMakeLists.txt b/CMakeLists.txt index 778bd330d15ffad200655c3283e0d8d27d563fe9..8720866779b05e29b2ad1968fbb55e5669e68dd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ endif() add_subdirectory(Analysis) add_subdirectory(Detector) # add_subdirectory(Digitisers) -# add_subdirectory(Examples) +add_subdirectory(Examples) add_subdirectory(Generator) # add_subdirectory(Reconstruction) add_subdirectory(Simulation) diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index e11457877fd94d615f12dcf8d5f7bd7388f91c24..02613ead92c981c812a85cdf79370f897d6a1fd2 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -1,58 +1,40 @@ -gaudi_subdir(Examples v0r0) - find_package(podio REQUIRED) -#find_package(plcio REQUIRED) find_package(LCIO REQUIRED) find_package(EDM4HEP REQUIRED) find_package(k4FWCore REQUIRED) find_package(DD4hep COMPONENTS DDRec DDParsers REQUIRED) -gaudi_depends_on_subdirs( - Detector/DetInterface -) - set(Examples_srcs - src/HelloWorld/*.cpp - src/FirstSvc/*.cpp - src/SecondAlg/*.cpp - # src/PlcioTest/*.cpp - src/Edm4hepTest/*.cpp - src/DumpIDAlg/*.cpp + src/HelloWorld/HelloAlg.cpp + src/FirstSvc/FirstSvc.cpp + src/SecondAlg/SecondAlg.cpp + src/Edm4hepTest/Edm4hepReadAlg.cpp + src/Edm4hepTest/Edm4hepReadDCAlg.cpp + src/Edm4hepTest/Edm4hepWriteAlg.cpp + src/DumpIDAlg/DumpIDAlg.cpp ) # Headers and Libraries -gaudi_install_headers(Examples) - # Modules -gaudi_add_module(Examples ${Examples_srcs} - INCLUDE_DIRS k4FWCore GaudiAlgLib GaudiKernel ${podio_INCLUDE_DIRS} ${LCIO_INCLUDE_DIRS} - LINK_LIBRARIES k4FWCore GaudiAlgLib GaudiKernel ${LCIO_LIBRARIES} - DD4hep ${DD4hep_COMPONENT_LIBRARIES} - # Force loading the libraries. - -Wl,--no-as-needed EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${podio_LIBRARIES} podio::podioRootIO -Wl,--as-needed +gaudi_add_module(Examples + SOURCES ${Examples_srcs} + LINK DetInterface + k4FWCore::k4FWCore + Gaudi::GaudiAlgLib Gaudi::GaudiKernel + ${LCIO_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict + ${podio_LIBRARIES} podio::podioRootIO ) -# Unit tests -gaudi_add_test(HelloAlg - FRAMEWORK options/helloalg.py) - -gaudi_add_test(SecondAlg - FRAMEWORK options/secondalg.py) - -gaudi_add_test(PlcioWriteAlg - FRAMEWORK options/plcio_write.py) - -gaudi_add_test(PlcioReadAlg - FRAMEWORK options/plcio_read.py) - -gaudi_add_test(Edm4hepWriteAlg - FRAMEWORK options/edm4hep_write.py) - -gaudi_add_test(Edm4hepReadAlg - FRAMEWORK options/edm4hep_read.py) - -gaudi_add_test(LCIOReadAlg - FRAMEWORK options/LCIO_read.py) +target_include_directories(Examples PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) +install(TARGETS Examples + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Examples/Examples/IFirstSvc.h b/Examples/include/Examples/IFirstSvc.h similarity index 100% rename from Examples/Examples/IFirstSvc.h rename to Examples/include/Examples/IFirstSvc.h diff --git a/Examples/src/HelloWorld/HelloAlg.h b/Examples/src/HelloWorld/HelloAlg.h index 9c689ca91c4363403285348c14d378aa0cf56054..357ac4f8e3a1ae41f0112a52ae46d577cf04dcc0 100644 --- a/Examples/src/HelloWorld/HelloAlg.h +++ b/Examples/src/HelloWorld/HelloAlg.h @@ -2,7 +2,7 @@ #define HelloAlg_h #include <GaudiKernel/Algorithm.h> -#include "GaudiKernel/Property.h" +#include <Gaudi/Property.h> class HelloAlg: public Algorithm { public: diff --git a/Examples/src/SecondAlg/SecondAlg.h b/Examples/src/SecondAlg/SecondAlg.h index e96306c826dc503a2c6c6cc3f11b74608ca81baf..9026b0b37425b2b0dd480f9f0363b59f4046fff2 100644 --- a/Examples/src/SecondAlg/SecondAlg.h +++ b/Examples/src/SecondAlg/SecondAlg.h @@ -2,7 +2,7 @@ #define SecondAlg_h #include <GaudiKernel/Algorithm.h> -#include <GaudiKernel/Property.h> +#include <Gaudi/Property.h> #include "Examples/IFirstSvc.h"