3 # Check if cmake has the required version
4 cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
6 # Set name of our project to AliRoot. To be done after check of cmake version
9 # Set AliRoot variables
10 set(CMAKE_VERBOSE_MAKEFILES OFF)
12 SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem")
13 SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem")
15 set(ALICE_INSTALL $ENV{ALICE_INSTALL})
16 set(ALICE_ROOT $ENV{ALICE_ROOT})
17 set(ALICE_STATIC_BUILD OFF CACHE BOOL "Build also statics libs")
18 execute_process(COMMAND root-config --arch OUTPUT_VARIABLE ALICE_TARGET)
19 string (REGEX REPLACE "\n" "" ALICE_TARGET ${ALICE_TARGET})
22 message(FATAL_ERROR "Please set environment variable ALICE_INSTALL to the AliRoot installation directory")
23 endif(NOT ALICE_INSTALL)
25 message(FATAL_ERROR "Please set environment variable ALICE_ROOT to the AliRoot source directory")
29 message("ALICE_ROOT: ${ALICE_ROOT}")
32 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
33 set(PROJECT_BINARY_DIR ${ALICE_INSTALL})
34 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET})
35 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET})
36 set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules")
38 # To fix a hack that has been introduced for the Mac
40 set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
43 # Setup ROOT and C, C++ , Fortran Compilers
44 find_package(ROOT 5.0.0 REQUIRED)
45 set(CMAKE_C_COMPILER $ENV{CC})
47 set(CMAKE_CXX_COMPILER $ENV{CXX})
49 set(CMAKE_Fortran_COMPILER $ENV{F77})
50 enable_language(Fortran)
52 # Load some basic macros which are needed later on
53 #Include(WriteConfigFile)
58 # Check if the user wants to build the project in the source directory
59 Check_out_of_Source_Build()
61 # searches for needed packages
63 Set(ALIROOT_INSTALL_DIR ${ALICE_INSTALL}/${ALICE_TARGET})
69 find_package(RuleChecker)
71 # Check if DATE is installed
74 # Setup system dependent flags
77 Include(CreateSubCMakeFiles)
81 # Set the library version in the main CMakeLists.txt
83 set(ALIROOT_MAJOR_VERSION 0)
84 set(ALIROOT_MINOR_VERSION 0)
85 set(ALIROOT_PATCH_VERSION 0)
86 set(ALIROOT_VERSION "${ALIROOT_MAJOR_VERSION}.${ALIROOT_MINOR_VERSION}.${ALIROOT_PATCH_VERSION}")
88 set(ALIROOT_LIBRARY_PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES}
89 VERSION "${ALIROOT_VERSION}"
90 SOVERSION "${ALIROOT_MAJOR_VERSION}"
94 # Set version variables
95 find_program( READLINK_PROGRAM readlink)
98 execute_process(COMMAND readlink -f ${ALICE_ROOT}
99 COMMAND xargs svn info
100 OUTPUT_VARIABLE _svn_out)
101 else(READLINK_PROGRAM)
102 execute_process(COMMAND svn info ${ALICE_ROOT}
103 OUTPUT_VARIABLE _svn_out)
104 endif(READLINK_PROGRAM)
106 string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1"
107 ALIROOT_SVN_REVISION ${_svn_out})
108 string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1"
109 ALIROOT_SVN_BRANCH ${_svn_out})
110 string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
114 add_custom_target(check-all COMMENT "Checking coding conventions")
115 message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}")
116 message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}")
118 # Delete and recreate header ARVersion Header file
119 execute_process(COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h")
120 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/STEER/ARVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h @ONLY)
122 # Get list of enabled root features
123 execute_process(COMMAND root-config --features OUTPUT_VARIABLE FEATURES)
124 string(REGEX MATCH "pythia6" PYTHIA6 ${FEATURES})
125 string(REGEX MATCH "pythia8" PYTHIA8 ${FEATURES})
126 string(REGEX MATCH "opengl" OPENGL ${FEATURES})
128 message(STATUS "Pythia6 enabled")
131 message(STATUS "Pythia8 enabled")
134 message(STATUS "OpenGL enabled")
136 option (TFLUKA "Build TFluka" OFF)
137 option (THYDJET "Build THydjet" OFF)
138 option (SHUTTLE "Build SHUTTLE" OFF)
141 # Recurse into the given subdirectories. This does not actually
142 # cause another cmake executable to run. The same process will walk through
143 # the project's entire directory structure.
144 Add_subdirectory(STEER)
145 Add_subdirectory(PHOS)
146 Add_subdirectory(TRD)
147 Add_subdirectory(TPC)
148 Add_subdirectory(ZDC)
149 Add_subdirectory(MUON)
150 Add_subdirectory(PMD)
151 Add_subdirectory(FMD)
152 Add_subdirectory(TOF)
153 Add_subdirectory(ITS)
154 Add_subdirectory(ACORDE)
155 Add_subdirectory(HMPID)
157 Add_subdirectory(BCM)
158 Add_subdirectory(STRUCT)
159 Add_subdirectory(EVGEN)
160 Add_subdirectory(RALICE)
161 Add_subdirectory(VZERO)
162 Add_subdirectory(THijing)
163 Add_subdirectory(THbtp)
164 Add_subdirectory(EMCAL)
165 Add_subdirectory(THerwig)
166 Add_subdirectory(TEPEMGEN)
167 Add_subdirectory(FASTSIM)
168 Add_subdirectory(TPHIC)
169 Add_subdirectory(RAW)
170 Add_subdirectory(MONITOR)
171 Add_subdirectory(ANALYSIS)
172 Add_subdirectory(JETAN)
173 Add_subdirectory(HLT)
174 Add_subdirectory(LHC)
175 Add_subdirectory(ESDCheck)
176 Add_subdirectory(STAT)
177 Add_subdirectory(TTherminator)
178 Add_subdirectory(CORRFW)
179 Add_subdirectory(DPMJET)
180 Add_subdirectory(TDPMjet)
181 Add_subdirectory(PWG0)
182 Add_subdirectory(PWG1)
183 Add_subdirectory(PWG2)
184 Add_subdirectory(PWG3)
185 Add_subdirectory(PWG4)
186 Add_subdirectory(TRIGGER)
187 Add_subdirectory(TUHKMgen)
188 Add_subdirectory(EPOS)
190 Add_subdirectory(PYTHIA8)
193 Add_subdirectory(EVE)
196 Add_subdirectory(TFluka)
199 Add_subdirectory(THydjet)
202 Add_subdirectory(SHUTTLE)
204 Add_subdirectory(LHAPDF)
205 Add_subdirectory(HIJING)
206 Add_subdirectory(MICROCERN)
207 Add_subdirectory(HERWIG)
209 Add_subdirectory(PYTHIA6)
211 Add_subdirectory(ALIROOT)
212 add_subdirectory(test)
213 add_test ("Aliroot_executable" aliroot -q)
215 configure_file("CTestCustom.ctest" "${PROJECT_BINARY_DIRECTORY}" COPYONLY)