0d96a1a0f2e17de58d94e10d486c71952c2f2115
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / CMakeLists.txt
1 # **************************************************************************
2 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3 # *                                                                        *
4 # * Author: The ALICE Off-line Project.                                    *
5 # * Contributors are mentioned in the code where appropriate.              *
6 # *                                                                        *
7 # * Permission to use, copy, modify and distribute this software and its   *
8 # * documentation strictly for non-commercial purposes is hereby granted   *
9 # * without fee, provided that the above copyright notice appears in all   *
10 # * copies and that both the copyright notice and this permission notice   *
11 # * appear in the supporting documentation. The authors make no claims     *
12 # * about the suitability of this software for any purpose. It is          *
13 # * provided "as is" without express or implied warranty.                  *
14 # **************************************************************************
15
16 # Module
17 set(MODULE PWGGAPHOSTasks)
18
19 # Module include folder
20 include_directories(${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks
21                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/CaloCellQA
22                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/omega3pi
23                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/ClusterSelection
24                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_Correlation
25                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_embedding
26                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_EpRatio
27                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_PbPb
28                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_PbPb_MC
29                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_PbPbQA
30                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_pp_pi0
31                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_Tagging
32                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/PHOS_TriggerQA
33                     ${AliRoot_SOURCE_DIR}/PWGGA/PHOSTasks/UserTasks
34                    )
35
36 # Additional include folders in alphabetical order except ROOT
37 include_directories(${ROOT_INCLUDE_DIRS}
38                     ${AliRoot_SOURCE_DIR}/ANALYSIS/ANALYSIS
39                     ${AliRoot_SOURCE_DIR}/ANALYSIS/ANALYSISalice
40                     ${AliRoot_SOURCE_DIR}/TENDER/Tender
41                     ${AliRoot_SOURCE_DIR}/TENDER/TenderSupplies
42                     ${AliRoot_SOURCE_DIR}/EMCAL/EMCALUtils
43                     ${AliRoot_SOURCE_DIR}/PHOS/PHOSbase
44                     ${AliRoot_SOURCE_DIR}/PHOS/PHOSrec
45                     ${AliRoot_SOURCE_DIR}/PHOS/PHOSUtils
46                     ${AliRoot_SOURCE_DIR}/PWGGA/PWGGAUtils
47                     ${AliRoot_SOURCE_DIR}/STEER/AOD
48                     ${AliRoot_SOURCE_DIR}/STEER/CDB
49                     ${AliRoot_SOURCE_DIR}/STEER/ESD
50                     ${AliRoot_SOURCE_DIR}/STEER/STEER
51                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
52                    )
53
54 # Sources in alphabetical order
55 set(SRCS
56     CaloCellQA/AliAnalysisTaskCaloCellsQA.cxx
57     CaloCellQA/AliCaloCellsQA.cxx
58     ClusterSelection/AliPHOSTriggerUtils.cxx
59     omega3pi/AliAnalysisTaskOmegaPi0PiPi.cxx
60     PHOS_Correlation/AliPHOSCorrelations.cxx
61     PHOS_embedding/AliAnalysisTaskPi0DiffEfficiency.cxx
62     PHOS_embedding/AliAnalysisTaskPi0Efficiency.cxx
63     PHOS_embedding/AliPHOSEmbedding.cxx
64     PHOS_EpRatio/AliAnalysisTaskEpRatio.cxx
65     PHOS_PbPb/AliAnalysisTaskPi0Flow.cxx
66     PHOS_PbPb/AliAnalysisTaskPi0FlowMCAOD.cxx
67     PHOS_PbPb/AliAnalysisTaskPi0FlowMC.cxx
68     PHOS_PbPb/AliAnalysisTaskPi0FlowMCHijing.cxx
69     PHOS_PbPb/AliAnalysisTaskPi0FlowMCParamWeights.cxx
70     PHOS_PbPb/AliPHOSTenderTask.cxx
71     PHOS_PbPb_MC/AliPHOSHijingEfficiency.cxx
72     PHOS_PbPbQA/AliAnalysisTaskPHOSPbPbQA.cxx
73     PHOS_pp_pi0/AliAnalysisTaskPi0.cxx
74     PHOS_pp_pi0/AliCaloPhoton.cxx
75     PHOS_Tagging/AliAnalysisTaskTaggedPhotons.cxx
76     PHOS_TriggerQA/AliAnalysisTaskPHOSTriggerQA.cxx
77     UserTasks/AliAnalysisTaskSEPHOSpPbPi0.cxx
78     UserTasks/AliCaloClusterInfo.cxx
79     UserTasks/AliPHOSpPbPi0Header.cxx
80    )
81
82 # Headers from sources
83 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
84
85 # Generate the dictionary
86 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
87 get_directory_property(incdirs INCLUDE_DIRECTORIES)
88 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
89
90 set(ROOT_DEPENDENCIES Core EG Geom Gpad Hist MathCore Physics RIO Tree)
91 set(ALIROOT_DEPENDENCIES ANALYSIS ANALYSISalice AOD CDB EMCALUtils ESD PHOSbase PHOSrec PHOSUtils PWGGAUtils STEER STEERBase Tender TenderSupplies)
92
93 # Generate the ROOT map
94 # Dependecies
95 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
96 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
97
98 # Create an object to be reused in case of static libraries 
99 # Otherwise the sources will be compiled twice
100 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
101 # Add a library to the project using the object
102 add_library(${MODULE} SHARED $<TARGET_OBJECTS:${MODULE}-object>)
103 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
104
105 # Setting the correct headers for the object as gathered from the dependencies
106 target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
107 set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
108
109 # Public include folders that will be propagated to the dependecies
110 target_include_directories(${MODULE} PUBLIC ${incdirs})
111
112 set(MODULE_COMPILE_FLAGS)
113 set(MODULE_LINK_FLAGS)
114
115 if(DATE_FOUND)
116     set(MODULE_COMPILE_FLAGS "${DATE_CFLAGS}")
117     set(MODULE_LINK_FLAGS "${DATE_LDFLAGS} ${DATE_LIBS}")
118 endif(DATE_FOUND)
119
120 # Additional compilation and linking flags
121 set(MODULE_COMPILE_FLAGS " ${MODULE_COMPILE_FLAGS}")
122
123 # System dependent: Modify the way the library is build
124 if(${CMAKE_SYSTEM} MATCHES Darwin)
125     set(MODULE_LINK_FLAGS "-undefined dynamic_lookup ${MODULE_LINK_FLAGS}")
126 endif(${CMAKE_SYSTEM} MATCHES Darwin)
127
128 # Setting compilation flags for the object
129 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "${MODULE_COMPILE_FLAGS}")
130 # Setting the linking flags for the library
131 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "${MODULE_LINK_FLAGS}")
132
133 # Installation
134 install(TARGETS ${MODULE}
135         ARCHIVE DESTINATION lib
136         LIBRARY DESTINATION lib)
137
138 install(FILES ${HDRS} DESTINATION include)
139
140 # Install the macros
141 install(DIRECTORY PHOS_PbPb DESTINATION PWGGA/PHOSTasks)
142 install(DIRECTORY UserTasks/macros DESTINATION  PWGGA/PHOSTasks/UserTasks)
143 install(DIRECTORY CaloCellQA/macros DESTINATION PWGGA/PHOSTasks/CaloCellQA)
144 install(DIRECTORY PHOS_PbPbQA/macros DESTINATION PWGGA/PHOSTasks/PHOS_PbPbQA)
145 install(DIRECTORY PHOS_TriggerQA/macros DESTINATION PWGGA/PHOSTasks/PHOS_TriggerQA)
146 install(FILES PHOS_Correlation/AddTaskPi0Correlations.C DESTINATION PWGGA/PHOSTasks/PHOS_Correlation)
147 install(FILES PHOS_EpRatio/AddTaskPHOSEpRatio.C DESTINATION PWGGA/PHOSTasks/PHOS_EpRatio)
148 install(FILES PHOS_Tagging/AddTaskPHOSTagging.C DESTINATION PWGGA/PHOSTasks/PHOS_Tagging)
149