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