]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSsim/CMakeLists.txt
2ae05501cc56644e3c987f23b6c405d726de4459
[u/mrichter/AliRoot.git] / ITS / ITSsim / 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 # Module
17 set(MODULE ITSsim)
18
19 # Module include folder
20 include_directories(${AliRoot_SOURCE_DIR}/ITS/${MODULE})
21
22 # Additional include folders in alphabetical order except ROOT
23 include_directories(${ROOT_INCLUDE_DIRS}
24                     ${AliRoot_SOURCE_DIR}/ITS/ITSbase
25                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
26                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
27                     ${AliRoot_SOURCE_DIR}/STEER/CDB
28                     ${AliRoot_SOURCE_DIR}/STEER/ESD
29                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
30                     ${AliRoot_SOURCE_DIR}/STEER/STEER
31                    )
32
33 # Sources in alphabetical order
34 set(SRCS
35     AliITS.cxx
36     AliITSDetTypeSim.cxx
37     AliITSDigitizer.cxx
38     AliITSetfSDD.cxx
39     AliITSFOEfficiencySPDColumn.cxx
40     AliITSFOEfficiencySPD.cxx
41     AliITSFOGeneratorSPD.cxx
42     AliITSFONoiseSPD.cxx
43     AliITShit.cxx
44     AliITSmodule.cxx
45     AliITSQADataMakerSim.cxx
46     AliITSQASDDDataMakerSim.cxx
47     AliITSQASPDDataMakerSim.cxx
48     AliITSQASSDDataMakerSim.cxx
49     AliITSsDigitize.cxx
50     AliITSsimulation.cxx
51     AliITSsimulationFastPoints.cxx
52     AliITSsimulationSDD.cxx
53     AliITSsimulationSPD.cxx
54     AliITSsimulationSSD.cxx
55     AliITSSimuParam.cxx
56     AliITSTableSSD.cxx
57     AliITSTrigger.cxx
58     AliITSTriggerFOProcessor.cxx
59     AliITSv11.cxx
60     AliITSv11GeomCable.cxx
61     AliITSv11GeomCableFlat.cxx
62     AliITSv11GeomCableRound.cxx
63     AliITSv11Geometry.cxx
64     AliITSv11GeometrySDD.cxx
65     AliITSv11GeometrySPD.cxx
66     AliITSv11GeometrySSD.cxx
67     AliITSv11GeometrySupport.cxx
68    )
69
70 # Headers from sources
71 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
72
73 # Generate the dictionary
74 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
75 get_directory_property(incdirs INCLUDE_DIRECTORIES)
76 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
77
78 set(ROOT_DEPENDENCIES Core EG Geom Gpad Graf Hist MathCore Matrix Physics RIO Tree VMC)
79 set(ALIROOT_DEPENDENCIES CDB ESD STEERBase STEER ITSbase RAWDatabase RAWDatarec)
80
81 # Generate the ROOT map
82 # Dependecies
83 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
84 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
85
86
87 # Create an object to be reused in case of static libraries 
88 # Otherwise the sources will be compiled twice
89 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
90 # Add a library to the project using the object
91 add_library(${MODULE} SHARED $<TARGET_OBJECTS:ITSsim-object>)
92
93 # linking
94 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
95
96 # Additional compilation flags
97 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "-O -g -fPIC")
98
99 # System dependent: Modify the way the library is build
100 if(${CMAKE_SYSTEM} MATCHES Darwin)
101     set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
102 endif(${CMAKE_SYSTEM} MATCHES Darwin)
103
104 # Installation
105 install(TARGETS ${MODULE}
106         ARCHIVE DESTINATION lib
107         LIBRARY DESTINATION lib)
108
109 install(FILES ${HDRS} DESTINATION include)
110
111 # Static version if DA enabled
112 if(ALIROOT_STATIC)
113     add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:ITSsim-object>)
114     set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
115
116     # list of shared dependencies / the name of the variable containing the list of static ones
117     generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
118     target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
119     set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
120
121     # Installation
122     install(TARGETS ${MODULE}-static
123             ARCHIVE DESTINATION lib
124             LIBRARY DESTINATION lib)
125 endif(ALIROOT_STATIC)