diff --git a/CMakeLists.txt b/CMakeLists.txt index baeec628505e7bb3fa9b368eeddb5d392f54ac37..f63d65503c1b3d0e52453a0bcd482a1b94107143 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,7 @@ SET( DD4hep_VERSION_PATCH 0 ) SET( DD4hep_VERSION "${DD4hep_VERSION_MAJOR}.${DD4hep_VERSION_MINOR}" ) SET( DD4hep_SOVERSION "${DD4hep_VERSION_MAJOR}.${DD4hep_VERSION_MINOR}" ) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ) set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) @@ -26,9 +25,17 @@ ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) #---Options------------------------------------------------------------------------- option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" OFF) -option(DD4HEP_USE_PYROOT "Enable 'Detector Builders' based on PyROOT" ON) +option(DD4HEP_USE_PYROOT "Enable 'Detector Builders' based on PyROOT" OFF) # does not work (compile error) option(DD4HEP_WITH_GEANT4 "Enable the simulation part based on Geant4" OFF) -option(DD4HEP_WITH_LCIO "Build ILD examples with LCIO - builds LCIO as external project or uses pre-installed" ON) + +#option(DD4HEP_WITH_LCIO "Build ILD examples with LCIO - builds LCIO as external project or uses pre-installed" ON) + + +#---DD4hep macros ------------------------------------------------------- +include(DD4hep) +include( DD4hepMacros ) + +#----------------------------- find_package(ROOT REQUIRED) if(DD4HEP_USE_XERCESC) @@ -40,43 +47,58 @@ include(CTest) enable_testing() #---Documentation------------------------------------------------------------------- +include(GlobalSVNRevision) include(DD4hepDoxygen) -#---DD4hep internal functions------------------------------------------------------- -include(DD4hep) + +#---DD4hep internal functions ------------------------------------------------------- +#include(DD4hep) #---Packages------------------------------------------------------------------------ add_subdirectory(DDCore) -if(DD4HEP_WITH_GEANT4) - add_subdirectory(DDG4) -### add_subdirectory(DDSense) -endif() - -#---Examples------------------------------------------------------------------------ -add_subdirectory(DDExamples/UtilityApps) -add_subdirectory(DDExamples/AlignDet) -add_subdirectory(DDExamples/CLICSiD) - - -## --- ILD examples ----- -if( DD4HEP_WITH_LCIO ) -add_subdirectory(DDExamples/ILDExDet) -add_subdirectory(DDExamples/ILDExReco) -add_subdirectory(DDExamples/ILDExTest) -add_subdirectory(DDExamples/CaliceTbeam) -endif() - if(DD4HEP_WITH_GEANT4) - add_subdirectory(DDExamples/CLICSiDSimu) + add_subdirectory(DDG4) + add_subdirectory(DDSense) endif() -if(DD4HEP_WITH_GEANT4 AND DD4HEP_WITH_LCIO) - add_subdirectory(DDExamples/ILDExSimu) -endif() +add_subdirectory(UtilityApps) + +##---Examples------------------------------------------------------------------------ +# FG: examples are no longer built with DD4hep - but rather will be moved to standalone packages +#----------------------------------------------------------- + +#add_subdirectory(DDExamples/AlignDet) +#add_subdirectory(DDExamples/CLICSiD) +# +# +### --- ILD examples ----- +#if( DD4HEP_WITH_LCIO ) +#add_subdirectory(DDExamples/ILDExDet) +#add_subdirectory(DDExamples/ILDExReco) +#add_subdirectory(DDExamples/ILDExTest) +#add_subdirectory(DDExamples/CaliceTbeam) +#endif() +# +# +#if(DD4HEP_WITH_GEANT4) +# add_subdirectory(DDExamples/CLICSiDSimu) +#endif() +# +#if(DD4HEP_WITH_GEANT4 AND DD4HEP_WITH_LCIO) +# add_subdirectory(DDExamples/ILDExSimu) +#endif() #---Configuration------------------------------------------------------------------- configure_file(cmake/thisdd4hep.csh thisdd4hep.csh @ONLY) configure_file(cmake/thisdd4hep.sh thisdd4hep.sh @ONLY) + +#----------------------------------------------------------------------------------- +display_std_variables() + +############################################################################## +# generate and install following configuration files + +generate_package_configuration_files( DD4hepConfig.cmake DD4hepConfigVersion.cmake DD4hepLibDeps.cmake ) \ No newline at end of file diff --git a/DDExamples/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt similarity index 100% rename from DDExamples/UtilityApps/CMakeLists.txt rename to UtilityApps/CMakeLists.txt diff --git a/DDExamples/UtilityApps/src/converter.cpp b/UtilityApps/src/converter.cpp similarity index 100% rename from DDExamples/UtilityApps/src/converter.cpp rename to UtilityApps/src/converter.cpp diff --git a/DDExamples/UtilityApps/src/display.cpp b/UtilityApps/src/display.cpp similarity index 100% rename from DDExamples/UtilityApps/src/display.cpp rename to UtilityApps/src/display.cpp diff --git a/DDExamples/UtilityApps/src/plugin_runner.cpp b/UtilityApps/src/plugin_runner.cpp similarity index 100% rename from DDExamples/UtilityApps/src/plugin_runner.cpp rename to UtilityApps/src/plugin_runner.cpp diff --git a/DDExamples/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h similarity index 100% rename from DDExamples/UtilityApps/src/run_plugin.h rename to UtilityApps/src/run_plugin.h diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..4faf4c858de1f971bc8e885ae0d5cb81675df3f7 --- /dev/null +++ b/cmake/DD4hepConfig.cmake.in @@ -0,0 +1,53 @@ +############################################################################## +# cmake configuration file for DD4hep +# +# returns following variables: +# +# DD4hep_FOUND : set to TRUE if DD4hep found +# DD4hep_VERSION : package version +# DD4hep_ROOT : path to this DD4hep installation +# DD4hep_LIBRARIES : list of DD4hep libraries +# DD4hep_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES +# DD4hep_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES +# +# @author Jan Engels, Desy +############################################################################## + +SET( DD4hep_ROOT "@CMAKE_INSTALL_PREFIX@" ) +SET( DD4hep_VERSION "@DD4hep_VERSION@" ) + + +# ---------- include dirs ----------------------------------------------------- +# do not store find results in cache +SET( DD4hep_INCLUDE_DIRS DD4hep_INCLUDE_DIRS-NOTFOUND ) +MARK_AS_ADVANCED( DD4hep_INCLUDE_DIRS ) + +FIND_PATH( DD4hep_INCLUDE_DIRS + NAMES DD4hep/DD4hep.h + PATHS ${DD4hep_ROOT}/include + NO_DEFAULT_PATH +) + + + +# ---------- libraries -------------------------------------------------------- +# do not store find results in cache +SET( DD4hep_LIBRARY_DIRS ${DD4hep_ROOT}/lib ) +SET( DD4hep_LIBRARIES DD4hep_LIBRARIES-NOTFOUND ) +MARK_AS_ADVANCED( DD4hep_LIBRARY_DIRS DD4hep_LIBRARIES ) + +FIND_LIBRARY( DD4hep_LIBRARIES + NAMES DD4hep + PATHS ${DD4hep_LIBRARY_DIRS} + NO_DEFAULT_PATH +) + + + +# ---------- final checking --------------------------------------------------- +INCLUDE( FindPackageHandleStandardArgs ) +# set DD4HEP_FOUND to TRUE if all listed variables are TRUE and not empty +FIND_PACKAGE_HANDLE_STANDARD_ARGS( DD4hep DEFAULT_MSG DD4hep_ROOT DD4hep_INCLUDE_DIRS DD4hep_LIBRARIES ) + +SET( DD4hep_FOUND ${DD4HEP_FOUND} ) + diff --git a/cmake/DD4hepMacros.cmake b/cmake/DD4hepMacros.cmake new file mode 100644 index 0000000000000000000000000000000000000000..03dbf755208c7afaa55d830bdd2507e579514f8e --- /dev/null +++ b/cmake/DD4hepMacros.cmake @@ -0,0 +1,111 @@ +###################################################################### +# +# Useful cmake macros for building DD4hep +# +###################################################################### + +# taken from cmake4hep (https://svnsrv.desy.de/desy/aidasoft/cmake4hep/trunk) : + + +#--------------------------------------------------------------------------- +# helper macro to display standard cmake variables and force write to cache +# otherwise outdated values may appear in ccmake gui +MACRO( DISPLAY_STD_VARIABLES ) +#--------------------------------------------------------------------------- + + MESSAGE( STATUS ) + MESSAGE( STATUS "-------------------------------------------------------------------------------" ) + MESSAGE( STATUS "Change values with: cmake -D<Variable>=<Value>" ) + + IF( DEFINED CMAKE_INSTALL_PREFIX ) + MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) + ENDIF() + + + IF( DEFINED CMAKE_BUILD_TYPE ) + MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" ) + ENDIF() + + IF( DEFINED BUILD_SHARED_LIBS ) + MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" ) + ENDIF() + + IF( DEFINED BUILD_TESTING ) + MESSAGE( STATUS "BUILD_TESTING = ${BUILD_TESTING}" ) + ENDIF() + + IF( DEFINED INSTALL_DOC ) + MESSAGE( STATUS "INSTALL_DOC = ${INSTALL_DOC}" ) + ENDIF() + + IF( DEFINED CMAKE_PREFIX_PATH ) + LIST( REMOVE_DUPLICATES CMAKE_PREFIX_PATH ) + #MESSAGE( STATUS "CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}" ) + MESSAGE( STATUS "CMAKE_PREFIX_PATH =" ) + FOREACH( _path ${CMAKE_PREFIX_PATH} ) + MESSAGE( STATUS " ${_path};" ) + ENDFOREACH() + #SET( CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}" CACHE PATH "CMAKE_PREFIX_PATH" FORCE ) + ENDIF() + + IF( DEFINED CMAKE_MODULE_PATH ) + LIST( REMOVE_DUPLICATES CMAKE_MODULE_PATH ) + #MESSAGE( STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}" ) + MESSAGE( STATUS "CMAKE_MODULE_PATH =" ) + FOREACH( _path ${CMAKE_MODULE_PATH} ) + MESSAGE( STATUS " ${_path};" ) + ENDFOREACH() + SET( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" CACHE PATH "CMAKE_MODULE_PATH" FORCE ) + ENDIF() + + MESSAGE( STATUS "-------------------------------------------------------------------------------" ) + MESSAGE( STATUS ) + +ENDMACRO( DISPLAY_STD_VARIABLES ) + + + +#--------------------------------------------------------------------------- +# helper macro for generating project configuration file +MACRO( GENERATE_PACKAGE_CONFIGURATION_FILES ) +#--------------------------------------------------------------------------- + + FOREACH( arg ${ARGN} ) + IF( ${arg} MATCHES "Config.cmake" ) + IF( EXISTS "${PROJECT_SOURCE_DIR}/cmake/${arg}.in" ) + CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/cmake/${arg}.in" + "${PROJECT_BINARY_DIR}/${arg}" @ONLY + ) + INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION . ) + #IF( EXISTS "${_current_dir}/MacroCheckPackageLibs.cmake" ) + # INSTALL( FILES "${_current_dir}/MacroCheckPackageLibs.cmake" DESTINATION cmake ) + #ENDIF() + #IF( EXISTS "${_current_dir}/MacroExportPackageDeps.cmake" ) + # INSTALL( FILES "${_current_dir}/MacroExportPackageDeps.cmake" DESTINATION cmake ) + #ENDIF() + ENDIF() + ENDIF() + + + IF( ${arg} MATCHES "ConfigVersion.cmake" ) + # version configuration file + IF( EXISTS "${PROJECT_SOURCE_DIR}/cmake/${arg}.in" ) + CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/cmake/${arg}.in" + "${PROJECT_BINARY_DIR}/${arg}" @ONLY + ) + INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION . ) + #IF( EXISTS "${_current_dir}/MacroCheckPackageVersion.cmake" ) + # INSTALL( FILES "${_current_dir}/MacroCheckPackageVersion.cmake" DESTINATION cmake ) + #ENDIF() + ENDIF( EXISTS "${PROJECT_SOURCE_DIR}/cmake/${arg}.in" ) + ENDIF() + + IF( ${arg} MATCHES "LibDeps.cmake" ) + EXPORT_LIBRARY_DEPENDENCIES( "${arg}" ) + INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION lib/cmake ) + ENDIF() + + ENDFOREACH() + +ENDMACRO( GENERATE_PACKAGE_CONFIGURATION_FILES ) + diff --git a/cmake/Doxyfile.in b/cmake/Doxyfile.in index f28a1d2c78a65c60d8bb1ebb823e306318fb4e49..df2e8749df9c5ba39d6b6f2440031eb7a07074fe 100644 --- a/cmake/Doxyfile.in +++ b/cmake/Doxyfile.in @@ -650,7 +650,7 @@ WARN_LOGFILE = # with spaces. INPUT = @CMAKE_CURRENT_SOURCE_DIR@/DDCore/src -INPUT += @CMAKE_CURRENT_SOURCE_DIR@/DDCore/include/DDCore +INPUT += @CMAKE_CURRENT_SOURCE_DIR@/DDCore/include/DD4hep INPUT += @CMAKE_CURRENT_SOURCE_DIR@/DDG4/src INPUT += @CMAKE_CURRENT_SOURCE_DIR@/DDG4/include/DDG4 INPUT += @CMAKE_CURRENT_SOURCE_DIR@/DDSense/src