CMakeLists.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. set(FAIRROOT_INCLUDE_DIR $ENV{FAIRROOTPATH}/include)
  24. set(FAIRROOT_LIBRARY_DIR $ENV{FAIRROOTPATH}/lib)
  25. #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
  26. include(${ROOT_USE_FILE})
  27. add_definitions(${ROOT_CXX_FLAGS})
  28. set(CMAKE_BUILD_TYPE Debug)
  29. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -g")
  30. if(NOT DEFINED ENV{VMCWORKDIR})
  31. message(FATAL_ERROR "MpdRoot environment is NOT found. Skip corresponding step.")
  32. endif()
  33. set(MPDROOTDIR $ENV{VMCWORKDIR})
  34. message(STATUS "MpdRoot environment is found: ${MPDROOTDIR}")
  35. set(MPD_AT_CONVERTER_INCLUDE_DIRECTORIES
  36. ${CMAKE_CURRENT_SOURCE_DIR}
  37. ${ROOT_INLCUDE_DIRS}
  38. $ENV{ANALYSISTREE_INC}
  39. ${FAIRROOT_INCLUDE_DIR}
  40. ${MPDROOTDIR}/include
  41. )
  42. include_directories(${MPD_AT_CONVERTER_INCLUDE_DIRECTORIES})
  43. #---Add Needed MpdRoot/FairRoot libraries
  44. find_library(BASE NAMES Base PATHS ${FAIRROOT_LIBRARY_DIR})
  45. find_library(MCSTACK NAMES MCStack PATHS $ENV{FAIRLIBDIR})
  46. if (MCSTACK)
  47. message(STATUS "MCStack library is found")
  48. add_definitions("-D_MCSTACK_")
  49. endif()
  50. if (NOT MCSTACK)
  51. find_library(MPDMCSTACK NAMES MpdMCStack PATHS $ENV{FAIRLIBDIR})
  52. message(STATUS "MpdMCStack library is found")
  53. add_definitions("-D_MPDMCSTACK_")
  54. endif()
  55. find_library(PASSIVE NAMES Passive PATHS $ENV{FAIRLIBDIR})
  56. find_library(MPDFIELD NAMES MpdField PATHS $ENV{FAIRLIBDIR})
  57. find_library(MPDBASE NAMES MpdBase PATHS $ENV{FAIRLIBDIR})
  58. find_library(MPDDST NAMES MpdDst PATHS $ENV{FAIRLIBDIR})
  59. find_library(MPDGENERALGENERATOR NAMES MpdGeneralGenerator PATHS $ENV{FAIRLIBDIR})
  60. find_library(KALMAN NAMES Kalman PATHS $ENV{FAIRLIBDIR})
  61. find_library(CLUSTER NAMES Cluster PATHS $ENV{FAIRLIBDIR})
  62. find_library(TPC NAMES tpc PATHS $ENV{FAIRLIBDIR})
  63. find_library(TOF NAMES Tof PATHS $ENV{FAIRLIBDIR})
  64. find_library(ETOF NAMES Etof PATHS $ENV{FAIRLIBDIR})
  65. # find_library(STRAWENDCAP NAMES Strawendcap PATHS $ENV{FAIRLIBDIR})
  66. find_library(ZDC NAMES Zdc PATHS $ENV{FAIRLIBDIR})
  67. find_library(FFD NAMES Ffd PATHS $ENV{FAIRLIBDIR})
  68. find_library(CPC NAMES Cpc PATHS $ENV{FAIRLIBDIR})
  69. # find_library(STRAWECT NAMES StrawECT PATHS $ENV{FAIRLIBDIR})
  70. # find_library(LHETRACK NAMES LHETrack PATHS $ENV{FAIRLIBDIR})
  71. find_library(STS NAMES Sts PATHS $ENV{FAIRLIBDIR})
  72. find_library(MPDPID NAMES MpdPid PATHS $ENV{FAIRLIBDIR})
  73. #---Get all needed libraries together
  74. if(MCSTACK)
  75. set(MPD_AT_CONVERTER_INCLUDE_LIBRARIES
  76. ${AnalysisTree} ${ROOT_LIBRARIES} ${BASE}
  77. ${MCSTACK} ${PASSIVE} ${KALMAN} ${CLUSTER} ${TPC} ${STS} ${ZDC} ${FFD}
  78. # ${STRAWECT} ${STRAWENDCAP}
  79. # ${LHETRACK}
  80. ${TOF}
  81. ${TOF}
  82. ${MPDFIELD}
  83. ${MPDBASE}
  84. # ${MPDDST}
  85. ${MPDGENERALGENERATOR}
  86. ${MPDPID}
  87. )
  88. elseif(MPDMCSTACK)
  89. set(MPD_AT_CONVERTER_INCLUDE_LIBRARIES
  90. ${AnalysisTree} ${ROOT_LIBRARIES} ${BASE}
  91. ${MPDMCSTACK} ${PASSIVE} ${KALMAN} ${CLUSTER} ${TPC} ${STS} ${ZDC} ${FFD}
  92. # # ${STRAWECT} ${STRAWENDCAP}
  93. # ${LHETRACK}
  94. ${TOF}
  95. ${MPDFIELD}
  96. ${MPDBASE}
  97. # ${MPDDST}
  98. ${MPDGENERALGENERATOR}
  99. ${MPDPID}
  100. )
  101. elseif()
  102. message(FATAL_ERROR "No MCSTACK nor MPDMCSTACK libraries was found!")
  103. endif()
  104. #---Compile converter's executable file
  105. add_executable(MpdDst2AnalysisTree "${CMAKE_CURRENT_SOURCE_DIR}/MpdDstAnalysisTree.cpp")
  106. #target_include_directories(MpdDst2AnalysisTree PUBLIC ${MPD_AT_CONVERTER_INCLUDE_DIRECTORIES})
  107. target_link_libraries(MpdDst2AnalysisTree ${MPD_AT_CONVERTER_INCLUDE_LIBRARIES})
  108. # #---Compile dca getter's executable file
  109. # add_executable(get-dca "${CMAKE_CURRENT_SOURCE_DIR}/get-dca.cpp")
  110. # target_link_libraries(get-dca ${AnalysisTree} ${ROOT_LIBRARIES})