]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/TPCbase/CMakeLists.txt
Fixes for object target dependencies
[u/mrichter/AliRoot.git] / TPC / TPCbase / 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 TPCbase)
18
19 # Module include folder
20 include_directories(${AliRoot_SOURCE_DIR}/TPC/${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/dateStream
27                     ${AliRoot_SOURCE_DIR}/STEER/CDB
28                     ${AliRoot_SOURCE_DIR}/STEER/ESD
29                     ${AliRoot_SOURCE_DIR}/STEER/STEER
30                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
31                     ${CMAKE_BINARY_DIR}/version
32                    )
33
34 # Sources in alphabetical order
35 set(SRCS
36     AliClusters.cxx
37     AliComplexCluster.cxx
38     AliDetectorParam.cxx
39     AliDigitsArray.cxx
40     AliDigits.cxx
41     AliH2F.cxx
42     AliSegmentArray.cxx
43     AliSegmentID.cxx
44     AliSimDigits.cxx
45     AliTPCAltroMapping.cxx
46     AliTPCBoundaryVoltError.cxx
47     AliTPCCalibCE.cxx
48     AliTPCcalibDB.cxx
49     AliTPCcalibDButil.cxx
50     AliTPCCalibGlobalMisalignment.cxx
51     AliTPCCalibPedestal.cxx
52     AliTPCCalibPulser.cxx
53     AliTPCCalibRawBase.cxx
54     AliTPCCalibRaw.cxx
55     AliTPCCalibVdrift.cxx
56     AliTPCCalibViewer.cxx
57     AliTPCCalibViewerGUI.cxx
58     AliTPCCalibViewerGUItime.cxx
59     AliTPCCalPad.cxx
60     AliTPCCalROC.cxx
61     AliTPCclusterInfo.cxx
62     AliTPCclusterMI.cxx
63     AliTPCClusterParam.cxx
64     AliTPCClustersRow.cxx
65     AliTPCComposedCorrection.cxx
66     AliTPCConfigDA.cxx
67     AliTPCConfigParser.cxx
68     AliTPCCorrection.cxx
69     AliTPCCorrectionDrift.cxx
70     AliTPCCorrectionLookupTable.cxx
71     AliTPCdataQA.cxx
72     AliTPCDigitsArray.cxx
73     AliTPCExBBShape.cxx
74     AliTPCExB.cxx
75     AliTPCExBEffective.cxx
76     AliTPCExBEffectiveSector.cxx
77     AliTPCExBExact.cxx
78     AliTPCExBFirst.cxx
79     AliTPCExBTwist.cxx
80     AliTPCFCVoltError3D.cxx
81     AliTPCGGVoltError.cxx
82     AliTPCInverseCorrection.cxx
83     AliTPCLaserTrack.cxx
84     AliTPCLoader.cxx
85     AliTPCmapper.cxx
86     AliTPCParam.cxx
87     AliTPCParamSR.cxx
88     AliTPCPointCorrection.cxx
89     AliTPCPreprocessor.cxx
90     AliTPCPreprocessorOnline.cxx
91     AliTPCPRF2D.cxx
92     AliTPCQAChecker.cxx
93     AliTPCQADataMakerRec.cxx
94     AliTPCRawStreamV3.cxx
95     AliTPCRecoParam.cxx
96     AliTPCRF1D.cxx
97     AliTPCROC.cxx
98     AliTPCROCVoltError3D.cxx
99     AliTPCSensorTempArray.cxx
100     AliTPCSensorTemp.cxx
101     AliTPCSpaceCharge3D.cxx
102     AliTPCSpaceCharge.cxx
103     AliTPCTempMap.cxx
104     AliTPCTransform.cxx
105     AliTransform.cxx
106     AliXRDPROOFtoolkit.cxx
107    )
108
109 # Headers from sources
110 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
111
112 # Generate the dictionary
113 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
114 get_directory_property(incdirs INCLUDE_DIRECTORIES)
115 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
116
117 set(ROOT_DEPENDENCIES Core EG GenVector Geom Gpad Graf Gui Hist MathCore Matrix Minuit Physics Proof RIO Spectrum Tree)
118 set(ALIROOT_DEPENDENCIES STEERBase STEER CDB ESD RAWDatabase RAWDatarec)
119
120 # Generate the ROOT map
121 # Dependecies
122 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
123 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
124
125 # Create an object to be reused in case of static libraries 
126 # Otherwise the sources will be compiled twice
127 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
128 # Follow headers dependencies
129 add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
130 # Add a library to the project using the object
131 add_library(${MODULE} SHARED $<TARGET_OBJECTS:TPCbase-object>)
132
133 # Linking
134 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
135
136 # Setting the correct headers for the object as gathered from the dependencies
137 target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
138 set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
139
140 # Public include folders that will be propagated to the dependecies
141 target_include_directories(${MODULE} PUBLIC ${incdirs})
142
143 # Additional compilation flags
144 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "")
145
146 # System dependent: Modify the way the library is build
147 if(${CMAKE_SYSTEM} MATCHES Darwin)
148     set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
149 endif(${CMAKE_SYSTEM} MATCHES Darwin)
150
151 # Installation
152 install(TARGETS ${MODULE}
153         ARCHIVE DESTINATION lib
154         LIBRARY DESTINATION lib)
155
156 install(FILES ${HDRS} DESTINATION include)
157
158 # Static version if DA enabled
159 if(ALIROOT_STATIC)
160     add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:TPCbase-object>)
161     set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
162
163     # list of shared dependencies / the name of the variable containing the list of static ones
164     generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
165     target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root RootExtra)
166     
167     # Public include folders that will be propagated to the dependecies
168     target_include_directories(${MODULE}-static PUBLIC ${incdirs})
169     
170     set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
171
172     # Installation
173     install(TARGETS ${MODULE}-static
174             ARCHIVE DESTINATION lib
175             LIBRARY DESTINATION lib)
176 endif(ALIROOT_STATIC)