Update: removed request of 4 points in ITS (Renu)
[u/mrichter/AliRoot.git] / CMakeLists.txt
CommitLineData
e969a926 1# -*- mode: cmake -*-
e969a926 2
3# Check if cmake has the required version
7f40fabf 4cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
e969a926 5
6# Set name of our project to AliRoot. To be done after check of cmake version
7f40fabf 7project(AliRoot NONE)
e969a926 8
9# Set AliRoot variables
f2cec6fb 10set(CMAKE_VERBOSE_MAKEFILES OFF)
b07a2059 11#fix for MACOSX
12SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem")
13SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem")
14
3ea0d710 15set(ALICE_INSTALL $ENV{ALICE_INSTALL})
7f40fabf 16set(ALICE_ROOT $ENV{ALICE_ROOT})
7f40fabf 17set(ALICE_STATIC_BUILD OFF CACHE BOOL "Build also statics libs")
3ea0d710 18execute_process(COMMAND root-config --arch OUTPUT_VARIABLE ALICE_TARGET)
19string (REGEX REPLACE "\n" "" ALICE_TARGET ${ALICE_TARGET})
20
21if(NOT ALICE_INSTALL)
22message(FATAL_ERROR "Please set environment variable ALICE_INSTALL to the AliRoot installation directory")
23endif(NOT ALICE_INSTALL)
24if(NOT ALICE_ROOT)
25message(FATAL_ERROR "Please set environment variable ALICE_ROOT to the AliRoot source directory")
26endif(NOT ALICE_ROOT)
27
e969a926 28
7f40fabf 29message("ALICE_ROOT: ${ALICE_ROOT}")
f2cec6fb 30
e969a926 31
32# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
5a104e16 33#set(PROJECT_BINARY_DIR ${ALICE_INSTALL})
3ea0d710 34set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET})
35set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET})
7f40fabf 36set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules")
e969a926 37
f7d3fd75 38# To fix a hack that has been introduced for the Mac
7f40fabf 39if(APPLE)
40 set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
41endif(APPLE)
f7d3fd75 42
3ea0d710 43# Setup ROOT and C, C++ , Fortran Compilers
7f40fabf 44find_package(ROOT 5.0.0 REQUIRED)
7f40fabf 45set(CMAKE_C_COMPILER $ENV{CC})
46enable_language(C)
7f40fabf 47set(CMAKE_CXX_COMPILER $ENV{CXX})
48enable_language(CXX)
7f40fabf 49set(CMAKE_Fortran_COMPILER $ENV{F77})
50enable_language(Fortran)
f7d3fd75 51
e969a926 52# Load some basic macros which are needed later on
53#Include(WriteConfigFile)
3ea0d710 54
55include (CTest)
7f40fabf 56include(ALICEMacros)
e969a926 57
58# Check if the user wants to build the project in the source directory
59Check_out_of_Source_Build()
60
61# searches for needed packages
62
e969a926 63
64# Setup GEANT3
7c786cf9 65find_package(GEANT3)
e969a926 66
67# Setup RuleChecker
7f40fabf 68find_package(RuleChecker)
e969a926 69
70# Check if DATE is installed
7f40fabf 71find_package(DATE)
e969a926 72
73# Setup system dependent flags
74SetupSystem()
75
7f40fabf 76Include(CreateSubCMakeFiles)
77CreateSubCMakeFiles()
96c0c856 78
96c0c856 79
7f40fabf 80
5a104e16 81
82# Set the library version in the main CMakeLists.txt
7f40fabf 83set(ALIROOT_MAJOR_VERSION 0)
84set(ALIROOT_MINOR_VERSION 0)
85set(ALIROOT_PATCH_VERSION 0)
86set(ALIROOT_VERSION "${ALIROOT_MAJOR_VERSION}.${ALIROOT_MINOR_VERSION}.${ALIROOT_PATCH_VERSION}")
87
88set(ALIROOT_LIBRARY_PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES}
e969a926 89 VERSION "${ALIROOT_VERSION}"
90 SOVERSION "${ALIROOT_MAJOR_VERSION}"
91 SUFFIX ".so"
92)
93
94# Set version variables
7f40fabf 95find_program( READLINK_PROGRAM readlink)
6455495f 96
7f40fabf 97if(READLINK_PROGRAM)
98 execute_process(COMMAND readlink -f ${ALICE_ROOT}
6455495f 99 COMMAND xargs svn info
100 OUTPUT_VARIABLE _svn_out)
7f40fabf 101else(READLINK_PROGRAM)
102 execute_process(COMMAND svn info ${ALICE_ROOT}
6455495f 103 OUTPUT_VARIABLE _svn_out)
7f40fabf 104endif(READLINK_PROGRAM)
e969a926 105
7f40fabf 106string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1"
e969a926 107 ALIROOT_SVN_REVISION ${_svn_out})
7f40fabf 108string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1"
e969a926 109 ALIROOT_SVN_BRANCH ${_svn_out})
7f40fabf 110string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
111
e969a926 112
113# Additional targets
7f40fabf 114add_custom_target(check-all COMMENT "Checking coding conventions")
115message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}")
116message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}")
117
118# Delete and recreate header ARVersion Header file
119execute_process(COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h")
120configure_file(${CMAKE_CURRENT_SOURCE_DIR}/STEER/ARVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h @ONLY)
121
122# Get list of enabled root features
123execute_process(COMMAND root-config --features OUTPUT_VARIABLE FEATURES)
124string(REGEX MATCH "pythia6" PYTHIA6 ${FEATURES})
125string(REGEX MATCH "pythia8" PYTHIA8 ${FEATURES})
7c786cf9 126string(REGEX MATCH "opengl" OPENGL ${FEATURES})
7f40fabf 127if(PYTHIA6)
128 message(STATUS "Pythia6 enabled")
129endif(PYTHIA6)
130if(PYTHIA8)
131 message(STATUS "Pythia8 enabled")
132endif(PYTHIA8)
7c786cf9 133if(OPENGL)
134 message(STATUS "OpenGL enabled")
135endif(OPENGL)
136option (TFLUKA "Build TFluka" OFF)
137option (THYDJET "Build THydjet" OFF)
138option (SHUTTLE "Build SHUTTLE" OFF)
139
61aa89dd 140
141add_custom_target(STEER-all)
142add_custom_target(PHOS-all)
143add_custom_target(TRD-all)
144add_custom_target(TPC-all)
145add_custom_target(ZDC-all)
146add_custom_target(MUON-all)
147add_custom_target(PMD-all)
148add_custom_target(FMD-all)
149add_custom_target(TOF-all)
150add_custom_target(ITS-all)
151add_custom_target(ACORDE-all)
152add_custom_target(HMPID-all)
153add_custom_target(T0-all)
154add_custom_target(BCM-all)
155add_custom_target(STRUCT-all)
156add_custom_target(EVGEN-all)
157add_custom_target(RALICE-all)
158add_custom_target(VZERO-all)
159add_custom_target(THijing-all)
160add_custom_target(THbtp-all)
161add_custom_target(EMCAL-all)
162add_custom_target(THerwig-all)
163add_custom_target(TEPEMGEN-all)
164add_custom_target(FASTSIM-all)
165add_custom_target(TPHIC-all)
166add_custom_target(RAW-all)
167add_custom_target(MONITOR-all)
168add_custom_target(ANALYSIS-all)
169add_custom_target(JETAN-all)
170add_custom_target(HLT-all)
171add_custom_target(LHC-all)
172add_custom_target(ESDCheck-all)
173add_custom_target(STAT-all)
174add_custom_target(TTherminator-all)
175add_custom_target(CORRFW-all)
176add_custom_target(DPMJET-all)
177add_custom_target(TDPMjet-all)
178add_custom_target(PWG0-all)
179add_custom_target(PWG1-all)
180add_custom_target(PWG2-all)
181add_custom_target(PWG3-all)
182add_custom_target(PWG4-all)
183add_custom_target(TRIGGER-all)
184add_custom_target(TUHKMgen-all)
185add_custom_target(EPOS-all)
186add_custom_target(PYTHIA8-all)
187add_custom_target(EVE-all)
188add_custom_target(TFluka-all)
189add_custom_target(THydjet-all)
190add_custom_target(SHUTTLE-all)
191add_custom_target(LHAPDF-all)
192add_custom_target(HIJING-all)
193add_custom_target(MICROCERN-all)
194add_custom_target(HERWIG-all)
195add_custom_target(PYTHIA6-all)
196add_custom_target(ALIROOT-all)
197
5a104e16 198set(MODULES STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS ACORDE HMPID T0 BCM STRUCT EVGEN RALICE 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 TUHKMgen EPOS)
61aa89dd 199
e969a926 200# Recurse into the given subdirectories. This does not actually
201# cause another cmake executable to run. The same process will walk through
202# the project's entire directory structure.
4b5c021e 203Add_subdirectory(STEER)
204Add_subdirectory(PHOS)
205Add_subdirectory(TRD)
206Add_subdirectory(TPC)
207Add_subdirectory(ZDC)
208Add_subdirectory(MUON)
209Add_subdirectory(PMD)
210Add_subdirectory(FMD)
211Add_subdirectory(TOF)
212Add_subdirectory(ITS)
e969a926 213Add_subdirectory(ACORDE)
4b5c021e 214Add_subdirectory(HMPID)
215Add_subdirectory(T0)
e969a926 216Add_subdirectory(BCM)
4b5c021e 217Add_subdirectory(STRUCT)
e969a926 218Add_subdirectory(EVGEN)
4b5c021e 219Add_subdirectory(RALICE)
220Add_subdirectory(VZERO)
221Add_subdirectory(THijing)
222Add_subdirectory(THbtp)
223Add_subdirectory(EMCAL)
224Add_subdirectory(THerwig)
225Add_subdirectory(TEPEMGEN)
e969a926 226Add_subdirectory(FASTSIM)
4b5c021e 227Add_subdirectory(TPHIC)
228Add_subdirectory(RAW)
229Add_subdirectory(MONITOR)
230Add_subdirectory(ANALYSIS)
e969a926 231Add_subdirectory(JETAN)
4b5c021e 232Add_subdirectory(HLT)
e969a926 233Add_subdirectory(LHC)
4b5c021e 234Add_subdirectory(ESDCheck)
235Add_subdirectory(STAT)
236Add_subdirectory(TTherminator)
237Add_subdirectory(CORRFW)
238Add_subdirectory(DPMJET)
239Add_subdirectory(TDPMjet)
e969a926 240Add_subdirectory(PWG0)
241Add_subdirectory(PWG1)
242Add_subdirectory(PWG2)
243Add_subdirectory(PWG3)
244Add_subdirectory(PWG4)
4b5c021e 245Add_subdirectory(TRIGGER)
246Add_subdirectory(TUHKMgen)
247Add_subdirectory(EPOS)
7f40fabf 248if(PYTHIA8)
249Add_subdirectory(PYTHIA8)
5a104e16 250list(APPEND MODULES PYTHIA8)
7f40fabf 251endif(PYTHIA8)
4b5c021e 252if(OPENGL)
253Add_subdirectory(EVE)
5a104e16 254list(APPEND MODULES EVE)
4b5c021e 255endif(OPENGL)
7c786cf9 256if(TFLUKA)
257Add_subdirectory(TFluka)
5a104e16 258list(APPEND MODULES TFluka)
7c786cf9 259endif(TFLUKA)
260if(THYDJET)
261Add_subdirectory(THydjet)
5a104e16 262list(APPEND MODULES THydjet)
7c786cf9 263endif(THYDJET)
4b5c021e 264if(SHUTTLE)
265Add_subdirectory(SHUTTLE)
5a104e16 266list(APPEND MODULES SHUTTLE)
4b5c021e 267endif(SHUTTLE)
268Add_subdirectory(LHAPDF)
269Add_subdirectory(HIJING)
270Add_subdirectory(MICROCERN)
271Add_subdirectory(HERWIG)
5a104e16 272list(APPEND MODULES LHAPDF HIJING MICROCERN HERWIG)
4b5c021e 273if(PYTHIA6)
274Add_subdirectory(PYTHIA6)
5a104e16 275list(APPEND MODULES PYTHIA6)
4b5c021e 276endif(PYTHIA6)
e969a926 277Add_subdirectory(ALIROOT)
3ea0d710 278add_subdirectory(test)
eee962e6 279add_test ("Aliroot_executable" aliroot -q)
280#copy testing files
51ba4a8b 281configure_file("CTestCustom.ctest" "${PROJECT_BINARY_DIRECTORY}" COPYONLY)
5a104e16 282
283if(DA)
284include(cmakeDA)
285endif(DA)