123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- set(PICO_DST_INCLUDE_DIRECTORIES
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${ROOT_INLCUDE_DIRS}
- )
- include_directories(${PICO_DST_INCLUDE_DIRECTORIES})
- set(PICO_DST_INCLUDE_LIBRARIES
- ${ROOT_LIBRARIES}
- )
- set(PicoDst_h_files
- PicoDstBaseEvent.h
- PicoDstMCEvent.h
- PicoDstRecoEvent.h
- PicoDstBaseTrack.h
- PicoDstMCTrack.h
- PicoDstRecoTrack.h
- PicoDstFHCal.h
- )
- set(PicoDst_cxx_files
- PicoDstBaseEvent.cxx
- PicoDstMCEvent.cxx
- PicoDstRecoEvent.cxx
- PicoDstBaseTrack.cxx
- PicoDstMCTrack.cxx
- PicoDstRecoTrack.cxx
- PicoDstFHCal.cxx
- )
- #---Generate dictionary
- ROOT_GENERATE_DICTIONARY(G__PicoDst
- ${PicoDst_h_files}
- LINKDEF PicoDst.LinkDef.h
- )
- #---Compile library
- add_library(PicoDst SHARED ${PicoDst_cxx_files} G__PicoDst.cxx)
- target_link_libraries(PicoDst ${PICO_DST_INCLUDE_LIBRARIES})
- set(ENV{PICO_DST_BIN} "${CMAKE_CURRENT_BINARY_DIR}")
- set(ENV{PICO_DST_SRC} "${CMAKE_CURRENT_SOURCE_DIR}")
- set(ENV{PICO_DST_LIB} "${CMAKE_CURRENT_BINARY_DIR}/libPicoDst.so")
- message(STATUS "PICO_DST_BIN: " $ENV{PICO_DST_BIN})
- message(STATUS "PICO_DST_SRC: " $ENV{PICO_DST_SRC})
- message(STATUS "PICO_DST_LIB: " $ENV{PICO_DST_LIB})
- set(BASH "/bin/bash")
- file( WRITE ${CMAKE_BINARY_DIR}/setPicoDst.sh "#!${BASH}\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "export PICO_DST_BIN=$ENV{PICO_DST_BIN}\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "export PICO_DST_SRC=$ENV{PICO_DST_SRC}\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "export PICO_DST_LIB=$ENV{PICO_DST_LIB}\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "export LD_LIBRARY_PATH=$PICO_DST_BIN:$LD_LIBRARY_PATH\n")
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "export PATH=$PICO_DST_BIN:$PATH\n")
- IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/install" CACHE PATH "forcing to install in build directory" FORCE)
- ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(ENV{PICO_DST_SYS} "${CMAKE_INSTALL_PREFIX}/cmake")
- message(STATUS "PICO_DST_SYS: " $ENV{PICO_DST_SYS})
- file( APPEND ${CMAKE_BINARY_DIR}/setPicoDst.sh "export PICO_DST_SYS=$ENV{PICO_DST_SYS}\n")
- install(TARGETS
- PicoDst
- EXPORT PicoDstConfig
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PicoDst
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PicoDst
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PicoDst
- )
- export(TARGETS
- PicoDst
- NAMESPACE PicoDst::
- FILE "${CMAKE_CURRENT_BINARY_DIR}/PicoDstConfig.cmake"
- )
- install(EXPORT
- PicoDstConfig
- DESTINATION "${CMAKE_INSTALL_PREFIX}/cmake"
- NAMESPACE PicoDst::
- )
- if(NOT ONLY_ROOT)
- #---Compile executable
- set(PICODSTCONVERTER_INCLUDE_DIRECTORIES
- ${FAIRROOT_INCLUDE_DIR}
- ${MPDROOTDIR}/tpc
- ${MPDROOTDIR}/kalman
- ${MPDROOTDIR}/lhetrack
- ${MPDROOTDIR}/mcstack
- ${MPDROOTDIR}/strawendcap
- ${MPDROOTDIR}/etof
- ${MPDROOTDIR}/tof
- ${MPDROOTDIR}/sft
- ${MPDROOTDIR}/sts
- ${MPDROOTDIR}/zdc
- ${MPDROOTDIR}/mpddst
- ${MPDROOTDIR}/mpdbase
- ${MPDROOTDIR}/mpdpid
- )
- #---Add Needed libraries
- find_library(BASE NAMES Base PATHS ${FAIRROOT_LIBRARY_DIR})
- find_library(MCSTACK NAMES MCStack PATHS $ENV{FAIRLIBDIR})
- find_library(PASSIVE NAMES Passive PATHS $ENV{FAIRLIBDIR})
- find_library(MPDFIELD NAMES MpdField PATHS $ENV{FAIRLIBDIR})
- find_library(MPDBASE NAMES MpdBase PATHS $ENV{FAIRLIBDIR})
- find_library(MPDDST NAMES MpdDst PATHS $ENV{FAIRLIBDIR})
- find_library(MPDGENERALGENERATOR NAMES MpdGeneralGenerator PATHS $ENV{FAIRLIBDIR})
- find_library(KALMAN NAMES Kalman PATHS $ENV{FAIRLIBDIR})
- find_library(CLUSTER NAMES Cluster PATHS $ENV{FAIRLIBDIR})
- find_library(TPC NAMES tpc PATHS $ENV{FAIRLIBDIR})
- find_library(TOF NAMES Tof PATHS $ENV{FAIRLIBDIR})
- find_library(ETOF NAMES Etof PATHS $ENV{FAIRLIBDIR})
- find_library(STRAWENDCAP NAMES Strawendcap PATHS $ENV{FAIRLIBDIR})
- find_library(ZDC NAMES Zdc PATHS $ENV{FAIRLIBDIR})
- find_library(FFD NAMES Ffd PATHS $ENV{FAIRLIBDIR})
- find_library(CPC NAMES Cpc PATHS $ENV{FAIRLIBDIR})
- find_library(STRAWECT NAMES StrawECT PATHS $ENV{FAIRLIBDIR})
- find_library(LHETrack NAMES LHETrack PATHS $ENV{FAIRLIBDIR})
- find_library(STS NAMES Sts PATHS $ENV{FAIRLIBDIR})
- find_library(MPDPID NAMES MpdPid PATHS $ENV{FAIRLIBDIR})
- set(PICODSTCONVERTER_INCLUDE_LIBRARIES
- PicoDst ${BASE}
- ${MCSTACK} ${PASSIVE} ${KALMAN} ${CLUSTER} ${TPC} ${STS} ${ZDC} ${FFD}
- ${STRAWECT} ${STRAWENDCAP} ${LHETRACK} ${TOF}
- ${MPDFIELD} ${MPDBASE} ${MPDDST} ${MPDGENERALGENERATOR} ${MPDPID}
- )
- add_executable(PicoDstConverter PicoDstConverter.cpp)
- target_include_directories(PicoDstConverter PUBLIC ${PICODSTCONVERTER_INCLUDE_DIRECTORIES})
- target_link_libraries(PicoDstConverter ${PICODSTCONVERTER_INCLUDE_LIBRARIES})
- endif()
|