]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSrec/CMakeLists.txt
Fixes for object target dependencies
[u/mrichter/AliRoot.git] / ITS / ITSrec / 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 ITSrec)
18
19 # Module include folder
20 include_directories(${AliRoot_SOURCE_DIR}/ITS/${MODULE})
21
22 # Additional include folders in alphabetical order except ROOT
23 include_directories(${ROOT_INCLUDE_DIRS}
24                     ${AliRoot_SOURCE_DIR}/ITS/ITSbase
25                     ${AliRoot_SOURCE_DIR}/ITS/ITSsim
26                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
27                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
28                     ${AliRoot_SOURCE_DIR}/STEER/CDB
29                     ${AliRoot_SOURCE_DIR}/STEER/ESD
30                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
31                     ${AliRoot_SOURCE_DIR}/STEER/STEER
32                    )
33
34 # Sources in alphabetical order
35 set(SRCS
36     AliITSAlignMille2Constraint.cxx
37     AliITSAlignMille2ConstrArray.cxx
38     AliITSAlignMille2.cxx
39     AliITSAlignMille2Module.cxx
40     AliITSAlignMille.cxx
41     AliITSAlignMilleData.cxx
42     AliITSAlignMilleModule.cxx
43     AliITSBadChannelsAuxSPD.cxx
44     AliITSBadChannelsSPD.cxx
45     AliITSChannelSPD.cxx
46     AliITSclustererV2.cxx
47     AliITSCorrectSDDPoints.cxx
48     AliITSdEdxAnalyzer.cxx
49     AliITSIOTrack.cxx
50     AliITSMeanVertexer.cxx
51     AliITSOnlineCalibrationSPD.cxx
52     AliITSOnlineCalibrationSPDhandler.cxx
53     AliITSOnlineSDDBase.cxx
54     AliITSOnlineSDDCMN.cxx
55     AliITSOnlineSDD.cxx
56     AliITSOnlineSDDInjectors.cxx
57     AliITSOnlineSDDTP.cxx
58     AliITSOnlineSPDfoAnalyzer.cxx
59     AliITSOnlineSPDfoChipConfig.cxx
60     AliITSOnlineSPDfoChip.cxx
61     AliITSOnlineSPDfo.cxx
62     AliITSOnlineSPDfoInfo.cxx
63     AliITSOnlineSPDHitArray.cxx
64     AliITSOnlineSPDHitEvent.cxx
65     AliITSOnlineSPDphysAnalyzer.cxx
66     AliITSOnlineSPDphys.cxx
67     AliITSOnlineSPDphysInfo.cxx
68     AliITSOnlineSPDscanAnalyzer.cxx
69     AliITSOnlineSPDscan.cxx
70     AliITSOnlineSPDscanInfo.cxx
71     AliITSOnlineSPDscanInfoMeanTh.cxx
72     AliITSOnlineSPDscanInfoMultiple.cxx
73     AliITSOnlineSPDscanMeanTh.cxx
74     AliITSOnlineSPDscanMultiple.cxx
75     AliITSOnlineSPDscanSingle.cxx
76     AliITSPreprocessorSDD.cxx
77     AliITSPreprocessorSPD.cxx
78     AliITSPreprocessorSSD.cxx
79     AliITSQASSDRefData.cxx
80     AliITSRad.cxx
81     AliITSRealignTracks.cxx
82     AliITSreconstruction.cxx
83     AliITSSumTP.cxx
84     AliITSTPArrayFit.cxx
85     AliITSVertexer3DTapan.cxx
86    )
87
88 # Headers from sources
89 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
90
91 # Generate the dictionary
92 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
93 get_directory_property(incdirs INCLUDE_DIRECTORIES)
94 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
95
96 set(ROOT_DEPENDECIES Core EG Geom Gpad Graf Hist MathCore Matrix Net RIO Tree)
97 set(ALIROOT_DEPENDENCIES CDB ESD STEERBase STEER ITSbase ITSsim RAWDatabase RAWDatarec)
98
99 # Generate the ROOT map
100 # Dependecies
101 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDECIES})
102 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
103
104 # Create an object to be reused in case of static libraries 
105 # Otherwise the sources will be compiled twice
106 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
107 # Add a library to the project using the object
108 add_library(${MODULE} SHARED $<TARGET_OBJECTS:${MODULE}-object>)
109
110 # Setting the correct headers for the object as gathered from the dependencies
111 target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
112 set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
113
114 # Linking library
115 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
116
117 # Additional compilation flags
118 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS " ")
119
120 # System dependent: Modify the way the library is build
121 if(${CMAKE_SYSTEM} MATCHES Darwin)
122     set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
123 endif(${CMAKE_SYSTEM} MATCHES Darwin)
124
125 # Installation
126 install(TARGETS ${MODULE}
127         ARCHIVE DESTINATION lib
128         LIBRARY DESTINATION lib)
129
130 install(FILES ${HDRS} DESTINATION include)
131
132 # Static version if DA enabled
133 if(ALIROOT_STATIC)
134     add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:${MODULE}-object>)
135     set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
136
137     # list of shared dependencies / the name of the variable containing the list of static ones
138     generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
139     target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
140     
141     # Public include folders that will be propagated to the dependecies
142     target_include_directories(${MODULE}-static PUBLIC ${incdirs})
143
144     set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
145
146     # Installation
147     install(TARGETS ${MODULE}-static
148             ARCHIVE DESTINATION lib
149             LIBRARY DESTINATION lib)
150 endif(ALIROOT_STATIC)