]>
Commit | Line | Data |
---|---|---|
e969a926 | 1 | # -*- mode: cmake -*- |
e969a926 | 2 | |
3 | # Check if cmake has the required version | |
7f40fabf | 4 | cmake_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 | 7 | project(AliRoot NONE) |
e969a926 | 8 | |
9 | # Set AliRoot variables | |
f2cec6fb | 10 | set(CMAKE_VERBOSE_MAKEFILES OFF) |
b07a2059 | 11 | #fix for MACOSX |
12 | SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem") | |
13 | SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem") | |
14 | ||
3ea0d710 | 15 | set(ALICE_INSTALL $ENV{ALICE_INSTALL}) |
7f40fabf | 16 | set(ALICE_ROOT $ENV{ALICE_ROOT}) |
7f40fabf | 17 | set(ALICE_STATIC_BUILD OFF CACHE BOOL "Build also statics libs") |
3ea0d710 | 18 | execute_process(COMMAND root-config --arch OUTPUT_VARIABLE ALICE_TARGET) |
19 | string (REGEX REPLACE "\n" "" ALICE_TARGET ${ALICE_TARGET}) | |
20 | ||
21 | if(NOT ALICE_INSTALL) | |
22 | message(FATAL_ERROR "Please set environment variable ALICE_INSTALL to the AliRoot installation directory") | |
23 | endif(NOT ALICE_INSTALL) | |
24 | if(NOT ALICE_ROOT) | |
25 | message(FATAL_ERROR "Please set environment variable ALICE_ROOT to the AliRoot source directory") | |
26 | endif(NOT ALICE_ROOT) | |
27 | ||
e969a926 | 28 | |
7f40fabf | 29 | message("ALICE_ROOT: ${ALICE_ROOT}") |
f2cec6fb | 30 | |
e969a926 | 31 | |
32 | # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ | |
035ff9fb | 33 | set(PROJECT_BINARY_DIR ${ALICE_INSTALL}) |
3ea0d710 | 34 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}) |
35 | set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}) | |
7f40fabf | 36 | set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules") |
e969a926 | 37 | |
f7d3fd75 | 38 | # To fix a hack that has been introduced for the Mac |
7f40fabf | 39 | if(APPLE) |
40 | set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND) | |
41 | endif(APPLE) | |
f7d3fd75 | 42 | |
3ea0d710 | 43 | # Setup ROOT and C, C++ , Fortran Compilers |
7f40fabf | 44 | find_package(ROOT 5.0.0 REQUIRED) |
7f40fabf | 45 | set(CMAKE_C_COMPILER $ENV{CC}) |
46 | enable_language(C) | |
7f40fabf | 47 | set(CMAKE_CXX_COMPILER $ENV{CXX}) |
48 | enable_language(CXX) | |
7f40fabf | 49 | set(CMAKE_Fortran_COMPILER $ENV{F77}) |
50 | enable_language(Fortran) | |
f7d3fd75 | 51 | |
e969a926 | 52 | # Load some basic macros which are needed later on |
53 | #Include(WriteConfigFile) | |
3ea0d710 | 54 | |
55 | include (CTest) | |
7f40fabf | 56 | include(ALICEMacros) |
e969a926 | 57 | |
58 | # Check if the user wants to build the project in the source directory | |
59 | Check_out_of_Source_Build() | |
60 | ||
61 | # searches for needed packages | |
62 | ||
7f40fabf | 63 | Set(ALIROOT_INSTALL_DIR ${ALICE_INSTALL}/${ALICE_TARGET}) |
e969a926 | 64 | |
65 | # Setup GEANT3 | |
7c786cf9 | 66 | find_package(GEANT3) |
e969a926 | 67 | |
68 | # Setup RuleChecker | |
7f40fabf | 69 | find_package(RuleChecker) |
e969a926 | 70 | |
71 | # Check if DATE is installed | |
7f40fabf | 72 | find_package(DATE) |
e969a926 | 73 | |
74 | # Setup system dependent flags | |
75 | SetupSystem() | |
76 | ||
7f40fabf | 77 | Include(CreateSubCMakeFiles) |
78 | CreateSubCMakeFiles() | |
96c0c856 | 79 | |
96c0c856 | 80 | |
e969a926 | 81 | # Set the library version in the main CMakeLists.txt |
7f40fabf | 82 | |
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}") | |
87 | ||
88 | set(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 | 95 | find_program( READLINK_PROGRAM readlink) |
6455495f | 96 | |
7f40fabf | 97 | if(READLINK_PROGRAM) |
98 | execute_process(COMMAND readlink -f ${ALICE_ROOT} | |
6455495f | 99 | COMMAND xargs svn info |
100 | OUTPUT_VARIABLE _svn_out) | |
7f40fabf | 101 | else(READLINK_PROGRAM) |
102 | execute_process(COMMAND svn info ${ALICE_ROOT} | |
6455495f | 103 | OUTPUT_VARIABLE _svn_out) |
7f40fabf | 104 | endif(READLINK_PROGRAM) |
e969a926 | 105 | |
7f40fabf | 106 | string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1" |
e969a926 | 107 | ALIROOT_SVN_REVISION ${_svn_out}) |
7f40fabf | 108 | string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1" |
e969a926 | 109 | ALIROOT_SVN_BRANCH ${_svn_out}) |
7f40fabf | 110 | string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH}) |
111 | ||
e969a926 | 112 | |
113 | # Additional targets | |
7f40fabf | 114 | add_custom_target(check-all COMMENT "Checking coding conventions") |
115 | message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}") | |
116 | message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}") | |
117 | ||
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) | |
121 | ||
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}) | |
7c786cf9 | 126 | string(REGEX MATCH "opengl" OPENGL ${FEATURES}) |
7f40fabf | 127 | if(PYTHIA6) |
128 | message(STATUS "Pythia6 enabled") | |
129 | endif(PYTHIA6) | |
130 | if(PYTHIA8) | |
131 | message(STATUS "Pythia8 enabled") | |
132 | endif(PYTHIA8) | |
7c786cf9 | 133 | if(OPENGL) |
134 | message(STATUS "OpenGL enabled") | |
135 | endif(OPENGL) | |
136 | option (TFLUKA "Build TFluka" OFF) | |
137 | option (THYDJET "Build THydjet" OFF) | |
138 | option (SHUTTLE "Build SHUTTLE" OFF) | |
139 | ||
140 | ||
e969a926 | 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. | |
4b5c021e | 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) | |
e969a926 | 154 | Add_subdirectory(ACORDE) |
4b5c021e | 155 | Add_subdirectory(HMPID) |
156 | Add_subdirectory(T0) | |
e969a926 | 157 | Add_subdirectory(BCM) |
4b5c021e | 158 | Add_subdirectory(STRUCT) |
e969a926 | 159 | Add_subdirectory(EVGEN) |
4b5c021e | 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) | |
e969a926 | 167 | Add_subdirectory(FASTSIM) |
4b5c021e | 168 | Add_subdirectory(TPHIC) |
169 | Add_subdirectory(RAW) | |
170 | Add_subdirectory(MONITOR) | |
171 | Add_subdirectory(ANALYSIS) | |
e969a926 | 172 | Add_subdirectory(JETAN) |
4b5c021e | 173 | Add_subdirectory(HLT) |
e969a926 | 174 | Add_subdirectory(LHC) |
4b5c021e | 175 | Add_subdirectory(ESDCheck) |
176 | Add_subdirectory(STAT) | |
177 | Add_subdirectory(TTherminator) | |
178 | Add_subdirectory(CORRFW) | |
179 | Add_subdirectory(DPMJET) | |
180 | Add_subdirectory(TDPMjet) | |
e969a926 | 181 | Add_subdirectory(PWG0) |
182 | Add_subdirectory(PWG1) | |
183 | Add_subdirectory(PWG2) | |
184 | Add_subdirectory(PWG3) | |
185 | Add_subdirectory(PWG4) | |
4b5c021e | 186 | Add_subdirectory(TRIGGER) |
187 | Add_subdirectory(TUHKMgen) | |
188 | Add_subdirectory(EPOS) | |
7f40fabf | 189 | if(PYTHIA8) |
190 | Add_subdirectory(PYTHIA8) | |
191 | endif(PYTHIA8) | |
4b5c021e | 192 | if(OPENGL) |
193 | Add_subdirectory(EVE) | |
194 | endif(OPENGL) | |
7c786cf9 | 195 | if(TFLUKA) |
196 | Add_subdirectory(TFluka) | |
197 | endif(TFLUKA) | |
198 | if(THYDJET) | |
199 | Add_subdirectory(THydjet) | |
200 | endif(THYDJET) | |
4b5c021e | 201 | if(SHUTTLE) |
202 | Add_subdirectory(SHUTTLE) | |
203 | endif(SHUTTLE) | |
204 | Add_subdirectory(LHAPDF) | |
205 | Add_subdirectory(HIJING) | |
206 | Add_subdirectory(MICROCERN) | |
207 | Add_subdirectory(HERWIG) | |
208 | if(PYTHIA6) | |
209 | Add_subdirectory(PYTHIA6) | |
210 | endif(PYTHIA6) | |
e969a926 | 211 | Add_subdirectory(ALIROOT) |
3ea0d710 | 212 | add_subdirectory(test) |
eee962e6 | 213 | add_test ("Aliroot_executable" aliroot -q) |
214 | #copy testing files | |
51ba4a8b | 215 | configure_file("CTestCustom.ctest" "${PROJECT_BINARY_DIRECTORY}" COPYONLY) |