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
11 set(ALICE_INSTALL $ENV{ALICE_INSTALL})
12 set(ALICE_ROOT $ENV{ALICE_ROOT})
13 set(ALICE_STATIC_BUILD OFF CACHE BOOL "Build also statics libs")
14 execute_process(COMMAND root-config --arch OUTPUT_VARIABLE ALICE_TARGET)
15 string (REGEX REPLACE "\n" "" ALICE_TARGET ${ALICE_TARGET})
18 message(FATAL_ERROR "Please set environment variable ALICE_INSTALL to the AliRoot installation directory")
19 endif(NOT ALICE_INSTALL)
21 message(FATAL_ERROR "Please set environment variable ALICE_ROOT to the AliRoot source directory")
25 message("ALICE_ROOT: ${ALICE_ROOT}")
26 set(CMAKE_VERBOSE_MAKEFILE ON)
28 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
29 set(PROJECT_BINARY_DIR ${ALICE_INSTALL})
30 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET})
31 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET})
32 set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules")
34 # To fix a hack that has been introduced for the Mac
36 set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
39 # Setup ROOT and C, C++ , Fortran Compilers
40 find_package(ROOT 5.0.0 REQUIRED)
41 set(CMAKE_C_COMPILER $ENV{CC})
43 set(CMAKE_CXX_COMPILER $ENV{CXX})
45 set(CMAKE_Fortran_COMPILER $ENV{F77})
46 enable_language(Fortran)
48 # Load some basic macros which are needed later on
49 #Include(WriteConfigFile)
54 # Check if the user wants to build the project in the source directory
55 Check_out_of_Source_Build()
57 # searches for needed packages
59 Set(ALIROOT_INSTALL_DIR ${ALICE_INSTALL}/${ALICE_TARGET})
65 find_package(RuleChecker)
67 # Check if DATE is installed
70 # Setup system dependent flags
73 Include(CreateSubCMakeFiles)
77 # Set the library version in the main CMakeLists.txt
79 set(ALIROOT_MAJOR_VERSION 0)
80 set(ALIROOT_MINOR_VERSION 0)
81 set(ALIROOT_PATCH_VERSION 0)
82 set(ALIROOT_VERSION "${ALIROOT_MAJOR_VERSION}.${ALIROOT_MINOR_VERSION}.${ALIROOT_PATCH_VERSION}")
84 set(ALIROOT_LIBRARY_PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES}
85 VERSION "${ALIROOT_VERSION}"
86 SOVERSION "${ALIROOT_MAJOR_VERSION}"
90 # Set version variables
91 find_program( READLINK_PROGRAM readlink)
94 execute_process(COMMAND readlink -f ${ALICE_ROOT}
95 COMMAND xargs svn info
96 OUTPUT_VARIABLE _svn_out)
97 else(READLINK_PROGRAM)
98 execute_process(COMMAND svn info ${ALICE_ROOT}
99 OUTPUT_VARIABLE _svn_out)
100 endif(READLINK_PROGRAM)
102 string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1"
103 ALIROOT_SVN_REVISION ${_svn_out})
104 string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1"
105 ALIROOT_SVN_BRANCH ${_svn_out})
106 string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
110 add_custom_target(check-all COMMENT "Checking coding conventions")
111 message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}")
112 message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}")
114 # Delete and recreate header ARVersion Header file
115 execute_process(COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h")
116 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/STEER/ARVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h @ONLY)
118 # Get list of enabled root features
119 execute_process(COMMAND root-config --features OUTPUT_VARIABLE FEATURES)
120 string(REGEX MATCH "pythia6" PYTHIA6 ${FEATURES})
121 string(REGEX MATCH "pythia8" PYTHIA8 ${FEATURES})
122 string(REGEX MATCH "opengl" OPENGL ${FEATURES})
124 message(STATUS "Pythia6 enabled")
127 message(STATUS "Pythia8 enabled")
130 message(STATUS "OpenGL enabled")
132 option (TFLUKA "Build TFluka" OFF)
133 option (THYDJET "Build THydjet" OFF)
134 option (SHUTTLE "Build SHUTTLE" OFF)
137 # Recurse into the given subdirectories. This does not actually
138 # cause another cmake executable to run. The same process will walk through
139 # the project's entire directory structure.
140 Add_subdirectory(ACORDE)
141 Add_subdirectory(ANALYSIS)
142 Add_subdirectory(BCM)
143 Add_subdirectory(CORRFW)
144 Add_subdirectory(DPMJET)
145 Add_subdirectory(EMCAL)
146 Add_subdirectory(EPOS)
147 Add_subdirectory(ESDCheck)
149 Add_subdirectory(EVE)
151 Add_subdirectory(EVGEN)
152 Add_subdirectory(FASTSIM)
153 Add_subdirectory(FMD)
154 Add_subdirectory(HERWIG)
155 Add_subdirectory(HIJING)
156 Add_subdirectory(HLT)
157 Add_subdirectory(HMPID)
158 Add_subdirectory(ITS)
159 Add_subdirectory(JETAN)
160 Add_subdirectory(LHAPDF)
161 Add_subdirectory(LHC)
162 Add_subdirectory(MICROCERN)
163 Add_subdirectory(MONITOR)
164 Add_subdirectory(MUON)
165 Add_subdirectory(PHOS)
166 Add_subdirectory(PMD)
167 Add_subdirectory(PWG0)
168 Add_subdirectory(PWG1)
169 Add_subdirectory(PWG2)
170 Add_subdirectory(PWG3)
171 Add_subdirectory(PWG4)
173 Add_subdirectory(PYTHIA6)
174 Add_subdirectory(RALICE)
175 Add_subdirectory(TPHIC)
178 Add_subdirectory(PYTHIA8)
180 Add_subdirectory(RAW)
182 Add_subdirectory(SHUTTLE)
184 Add_subdirectory(STAT)
185 Add_subdirectory(STEER)
186 Add_subdirectory(STRUCT)
188 Add_subdirectory(TDPMjet)
189 Add_subdirectory(TEPEMGEN)
190 Add_subdirectory(THbtp)
191 Add_subdirectory(THerwig)
192 Add_subdirectory(THijing)
194 Add_subdirectory(TFluka)
197 Add_subdirectory(THydjet)
199 Add_subdirectory(TOF)
200 Add_subdirectory(TPC)
201 Add_subdirectory(TRD)
202 Add_subdirectory(TRIGGER)
203 Add_subdirectory(TTherminator)
204 Add_subdirectory(TUHKMgen)
205 Add_subdirectory(VZERO)
206 Add_subdirectory(ZDC)
207 Add_subdirectory(ALIROOT)
208 add_subdirectory(test)
209 add_test ("Aliroot_executable" aliroot -q)
211 if(EXISTS "${PROJECT_SOURCE_DIRECTORY}/CTestCustom.cmake")
212 configure_file("CTestCustom.cmake" "${PROJECT_BINARY_DIRECTORY}" COPYONLY)
213 endif(EXISTS "${PROJECT_SOURCE_DIRECTORY}/CTestCustom.cmake")
214 execute_process(COMMAND "cmake" "-E" "copy_directory" "${ALICE_ROOT}/test" "${ALICE_INSTALL}/test")
216 message("Note : In order for the warnings test to execute successfully you need to log your make build output to make.log in the ALICE_INSTALL Directory using this command \n make -k > make.log 2>&1")