Added new classes for CPV raw data reconstruction
[u/mrichter/AliRoot.git] / PHOS / PHOSbase / 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 PHOSbase)
18
19 # Module include folder
20 include_directories(${AliRoot_SOURCE_DIR}/PHOS/${MODULE})
21
22 # Additional include folders in alphabetical order except ROOT
23 include_directories(${ROOT_INCLUDE_DIRS}
24                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
25                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
26                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatasim
27                     ${AliRoot_SOURCE_DIR}/PHOS/PHOSUtils
28                     ${AliRoot_SOURCE_DIR}/STEER/CDB
29                     ${AliRoot_SOURCE_DIR}/STEER/ESD
30                     ${AliRoot_SOURCE_DIR}/STEER/STEER
31                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
32                    )
33
34 # Sources in alphabetical order
35 set(SRCS
36     AliPHOS.cxx
37     AliPHOSCalibData.cxx
38     AliPHOSClusterizer.cxx
39     AliPHOSClusterizerv1.cxx
40     AliPHOSCpvCalibData.cxx
41     AliPHOSCpvRecPoint.cxx
42     AliPHOSCpv3GConnection.cxx
43     AliPHOSCpvParam.cxx
44     AliPHOSCpvRawStream.cxx
45     AliPHOSDigit.cxx
46     AliPHOSDigitizer.cxx
47     AliPHOSEmcBadChannelsMap.cxx
48     AliPHOSEmcCalibData.cxx
49     AliPHOSEmcRecPoint.cxx
50     AliPHOSFastRecParticle.cxx
51     AliPHOSGeometry.cxx
52     AliPHOSHit.cxx
53     AliPHOSImpact.cxx
54     AliPHOSLink.cxx
55     AliPHOSLoader.cxx
56     AliPHOSModuleMisalignment.cxx
57     AliPHOSPID.cxx
58     AliPHOSPulseGenerator.cxx
59     AliPHOSQAChecker.cxx
60     AliPHOSRawDigiProducer.cxx
61     AliPHOSRawFitterv0.cxx
62     AliPHOSRawFitterv1.cxx
63     AliPHOSRawFitterv2.cxx
64     AliPHOSRawFitterv3.cxx
65     AliPHOSRawFitterv4.cxx
66     AliPHOSRecoParam.cxx
67     AliPHOSReconstructor.cxx
68     AliPHOSRecParticle.cxx
69     AliPHOSRecPoint.cxx
70     AliPHOSPIDv1.cxx
71     AliPHOSSDigitizer.cxx
72     AliPHOSSimParam.cxx
73     AliPHOSSurvey1.cxx
74     AliPHOSSurvey.cxx
75     AliPHOSTick.cxx
76     AliPHOSTracker.cxx
77     AliPHOSTrackSegment.cxx
78     AliPHOSTrackSegmentMaker.cxx
79     AliPHOSTrackSegmentMakerv1.cxx
80     AliPHOSTrigger.cxx
81     AliPHOSTriggerParameters.cxx
82     AliPHOSTriggerRawDigit.cxx
83     AliPHOSTriggerRawDigiProducer.cxx
84     AliPHOSTriggerRawReader.cxx
85     AliPHOSTRURawReader.cxx
86
87    )
88
89 # Headers from sources
90 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
91
92 # Generate the dictionary
93 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
94 get_directory_property(incdirs INCLUDE_DIRECTORIES)
95 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
96
97 set(ROOT_DEPENDENCIES Core EG Geom Gpad Graf Hist MathCore Matrix Minuit Physics RIO Tree VMC)
98 set(ALIROOT_DEPENDENCIES STEERBase STEER CDB ESD RAWDatabase RAWDatarec RAWDatasim PHOSUtils)
99
100 # Generate the ROOT map
101 # Dependecies
102 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
103 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
104
105 # Create an object to be reused in case of static libraries 
106 # Otherwise the sources will be compiled twice
107 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
108 # Follow headers dependencies
109 add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
110 # Add a library to the project using the object
111 add_library(${MODULE} SHARED $<TARGET_OBJECTS:PHOSbase-object>)
112
113 # Linking
114 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
115
116 # Setting the correct headers for the object as gathered from the dependencies
117 target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
118 set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
119
120 # Additional compilation flags
121 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS " ")
122
123 # System dependent: Modify the way the library is build
124 if(${CMAKE_SYSTEM} MATCHES Darwin)
125     set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
126 endif(${CMAKE_SYSTEM} MATCHES Darwin)
127
128 # Installation
129 install(TARGETS ${MODULE}
130         ARCHIVE DESTINATION lib
131         LIBRARY DESTINATION lib)
132
133 install(FILES ${HDRS} DESTINATION include)
134
135 # Static version if DA enabled
136 if(ALIROOT_STATIC)
137     add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:PHOSbase-object>)
138     set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
139
140     # list of shared dependencies / the name of the variable containing the list of static ones
141     generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
142     target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
143
144     # Public include folders that will be propagated to the dependecies
145     target_include_directories(${MODULE}-static PUBLIC ${incdirs})
146
147     set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
148
149     # Installation
150     install(TARGETS ${MODULE}-static
151             ARCHIVE DESTINATION lib
152             LIBRARY DESTINATION lib)
153 endif(ALIROOT_STATIC)