MUON DAs
[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
95# Additional compilation flags
96set(TARGETFLAGS "-g")
97
98# Optimize
99if(CMAKE_COMPILER_IS_GNUCXX)
100 if(GCC_MAJOR STREQUAL "4")
101 if(GCC_MINOR STREQUAL "3")
102 set(TARGETFLAGS "${TARGETFLAGS} -O0")
103 else()
104 set(TARGETFLAGS "${TARGETFLAGS} -O")
105 endif()
106 endif()
107endif()
108
c55bd1a6 109set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "-fPIC ${TARGETFLAGS}")
b22a7396 110
111# System dependent: Modify the way the library is build
112if(${CMAKE_SYSTEM} MATCHES Darwin)
113 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
114endif(${CMAKE_SYSTEM} MATCHES Darwin)
115
116# Installation
117install(TARGETS ${MODULE}
118 ARCHIVE DESTINATION lib
119 LIBRARY DESTINATION lib)
120
c55bd1a6 121install(FILES ${HDRS} DESTINATION include)
122
123# Static version if DA enabled
124if(ALIROOT_STATIC)
125 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:MUONsim-object>)
126 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
127
128 # list of shared dependencies / the name of the variable containing the list of static ones
129 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
130 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
131 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
132
133 # Installation
134 install(TARGETS ${MODULE}-static
135 ARCHIVE DESTINATION lib
136 LIBRARY DESTINATION lib)
137endif(ALIROOT_STATIC)