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