]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONsim/CMakeLists.txt
renaming function to avoid library conflict (discovered in test/generators/TUHKMgen)
[u/mrichter/AliRoot.git] / MUON / MUONsim / CMakeLists.txt
CommitLineData
b22a7396 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 MUONsim)
18
19# Module include folder
427d561c 20include_directories(${AliRoot_SOURCE_DIR}/MUON/${MODULE})
b22a7396 21
22# Additional include folders in alphabetical order except ROOT
23include_directories(${ROOT_INCLUDE_DIRS}
427d561c 24 ${AliRoot_SOURCE_DIR}/MUON/MUONbase
25 ${AliRoot_SOURCE_DIR}/MUON/MUONcalib
26 ${AliRoot_SOURCE_DIR}/MUON/MUONcore
27 ${AliRoot_SOURCE_DIR}/MUON/MUONgeometry
28 ${AliRoot_SOURCE_DIR}/MUON/MUONmapping
29 ${AliRoot_SOURCE_DIR}/MUON/MUONraw
30 ${AliRoot_SOURCE_DIR}/MUON/MUONtrigger
31 ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
32 ${AliRoot_SOURCE_DIR}/STEER/CDB
33 ${AliRoot_SOURCE_DIR}/STEER/ESD
34 ${AliRoot_SOURCE_DIR}/STEER/STEER
35 ${AliRoot_SOURCE_DIR}/STEER/STEERBase
b22a7396 36 )
37
38# Sources in alphabetical order
39set(SRCS
40 AliMUONChamber.cxx
41 AliMUONChamberTrigger.cxx
42 AliMUONCommonGeometryBuilder.cxx
43 AliMUON.cxx
44 AliMUONDigitizerV3.cxx
45 AliMUONGainEventGenerator.cxx
46 AliMUONHit.cxx
47 AliMUONHitStoreV1.cxx
48 AliMUONMCDataInterface.cxx
49 AliMUONPedestalEventGenerator.cxx
50 AliMUONQADataMakerSim.cxx
51 AliMUONResponse.cxx
52 AliMUONResponseFactory.cxx
53 AliMUONResponseTrigger.cxx
54 AliMUONResponseTriggerV1.cxx
55 AliMUONResponseV0.cxx
56 AliMUONSDigitizerV2.cxx
57 AliMUONSlatGeometryBuilder.cxx
58 AliMUONSt1GeometryBuilder.cxx
59 AliMUONSt1GeometryBuilderV2.cxx
60 AliMUONSt1SpecialMotif.cxx
61 AliMUONSt2GeometryBuilder.cxx
62 AliMUONSt2GeometryBuilderV2.cxx
63 AliMUONTrigger.cxx
64 AliMUONTriggerGeometryBuilder.cxx
65 AliMUONv1.cxx
66 AliMUONVHitStore.cxx
67 )
68
69# Headers from sources
70string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
71
72# Generate the dictionary
73# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
74get_directory_property(incdirs INCLUDE_DIRECTORIES)
75generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
76
c55bd1a6 77# Dependencies
78set(ROOT_DEPENDENCIES Core EG Geom Hist MathCore Physics RIO Tree VMC)
79set(ALIROOT_DEPENDENCIES STEERBase STEER CDB ESD RAWDatabase MUONcore MUONbase MUONcalib MUONraw MUONgeometry MUONmapping MUONtrigger)
80
b22a7396 81# Generate the ROOT map
82# Dependecies
c55bd1a6 83set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
b22a7396 84generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
85
c55bd1a6 86# Create an object to be reused in case of static libraries
87# Otherwise the sources will be compiled twice
88add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
89# Add a library to the project using the object
90add_library(${MODULE} SHARED $<TARGET_OBJECTS:MUONsim-object>)
b22a7396 91
c55bd1a6 92# linking
93target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
b22a7396 94
68aeb13b 95# Setting the correct headers for the object as gathered from the dependencies
96target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
97set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
98
b22a7396 99# Additional compilation flags
100set(TARGETFLAGS "-g")
101
102# Optimize
103if(CMAKE_COMPILER_IS_GNUCXX)
104 if(GCC_MAJOR STREQUAL "4")
105 if(GCC_MINOR STREQUAL "3")
106 set(TARGETFLAGS "${TARGETFLAGS} -O0")
107 else()
108 set(TARGETFLAGS "${TARGETFLAGS} -O")
109 endif()
110 endif()
111endif()
112
68aeb13b 113set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS " ${TARGETFLAGS}")
b22a7396 114
115# System dependent: Modify the way the library is build
116if(${CMAKE_SYSTEM} MATCHES Darwin)
117 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
118endif(${CMAKE_SYSTEM} MATCHES Darwin)
119
120# Installation
121install(TARGETS ${MODULE}
122 ARCHIVE DESTINATION lib
123 LIBRARY DESTINATION lib)
124
c55bd1a6 125install(FILES ${HDRS} DESTINATION include)
126
127# Static version if DA enabled
128if(ALIROOT_STATIC)
129 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:MUONsim-object>)
130 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
131
132 # list of shared dependencies / the name of the variable containing the list of static ones
133 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
134 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
68aeb13b 135
136 # Public include folders that will be propagated to the dependecies
137 target_include_directories(${MODULE}-static PUBLIC ${incdirs})
138
c55bd1a6 139 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
140
141 # Installation
142 install(TARGETS ${MODULE}-static
143 ARCHIVE DESTINATION lib
144 LIBRARY DESTINATION lib)
145endif(ALIROOT_STATIC)