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