VZERO DAs + Object target dependencies
[u/mrichter/AliRoot.git] / STEER / AOD / CMakeLists.txt
CommitLineData
e9e48ff1 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
17set (MODULE AOD)
18
19# Module include folders
427d561c 20include_directories(${AliRoot_SOURCE_DIR}/STEER/${MODULE})
e9e48ff1 21
22# Additional include directories - alphabetical order except ROOT
22f3e2f8 23include_directories(${ROOT_INCLUDE_DIRS}
427d561c 24 ${AliRoot_SOURCE_DIR}/STEER/ESD
25 ${AliRoot_SOURCE_DIR}/STEER/STEERBase
e9e48ff1 26 )
27
28# Sources - alphabetical order
29set(SRCS
30 AliAODBranchReplicator.cxx
31 AliAODCaloCells.cxx
32 AliAODCaloCluster.cxx
33 AliAODCaloTrigger.cxx
34 AliAODcascade.cxx
35 AliAODCluster.cxx
36 AliAODDiJet.cxx
37 AliAODDimuon.cxx
38 AliAODEvent.cxx
39 AliAODExtension.cxx
40 AliAODFmdCluster.cxx
41 AliAODHandler.cxx
42 AliAODHeader.cxx
43 AliAODHMPIDrings.cxx
44 AliAODInputHandler.cxx
45 AliAODJet.cxx
46 AliAODJetEventBackground.cxx
47 AliAODMCHeader.cxx
48 AliAODMCParticle.cxx
49 AliAODPhoton.cxx
50 AliAODPid.cxx
51 AliAODpidUtil.cxx
52 AliAODPmdCluster.cxx
53 AliAODPWG4ParticleCorrelation.cxx
54 AliAODPWG4Particle.cxx
55 AliAODRecoDecay.cxx
56 AliAODRedCov.cxx
57 AliAODTagCreator.cxx
58 AliAODTrack.cxx
59 AliAODTracklets.cxx
60 AliAODTrdTrack.cxx
61 AliAODTrdTracklet.cxx
62 AliAODTZERO.cxx
63 AliAODv0.cxx
64 AliAODVertex.cxx
65 AliAODVZERO.cxx
66 AliAODZDC.cxx
b168bfa8 67 AliNanoAODHeader.cxx
852a1808 68 AliNanoAODStorage.cxx
7296b0da 69 AliNanoAODTrackMapping.cxx
e9e48ff1 70 )
71
72# Sources from headers
73string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
74
75# Generate the dictionary
76# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
77get_directory_property(incdirs INCLUDE_DIRECTORIES)
78generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
79
852a1808 80# ROOT and other AliRoot depencies
81# Used to create the root maps and for the actual linking
82set(ROOT_DEPENDENCIES Core EG Geom Hist MathCore Matrix Net Physics RIO Tree)
83set(ALIROOT_DEPENDENCIES ESD STEERBase)
84
0224bae4 85# Generate the ROOT map
86# Dependecies
852a1808 87set(LIBDEPS ${ROOT_DEPENDENCIES} ${ALIROOT_DEPENDENCIES})
0224bae4 88generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
89
f82bfa66 90# Create an object to be reused in case of static libraries
91# Otherwise the sources will be compiled twice
92add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
139cbc46 93# Follow headers dependencies
94add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
f82bfa66 95# Add a library to the project using the object
96add_library(${MODULE} SHARED $<TARGET_OBJECTS:AOD-object>)
97
98# library dependecies
852a1808 99target_link_libraries(${MODULE} ${ROOT_DEPENDENCIES} ${ALIROOT_DEPENDENCIES})
e9e48ff1 100
6929fcdd 101# Public include folders that will be propagated to the dependecies
102target_include_directories(${MODULE} PUBLIC ${incdirs})
103
e9e48ff1 104# Additional compilation flags
6929fcdd 105set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "-O -g")
e9e48ff1 106
107# System dependent: Modify the way the library is build
108if(${CMAKE_SYSTEM} MATCHES Darwin)
109 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
110endif(${CMAKE_SYSTEM} MATCHES Darwin)
111
112# Installation
113install(TARGETS ${MODULE}
114 ARCHIVE DESTINATION lib
115 LIBRARY DESTINATION lib)
116install(FILES ${HDRS} DESTINATION include)
f82bfa66 117
118# Static version if DA enabled
119if(ALIROOT_STATIC)
120 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:AOD-object>)
121 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
9cfdd3fd 122
123 # list of shared dependencies / the name of the variable containing the list of static ones
124 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
125
d1d7d34a 126 # Public include folders that will be propagated to the dependecies
127 target_include_directories(${MODULE}-static PUBLIC ${incdirs})
128
9cfdd3fd 129 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root RootExtra)
f82bfa66 130 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
131
132 # Installation
133 install(TARGETS ${MODULE}-static
134 ARCHIVE DESTINATION lib
135 LIBRARY DESTINATION lib)
136endif(ALIROOT_STATIC)