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