added settings for magnetic field
[u/mrichter/AliRoot.git] / CMakeLists.txt
1 # Top level CMakeList.txt file for the AliRoot Build System
2 #
3 # Author: Johny Jose (johny.jose@cern.ch)
4 #         Port of previous Makefile build to cmake
5
6
7 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
8
9 #--------------------------------------------------------------------------------#
10 # Set Basic CMake Configuration                                                  #
11 #--------------------------------------------------------------------------------#
12
13 project(AliRoot CXX C Fortran)
14 set(ALICE_ROOT $ENV{ALICE_ROOT})
15 set(ALICE $ENV{ALICE})
16
17 if(NOT ALICE)
18   message(WARNING "Environment variable ALICE is not set")
19 endif(NOT ALICE)
20
21 if(NOT ALICE_ROOT)
22   message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
23 endif(NOT ALICE_ROOT)
24
25 # Set AliRoot Installation directory 
26 if(NOT ALICE_INSTALL)
27   message(STATUS "AliRoot files will be installed in ${ALICE_ROOT}. You can specify a different location by setting ALICE_INSTALL environment variable")
28   set(ALICE_INSTALL ${ALICE_ROOT})
29 else()
30   message(STATUS "AliRoot files will be installed in ${ALICE_INSTALL}")
31 endif(NOT ALICE_INSTALL)
32
33 get_filename_component(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
34 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
35 set(CPACK_COMPONENTS_ALL MDC)
36
37 include(ALICE_CMake)
38
39 #--------------------------------------------------------------------------------#
40 # Find Packages                                                                  #
41 #--------------------------------------------------------------------------------#
42
43 # Subversion
44 # ------------------------------
45
46 find_package(Subversion REQUIRED)
47
48 # ROOT
49 # ------------------------------
50
51 find_package(ROOT REQUIRED)
52
53 # IRST Rule Checker 
54 # ------------------------------
55
56 find_package(RuleChecker)
57
58 # DATE
59 # ------------------------------ 
60
61 find_package(DATE)
62
63 # GEANT3
64 # ------------------------------
65
66 find_package(GEANT3)
67
68 # AMORE
69 # ------------------------------
70
71 find_package(AMORE)
72
73 # AliRoot CPack configuration                                                    
74 #-------------------------------
75
76 find_package(CPack)
77
78
79 #--------------------------------------------------------------------------------#
80 # Environment/Compiler Configuration                                             #
81 #--------------------------------------------------------------------------------#
82
83 ALICE_CheckOutOfSourceBuild()
84 ALICE_RootConfig(CMAKE_CXX_COMPILER --cxx)
85 ALICE_RootConfig(CMAKE_C_COMPILER --cc)
86 ALICE_RootConfig(CMAKE_Fortran_COMPILER --f77)
87 ALICE_ConfigurePlatform()
88 ALICE_ConfigureCompiler()
89
90
91 #--------------------------------------------------------------------------------#
92 # AliRoot Path Settings                                                          #
93 #--------------------------------------------------------------------------------#
94
95 ALICE_DevFlagsOutput()
96 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}")
97 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
98 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
99 set(CMAKE_INCLUDE_EXPORT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
100 file(MAKE_DIRECTORY ${CMAKE_INCLUDE_EXPORT_DIRECTORY})
101 set(EXPORTDIRS "${ALICE_INSTALL}/include")
102 set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
103
104
105 #--------------------------------------------------------------------------------#
106 # AliRoot Modules                                                                #
107 #--------------------------------------------------------------------------------#
108
109 # Exclude Module from all target
110 # ------------------------------
111
112 #set(EXCLUDEMODULES THydjet SHUTTLE)
113
114
115 # Standard Modules
116 # ------------------------------
117 set(ALIROOTMODULES STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS ACORDE HMPID T0 BCM STRUCT VZERO THijing THbtp EMCAL THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS JETAN HLT LHC ESDCheck STAT TTherminator CORRFW DPMJET TDPMjet PWG0 PWG1 PWG2 PWG3 PWG4 TRIGGER PYTHIA8 TAmpt )
118
119 if(THydjet)
120   list(APPEND ALIROOTMODULES THydjet)
121 endif(THydjet)
122
123 if(SHUTTLE)
124   list(APPEND ALIROOTMODULES SHUTTLE)
125 endif(SHUTTLE)
126
127 # Additional Modules
128 # ------------------------------
129 list(APPEND ALIROOTMODULES TUHKMgen EPOS)
130
131 # EVE
132 # ------------------------------
133 ALICE_RootConfig(EVE --has-opengl)
134 if(NOT EVE STREQUAL "no")
135   list(APPEND ALIROOTMODULES EVE)
136 endif(NOT EVE STREQUAL "no")
137
138 # CERN Modules
139 # ------------------------------
140 set(CERNMODULES LHAPDF HIJING MICROCERN HERWIG)
141
142 # Check for Pythia 6
143 if(EXISTS ${ROOTINCDIR}/TPythia6.h)
144   set(PYTHIA6 TRUE)
145   list(APPEND CERNMODULES PYTHIA6 RALICE EVGEN)
146 elseif(NOT NOPYTHIA)
147   message(FATAL_ERROR "ROOT must have Pythia6 enabled !")
148 endif(EXISTS ${ROOTINCDIR}/TPythia6.h)
149
150 # Set Final list of modules 
151 set(MODULES ${ALIROOTMODULES} ${CERNMODULES} ALIROOT)
152
153 # Set Module directories
154 set(MODDIRS ${MODULES})
155
156 # Libraries for Linking
157 # ------------------------------
158 set(ALILIBS MUON TPC PMD TRD FMD TOF ITS PHOS ACORDE HMPID VZERO ZDC STRUCT T0 EVGEN STEER TRIGGER)
159 set(LIBS ${ROOTCLIBS} ${ROOTPLIBS} ${SYSLIBS})
160
161 # Configure ARVerion.h
162 # ------------------------------
163 if(Subversion_FOUND)
164   Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
165   set(ALIROOT_SVN_REVISION ${PROJECT_WC_REVISION})
166   set(ALIROOT_SVN_BRANCH ${PROJECT_WC_URL})
167   string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
168   message(STATUS "Aliroot Revision - ${ALIROOT_SVN_REVISION} Branch - ${ALIROOT_SVN_BRANCH}")
169   if(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
170     file(REMOVE ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
171   endif(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
172   configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h @ONLY)
173 endif(Subversion_FOUND)
174
175 #--------------------------------------------------------------------------------#
176 # Build Modules                                                                  #
177 #--------------------------------------------------------------------------------#
178
179 # Module Variables
180 # ------------------------------
181 set(ALLLIBS)
182 set(ALLEXECS)
183 set(INCLUDEFILES)
184 set(BINLIBS)
185 set(EXPORTFILES)
186
187 # Top Level Build Targets
188 # ------------------------------
189
190 add_custom_target(alilibs-static)
191 add_custom_target(include-headers)
192 add_custom_target(DA-all)
193 add_custom_target(check-all)
194 add_custom_target(par-all)
195 add_custom_target(test-par-all)
196
197 # Add Modules
198 # ------------------------------
199 foreach(MODULE ${MODDIRS})
200   set(${MODULE}ALIBS)
201   configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
202   add_custom_target(${MODULE}-all ALL)
203   add_custom_target(${MODULE}-check-all)
204   add_custom_target(${MODULE}-par-all)
205   add_custom_target(test-${MODULE}-par-all)
206   add_dependencies(check-all "${MODULE}-check-all")
207   add_custom_target(${MODULE}-all-static)
208   add_dependencies(alilibs-static "${MODULE}-static")
209   add_subdirectory(${MODULE})
210 endforeach(MODULE)
211
212 if(DATE_FOUND AND AMORE_FOUND)
213   include (CMakeDA)
214 endif(DATE_FOUND AND AMORE_FOUND)
215
216 #--------------------------------------------------------------------------------#
217 # Additional Targets                                                             #
218 #--------------------------------------------------------------------------------#
219
220 # AliMdc RPM
221 # ------------------------------
222
223 include (InstallRequiredSystemLibraries)
224 include (CPack)
225