diff --git a/CMakeLists.txt b/CMakeLists.txt index c0a892a02562ca0a8e3c7f571737eb77dc807e69..446eb0e360f80172c1615bffe8565325025431a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ) # include ( DD4hepBuild ) @@ -20,7 +20,7 @@ option(DD4HEP_USE_GEANT4 "Enable the simulation part based on Geant4" OFF) option(DD4HEP_USE_GEAR "Build gear wrapper for backward compatibility" OFF) option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) option(BUILD_TESTING "Enable and build tests" ON) -option(DD4HEP_USE_CXX11 "Build DD4hep using c++11" OFF) +option(DD4HEP_USE_CXX11 "Build DD4hep using c++11" ON) option(DD4HEP_USE_CXX14 "Build DD4hep using c++14" OFF) option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) # @@ -35,15 +35,13 @@ option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) dd4hep_set_version(DD4hep MAJOR 0 MINOR 19 PATCH 0) dd4hep_configure_output( OUTPUT "${PROJECT_BINARY_DIR}" INSTALL "${CMAKE_INSTALL_PREFIX}" ) # +# Include ROOT # -# No Reflex library present for ROOT 6 -# -find_package ( ROOT REQUIRED COMPONENTS Geom GenVector ) -if ( ${ROOT_VERSION_MAJOR} GREATER 5 ) - set ( DD4HEP_USE_CXX11 ON ) - message ( STATUS "ROOT_VERSION_MAJOR: ${ROOT_VERSION_MAJOR} --> Using GaudiPluginService..." ) - add_subdirectory ( GaudiPluginService) -endif() +find_package ( ROOT REQUIRED COMPONENTS Geom GenVector Eve GUI Graf3d Rgl) +include(${ROOT_USE_FILE}) +message ( STATUS "ROOT_VERSION: ${ROOT_VERSION}" ) +add_subdirectory ( GaudiPluginService) + #--------------------------------------------------------------------------------------------------- #fg: moved to here from DD4hep.cmake to not force CMAKE_CXX_FLAGS upon dependent packages dd4hep_set_compiler_flags() diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt index b91f81b8a57fa0f5c9608ef775f30b544a53c70e..21436416ee12d4f183de2aa38fbe4a430fc8bf15 100644 --- a/DDEve/CMakeLists.txt +++ b/DDEve/CMakeLists.txt @@ -10,7 +10,7 @@ # #========================================================================== dd4hep_package( DDEve - USES DDCore [ROOT REQUIRED COMPONENTS TEve] + USES DDCore [ROOT REQUIRED COMPONENTS Eve] INCLUDE_DIRS include INSTALL_INCLUDES include/DDEve) # diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt index 2876c182bfc0ed44e3c829ff0622bcdb46c02c1e..ebb8d45f57e3d994cd0de92173d7dfd3d9893bbb 100644 --- a/UtilityApps/CMakeLists.txt +++ b/UtilityApps/CMakeLists.txt @@ -36,27 +36,27 @@ dd4hep_add_executable(test_surfaces USES DDRec DDTest OPTIONAL [LCIO REQUIRED SOURCES src/test_surfaces.cpp]) #----------------------------------------------------------------------------------- -dd4hep_add_dictionary( G__teve +dd4hep_add_dictionary( G__eve SOURCES src/EvNavHandler.h LINKDEF src/LinkDef.h ) #----------------------------------------------------------------------------------- if ( ${DD4HEP_USE_LCIO} ) - dd4hep_add_dictionary( G__teve1 + dd4hep_add_dictionary( G__eve1 SOURCES src/EvNavHandler.h LINKDEF src/LinkDef.h ) dd4hep_add_executable( teveLCIO - USES [ROOT REQUIRED COMPONENTS TEve] + USES [ROOT REQUIRED COMPONENTS Eve GUI Graf3d Rgl] [LCIO REQUIRED] DDRec - GENERATED G__teve1.cxx + GENERATED G__eve1.cxx SOURCES src/teve_display.cpp src/next_event_lcio.cpp ) endif() #----------------------------------------------------------------------------------- -dd4hep_add_executable( teveDisplay - USES [ROOT REQUIRED COMPONENTS TEve] DDRec - GENERATED G__teve.cxx +dd4hep_add_executable( teveDisplay + USES [ROOT REQUIRED COMPONENTS Eve GUI Graf3d Rgl] DDRec + GENERATED G__eve.cxx SOURCES src/teve_display.cpp src/next_event_dummy.cpp ) diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index a7701280dd7ab080b9164123d2de26e1c65fcc88..3b2f625c0dfbc2bd7adfb3efb985685571b940b5 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -105,11 +105,7 @@ function(dd4hep_generate_rootmap_notapple library) SET ( DD4hep_DIR ${CMAKE_SOURCE_DIR} ) endif() find_package(ROOT QUIET) -if( ${ROOT_VERSION_MAJOR} GREATER 5 ) set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.components) -else() - set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.rootmap) -endif() set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX}) #message(STATUS "DD4hep_DIR = ${DD4hep_DIR}" ) @@ -117,14 +113,14 @@ endif() POST_BUILD COMMAND ${CMAKE_COMMAND} -Dlibname=${libname} -Drootmapfile=${rootmapfile} -Dgenmap_install_dir=${LIBRARY_OUTPUT_PATH} - -DROOT_VERSION_MAJOR=${ROOT_VERSION_MAJOR} + -DROOT_VERSION=${ROOT_VERSION} -DDD4hep_DIR=${DD4hep_DIR} -P ${DD4hep_DIR}/cmake/MakeRootMap.cmake) #add_custom_command(OUTPUT ${rootmapfile} # COMMAND ${CMAKE_COMMAND} -Dlibname=${libname} -Drootmapfile=${rootmapfile} # -Dgenmap_install_dir=${LIBRARY_OUTPUT_PATH} - # -DROOT_VERSION_MAJOR=${ROOT_VERSION_MAJOR} + # -DROOT_VERSION=${ROOT_VERSION} # -DDD4hep_DIR=${DD4hep_DIR} # -P ${DD4hep_DIR}/cmake/MakeRootMap.cmake # DEPENDS ${library}) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index ff006d03c2cf0211f8c4e99cfa526e9b8d3a321d..bed0ba5ab7e06cb83512ee47f4b31980750cc737 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -1266,24 +1266,15 @@ function( dd4hep_add_dictionary dictionary ) dd4hep_debug ( "${tag} Unparsed:'${ARG_UNPARSED_ARGUMENTS}'" ) dd4hep_debug ( "${tag} Sources: '${CMAKE_CURRENT_SOURCE_DIR}'" ) # - if ( ${ROOT_VERSION_MAJOR} GREATER 5 ) - ## ${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary}_rdict.pcm - add_custom_command(OUTPUT ${dictionary}.cxx - COMMAND ${ROOTCLING_EXECUTABLE} -cint -f ${dictionary}.cxx - -s ${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary} -inlineInputHeader -c -p ${ARG_OPTIONS} ${comp_defs} -std=c++${DD4HEP_USE_STDCXX} ${inc_dirs} ${headers} ${linkdefs} - DEPENDS ${headers} ${linkdefs} ) - # Install the binary to the destination directory - #set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary}_rdict.pcm PROPERTIES GENERATED TRUE ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary}_rdict.pcm DESTINATION lib) - #set_source_files_properties( ${dictionary}.h ${dictionary}.cxx PROPERTIES GENERATED TRUE ) - else() - add_custom_command(OUTPUT ${dictionary}.h ${dictionary}.cxx - COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx - -s ${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary} -c -p ${ARG_OPTIONS} ${comp_defs} ${inc_dirs} ${headers} ${linkdefs} - DEPENDS ${headers} ${linkdefs} ) - #set_source_files_properties( ${dictionary}.h ${dictionary}.cxx PROPERTIES GENERATED TRUE ) + add_custom_command(OUTPUT ${dictionary}.cxx + COMMAND ${ROOT_rootcling_CMD} -cint -f ${dictionary}.cxx + -s ${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary} -inlineInputHeader -c -p ${ARG_OPTIONS} ${comp_defs} -std=c++${DD4HEP_USE_STDCXX} ${inc_dirs} ${headers} ${linkdefs} + DEPENDS ${headers} ${linkdefs} ) + # Install the binary to the destination directory + #set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary}_rdict.pcm PROPERTIES GENERATED TRUE ) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../lib/${dictionary}_rdict.pcm DESTINATION lib) + #set_source_files_properties( ${dictionary}.h ${dictionary}.cxx PROPERTIES GENERATED TRUE ) endif() - endif() endfunction() #--------------------------------------------------------------------------------------------------- diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in index 4b7697184b7261d72f853b29bda243224c53418b..ce108159ea2431c87712c17930f37c5ce52796b9 100644 --- a/cmake/DD4hepConfig.cmake.in +++ b/cmake/DD4hepConfig.cmake.in @@ -27,7 +27,7 @@ set ( GEANT4_USE_CLHEP "@GEANT4_USE_CLHEP@" ) set ( ROOTSYS "$ENV{ROOTSYS}" ) set ( ROOT_DIR "$ENV{ROOTSYS}/cmake" ) -set ( ROOT_VERSION_MAJOR "@ROOT_VERSION_MAJOR@" ) +set ( ROOT_VERSION "@ROOT_VERSION@" ) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) diff --git a/cmake/MakeRootMap.cmake b/cmake/MakeRootMap.cmake index 452689a081ef2546f9791f662463a84a34011ae6..5b8fc9637d9ffe5ec96d147b4f0f65b5b8a7e902 100644 --- a/cmake/MakeRootMap.cmake +++ b/cmake/MakeRootMap.cmake @@ -1,11 +1,10 @@ -message(STATUS " *** ROOT_genmap[Root version: ${ROOT_VERSION_MAJOR}]: Generate map for ${libname} ..." ) -if( ${ROOT_VERSION_MAJOR} GREATER 5 ) +message(STATUS " *** ROOT_genmap[Root version: ${ROOT_VERSION}]: Generate map for ${libname} ..." ) # # Running listcomponents from Gaudi # FIND_PROGRAM( ROOT_genmap_CMD listcomponents PATHS ${genmap_install_dir}/../bin ${DD4hep_DIR}/bin ) ###MESSAGE( STATUS " *** MakeRootMap ${genmap_install_dir}/../bin $ENV{DD4hep_DIR}/bin ${DD4hep_DIR}" ) - MESSAGE( STATUS " *** MakeRootMap[${ROOT_VERSION_MAJOR}].cmake run command : ${ROOT_genmap_CMD} -o ${rootmapfile} ${libname} + MESSAGE( STATUS " *** MakeRootMap[${ROOT_VERSION}].cmake run command : ${ROOT_genmap_CMD} -o ${rootmapfile} ${libname} WORKING_DIRECTORY ${genmap_install_dir} " ) @@ -20,24 +19,4 @@ if( ${ROOT_VERSION_MAJOR} GREATER 5 ) WORKING_DIRECTORY ${genmap_install_dir} ) -else() - # - # Running genmap from ROOT 5 - # - FIND_PROGRAM( ROOT_genmap_CMD genmap PATHS $ENV{ROOTSYS}/bin $ENV{PATH} ) - MESSAGE( STATUS " *** MakeRootMap[${ROOT_VERSION_MAJOR}].cmake run command : ${ROOT_genmap_CMD} -debug -i ${libname} -o ${rootmapfile} - WORKING_DIRECTORY ${genmap_install_dir} " - ) - - if(APPLE) - SET ( ENV{DYLD_LIBRARY_PATH} ./:$ENV{DYLD_LIBRARY_PATH}:$ENV{DD4HEP_LIBRARY_PATH}:$ENV{ROOTSYS}/lib:${genmap_install_dir} ) - else() - SET ( ENV{LD_LIBRARY_PATH} ./:$ENV{LD_LIBRARY_PATH}:$ENV{ROOTSYS}/lib:${genmap_install_dir} ) - endif() - - EXECUTE_PROCESS( COMMAND - ${ROOT_genmap_CMD} -debug -i ${libname} -o ${rootmapfile} - WORKING_DIRECTORY ${genmap_install_dir} - ) -endif()