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