CMakeLists.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # CMakeLists.txt for FAS package. It creates a library with dictionary and a main program
  2. cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
  3. project(MpdAnalysisTreeConverter)
  4. find_package(Git)
  5. list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
  6. #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
  7. find_package(ROOT REQUIRED COMPONENTS MathCore RIO Hist Tree Net MathMore EG)
  8. #---Locate AnalysisTree library
  9. find_library(AnalysisTree NAMES AnalysisTreeBase PATHS $ENV{ANALYSISTREE_LIB})
  10. if (AnalysisTree)
  11. message(STATUS "AnalysisTree is found: ${AnalysisTree}")
  12. endif()
  13. if (NOT AnalysisTree)
  14. message(FATAL_ERROR "Error: AnalysisTree library wasn't found!")
  15. endif()
  16. #---Locate FairSoft/FairRoot package
  17. set(FAIRSOFT_PATH $ENV{FAIRROOTPATH}/share/fairbase/cmake/modules)
  18. list(APPEND CMAKE_MODULE_PATH ${FAIRSOFT_PATH})
  19. find_package(FairRoot QUIET COMPONENTS Base)
  20. if(NOT FAIRROOT_FOUND)
  21. message(FATAL_ERROR "FairRoot package NOT found.")
  22. endif()
  23. #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
  24. include(${ROOT_USE_FILE})
  25. add_definitions(${ROOT_CXX_FLAGS})
  26. set(CMAKE_BUILD_TYPE Debug)
  27. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -g")
  28. if(NOT DEFINED ENV{VMCWORKDIR})
  29. message(FATAL_ERROR "MpdRoot environment is NOT found. Skip corresponding step.")
  30. endif()
  31. set(MPDROOTDIR $ENV{VMCWORKDIR})
  32. message(STATUS "MpdRoot environment is found: ${MPDROOTDIR}")
  33. set(MPD_AT_CONVERTER_INCLUDE_DIRECTORIES
  34. ${CMAKE_CURRENT_SOURCE_DIR}
  35. ${ROOT_INLCUDE_DIRS}
  36. $ENV{ANALYSISTREE_INC}
  37. ${FAIRROOT_INCLUDE_DIR}
  38. ${MPDROOTDIR}/tpc
  39. ${MPDROOTDIR}/kalman
  40. # ${MPDROOTDIR}/lhetrack
  41. ${MPDROOTDIR}/mcstack
  42. ${MPDROOTDIR}/generators
  43. ${MPDROOTDIR}/strawendcap
  44. ${MPDROOTDIR}/etof
  45. ${MPDROOTDIR}/tof
  46. ${MPDROOTDIR}/sft
  47. ${MPDROOTDIR}/sts
  48. ${MPDROOTDIR}/zdc
  49. ${MPDROOTDIR}/mpddst
  50. ${MPDROOTDIR}/mpdbase
  51. ${MPDROOTDIR}/mpdpid
  52. )
  53. include_directories(${MPD_AT_CONVERTER_INCLUDE_DIRECTORIES})
  54. #---Add Needed MpdRoot/FairRoot libraries
  55. find_library(BASE NAMES Base PATHS ${FAIRROOT_LIBRARY_DIR})
  56. find_library(MCSTACK NAMES MCStack PATHS $ENV{FAIRLIBDIR})
  57. if (MCSTACK)
  58. message(STATUS "MCStack library is found")
  59. add_definitions("-D_MCSTACK_")
  60. endif()
  61. if (NOT MCSTACK)
  62. find_library(MPDMCSTACK NAMES MpdMCStack PATHS $ENV{FAIRLIBDIR})
  63. message(STATUS "MpdMCStack library is found")
  64. add_definitions("-D_MPDMCSTACK_")
  65. endif()
  66. find_library(PASSIVE NAMES Passive PATHS $ENV{FAIRLIBDIR})
  67. find_library(MPDFIELD NAMES MpdField PATHS $ENV{FAIRLIBDIR})
  68. find_library(MPDBASE NAMES MpdBase PATHS $ENV{FAIRLIBDIR})
  69. find_library(MPDDST NAMES MpdDst PATHS $ENV{FAIRLIBDIR})
  70. find_library(MPDGENERALGENERATOR NAMES MpdGeneralGenerator PATHS $ENV{FAIRLIBDIR})
  71. find_library(KALMAN NAMES Kalman PATHS $ENV{FAIRLIBDIR})
  72. find_library(CLUSTER NAMES Cluster PATHS $ENV{FAIRLIBDIR})
  73. find_library(TPC NAMES tpc PATHS $ENV{FAIRLIBDIR})
  74. find_library(TOF NAMES Tof PATHS $ENV{FAIRLIBDIR})
  75. find_library(ETOF NAMES Etof PATHS $ENV{FAIRLIBDIR})
  76. # find_library(STRAWENDCAP NAMES Strawendcap PATHS $ENV{FAIRLIBDIR})
  77. find_library(ZDC NAMES Zdc PATHS $ENV{FAIRLIBDIR})
  78. find_library(FFD NAMES Ffd PATHS $ENV{FAIRLIBDIR})
  79. find_library(CPC NAMES Cpc PATHS $ENV{FAIRLIBDIR})
  80. # find_library(STRAWECT NAMES StrawECT PATHS $ENV{FAIRLIBDIR})
  81. # find_library(LHETRACK NAMES LHETrack PATHS $ENV{FAIRLIBDIR})
  82. find_library(STS NAMES Sts PATHS $ENV{FAIRLIBDIR})
  83. find_library(MPDPID NAMES MpdPid PATHS $ENV{FAIRLIBDIR})
  84. #---Get all needed libraries together
  85. if(MCSTACK)
  86. set(MPD_AT_CONVERTER_INCLUDE_LIBRARIES
  87. ${AnalysisTree} ${ROOT_LIBRARIES} ${BASE}
  88. ${MCSTACK} ${PASSIVE} ${KALMAN} ${CLUSTER} ${TPC} ${STS} ${ZDC} ${FFD}
  89. # ${STRAWECT} ${STRAWENDCAP}
  90. # ${LHETRACK}
  91. ${TOF}
  92. ${TOF}
  93. ${MPDFIELD}
  94. ${MPDBASE}
  95. # ${MPDDST}
  96. ${MPDGENERALGENERATOR}
  97. ${MPDPID}
  98. )
  99. elseif(MPDMCSTACK)
  100. set(MPD_AT_CONVERTER_INCLUDE_LIBRARIES
  101. ${AnalysisTree} ${ROOT_LIBRARIES} ${BASE}
  102. ${MPDMCSTACK} ${PASSIVE} ${KALMAN} ${CLUSTER} ${TPC} ${STS} ${ZDC} ${FFD}
  103. # # ${STRAWECT} ${STRAWENDCAP}
  104. # ${LHETRACK}
  105. ${TOF}
  106. ${MPDFIELD}
  107. ${MPDBASE}
  108. # ${MPDDST}
  109. ${MPDGENERALGENERATOR}
  110. ${MPDPID}
  111. )
  112. elseif()
  113. message(FATAL_ERROR "No MCSTACK nor MPDMCSTACK libraries was found!")
  114. endif()
  115. #---Compile converter's executable file
  116. add_executable(MpdDst2AnalysisTree "${CMAKE_CURRENT_SOURCE_DIR}/MpdDstAnalysisTree.cpp")
  117. #target_include_directories(MpdDst2AnalysisTree PUBLIC ${MPD_AT_CONVERTER_INCLUDE_DIRECTORIES})
  118. target_link_libraries(MpdDst2AnalysisTree ${MPD_AT_CONVERTER_INCLUDE_LIBRARIES})
  119. # #---Compile dca getter's executable file
  120. # add_executable(get-dca "${CMAKE_CURRENT_SOURCE_DIR}/get-dca.cpp")
  121. # target_link_libraries(get-dca ${AnalysisTree} ${ROOT_LIBRARIES})