]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/CMakeLists.txt
adding cmake option HLT_COMPONENT_STATISTICS to enable build with the HLT component...
[u/mrichter/AliRoot.git] / HLT / BASE / 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 # HLTbase + subfolders (end of the cmake file)
17 # Subfolders have to be includes at the begining otherwise
18 # they will inherit properties from the parent
19 add_subdirectory(HOMER)
20 add_subdirectory(interface)
21 add_subdirectory(util)
22
23 # Module
24 set(MODULE HLTbase)
25
26 # Module include folder
27 include_directories(${ROOT_INCLUDE_DIR}
28                               ${AliRoot_SOURCE_DIR}/HLT/BASE
29                    )
30
31 # Additional include folders in alphabetical order except ROOT
32 include_directories(
33                     ${AliRoot_SOURCE_DIR}/HLT/BASE/HOMER
34                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
35                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
36                    )
37
38 option(USE_DLOPEN "Use \"dlopen()\" in favor of \"gSystem->Load()\" to load HLT component libraries." OFF)
39
40 if(USE_DLOPEN)
41   add_definitions(-DHAVE_DLFCN_H)
42   message(STATUS "Using dlopen() for HLT component libs.")
43 endif(USE_DLOPEN)
44
45 option(HLT_COMPONENT_STATISTICS "Build HLT component statistics" OFF)
46
47 if(HLT_COMPONENT_STATISTICS)
48   add_definitions(-DHLT_COMPONENT_STATISTICS)
49   message(STATUS "HLT component statistics enabled.")
50 endif(HLT_COMPONENT_STATISTICS)
51
52 # Sources in alphabetical order
53 set(SRCS
54     AliHLTBlockDataCollection.cxx
55     AliHLTCalibrationProcessor.cxx
56     AliHLT_C_Component_WrapperInterface.cxx
57     AliHLT_C_Component_WrapperInterface.cxx
58     AliHLTComponentBenchmark.cxx
59     AliHLTComponentConfiguration.cxx
60     AliHLTComponent.cxx
61     AliHLTComponentHandler.cxx
62     AliHLTConfiguration.cxx
63     AliHLTConfigurationHandler.cxx
64     AliHLTConsumerDescriptor.cxx
65     AliHLTControlTask.cxx
66     AliHLTCTPData.cxx
67     AliHLTDAQ.cxx
68     AliHLTDataBuffer.cxx
69     AliHLTDataDeflater.cxx
70     AliHLTDataDeflaterHuffman.cxx
71     AliHLTDataDeflaterSimple.cxx
72     AliHLTDataInflater.cxx
73     AliHLTDataInflaterHuffman.cxx
74     AliHLTDataInflaterSimple.cxx
75     AliHLTDataSink.cxx
76     AliHLTDataSource.cxx
77     AliHLTDataTypes.cxx
78     AliHLTDataTypes.cxx
79     AliHLTDimServer.cxx
80     AliHLTDomainEntry.cxx
81     AliHLTDumpTask.cxx
82     AliHLTErrorGuard.cxx
83     AliHLTEsdManager.cxx
84     AliHLTEventStatistics.cxx
85     AliHLTGlobalTriggerDecision.cxx
86     AliHLTHOMERBlockDesc.cxx
87     AliHLTHOMERLibManager.cxx
88     AliHLTHOMERManager.cxx
89     AliHLTHOMERProxyHandler.cxx
90     AliHLTHOMERSourceDesc.cxx
91     AliHLTHuffman.cxx
92     AliHLTLogging.cxx
93     AliHLTMemoryFile.cxx
94     AliHLTMessage.cxx
95     AliHLTMisc.cxx
96     AliHLTModuleAgent.cxx
97     AliHLTModulePreprocessor.cxx
98     AliHLTOfflineDataSource.cxx
99     AliHLTOfflineInterface.cxx
100     AliHLTOnlineConfiguration.cxx
101     AliHLTOUT.cxx
102     AliHLTOUTComponent.cxx
103     AliHLTOUTHandlerChain.cxx
104     AliHLTOUTHandlerDetectorDDL.cxx
105     AliHLTOUTHandlerEquId.cxx
106     AliHLTOUTHandlerEsdBranch.cxx
107     AliHLTOUTHandler.cxx
108     AliHLTOUTHandlerIgnore.cxx
109     AliHLTOUTHomerBuffer.cxx
110     AliHLTOUTTask.cxx
111     AliHLTPluginBase.cxx
112     AliHLTProcessor.cxx
113     AliHLTReadoutList.cxx
114     AliHLTReconstructorBase.cxx
115     AliHLTRunStatistics.cxx
116     AliHLTScalars.cxx
117     AliHLTShuttleInterface.cxx
118     AliHLTSpacePointContainer.cxx
119     AliHLTSystem.cxx
120     AliHLTTask.cxx
121     AliHLTTrackGeometry.cxx
122     AliHLTTriggerDecision.cxx
123     AliHLTTriggerDomain.cxx
124     AliHLTTriggerMenu.cxx
125     AliHLTTriggerMenuItem.cxx
126     AliHLTTriggerMenuSymbol.cxx
127     AliHLTTTreeProcessor.cxx
128    )
129
130 # Headers from sources
131 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
132 set(HDRS ${HDRS}
133     AliHLTCommonCDBEntries.h
134     AliHLTDefinitions.h
135     AliHLTExternalTrackParam.h
136     AliHLTLoggingVariadicFree.h
137     AliHLTStdIncludes.h
138    )
139
140 # Generate the dictionary
141 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
142 get_directory_property(incdirs INCLUDE_DIRECTORIES)
143 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
144
145 set(ROOT_DEPENDENCIES Core Geom Graf Hist MathCore Net RIO Tree XMLParser)
146 set(ALIROOT_DEPENDENCIES STEERBase RAWDatabase AliHLTHOMER)
147 # Generate the ROOT map
148 # Dependecies
149 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
150 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
151
152 # Create an object to be reused in case of static libraries 
153 # Otherwise the sources will be compiled twice
154 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
155 # Follow headers dependencies
156 add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
157 # Add a library to the project using the object
158 add_library(${MODULE} SHARED $<TARGET_OBJECTS:HLTbase-object>)
159 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
160
161 # Additional compilation flags
162 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS " ")
163
164 # System dependent: Modify the way the library is build
165 if(${CMAKE_SYSTEM} MATCHES Darwin)
166     set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
167 endif(${CMAKE_SYSTEM} MATCHES Darwin)
168
169 # Installation
170 install(TARGETS ${MODULE}
171         ARCHIVE DESTINATION lib
172         LIBRARY DESTINATION lib)
173
174 install(FILES ${HDRS} AliHLTIndexGrid.h DESTINATION include)
175
176 # Static version if DA enabled
177 if(ALIROOT_STATIC)
178     add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:HLTbase-object>)
179     set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
180     target_link_libraries(${MODULE}-static STEERBase-static RAWDatabase-static AliHLTHOMER-static Root RootExtra)
181     set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
182     
183     # Installation
184     install(TARGETS ${MODULE}-static
185             ARCHIVE DESTINATION lib
186             LIBRARY DESTINATION lib)
187 endif(ALIROOT_STATIC)