]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CMakeLists.txt
more text
[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
3ea0d710 10
11set(ALICE_INSTALL $ENV{ALICE_INSTALL})
7f40fabf 12set(ALICE_ROOT $ENV{ALICE_ROOT})
7f40fabf 13set(ALICE_STATIC_BUILD OFF CACHE BOOL "Build also statics libs")
3ea0d710 14execute_process(COMMAND root-config --arch OUTPUT_VARIABLE ALICE_TARGET)
15string (REGEX REPLACE "\n" "" ALICE_TARGET ${ALICE_TARGET})
16
17if(NOT ALICE_INSTALL)
18message(FATAL_ERROR "Please set environment variable ALICE_INSTALL to the AliRoot installation directory")
19endif(NOT ALICE_INSTALL)
20if(NOT ALICE_ROOT)
21message(FATAL_ERROR "Please set environment variable ALICE_ROOT to the AliRoot source directory")
22endif(NOT ALICE_ROOT)
23
e969a926 24
7f40fabf 25message("ALICE_ROOT: ${ALICE_ROOT}")
26set(CMAKE_VERBOSE_MAKEFILE ON)
e969a926 27
28# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
035ff9fb 29set(PROJECT_BINARY_DIR ${ALICE_INSTALL})
3ea0d710 30set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET})
31set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET})
7f40fabf 32set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules")
e969a926 33
f7d3fd75 34# To fix a hack that has been introduced for the Mac
7f40fabf 35if(APPLE)
36 set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
37endif(APPLE)
f7d3fd75 38
3ea0d710 39# Setup ROOT and C, C++ , Fortran Compilers
7f40fabf 40find_package(ROOT 5.0.0 REQUIRED)
7f40fabf 41set(CMAKE_C_COMPILER $ENV{CC})
42enable_language(C)
7f40fabf 43set(CMAKE_CXX_COMPILER $ENV{CXX})
44enable_language(CXX)
7f40fabf 45set(CMAKE_Fortran_COMPILER $ENV{F77})
46enable_language(Fortran)
f7d3fd75 47
e969a926 48# Load some basic macros which are needed later on
49#Include(WriteConfigFile)
3ea0d710 50
51include (CTest)
7f40fabf 52include(ALICEMacros)
e969a926 53
54# Check if the user wants to build the project in the source directory
55Check_out_of_Source_Build()
56
57# searches for needed packages
58
7f40fabf 59Set(ALIROOT_INSTALL_DIR ${ALICE_INSTALL}/${ALICE_TARGET})
e969a926 60
61# Setup GEANT3
7c786cf9 62find_package(GEANT3)
e969a926 63
64# Setup RuleChecker
7f40fabf 65find_package(RuleChecker)
e969a926 66
67# Check if DATE is installed
7f40fabf 68find_package(DATE)
e969a926 69
70# Setup system dependent flags
71SetupSystem()
72
7f40fabf 73Include(CreateSubCMakeFiles)
74CreateSubCMakeFiles()
96c0c856 75
96c0c856 76
e969a926 77# Set the library version in the main CMakeLists.txt
7f40fabf 78
79set(ALIROOT_MAJOR_VERSION 0)
80set(ALIROOT_MINOR_VERSION 0)
81set(ALIROOT_PATCH_VERSION 0)
82set(ALIROOT_VERSION "${ALIROOT_MAJOR_VERSION}.${ALIROOT_MINOR_VERSION}.${ALIROOT_PATCH_VERSION}")
83
84set(ALIROOT_LIBRARY_PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES}
e969a926 85 VERSION "${ALIROOT_VERSION}"
86 SOVERSION "${ALIROOT_MAJOR_VERSION}"
87 SUFFIX ".so"
88)
89
90# Set version variables
7f40fabf 91find_program( READLINK_PROGRAM readlink)
6455495f 92
7f40fabf 93if(READLINK_PROGRAM)
94 execute_process(COMMAND readlink -f ${ALICE_ROOT}
6455495f 95 COMMAND xargs svn info
96 OUTPUT_VARIABLE _svn_out)
7f40fabf 97else(READLINK_PROGRAM)
98 execute_process(COMMAND svn info ${ALICE_ROOT}
6455495f 99 OUTPUT_VARIABLE _svn_out)
7f40fabf 100endif(READLINK_PROGRAM)
e969a926 101
7f40fabf 102string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1"
e969a926 103 ALIROOT_SVN_REVISION ${_svn_out})
7f40fabf 104string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1"
e969a926 105 ALIROOT_SVN_BRANCH ${_svn_out})
7f40fabf 106string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
107
e969a926 108
109# Additional targets
7f40fabf 110add_custom_target(check-all COMMENT "Checking coding conventions")
111message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}")
112message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}")
113
114# Delete and recreate header ARVersion Header file
115execute_process(COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h")
116configure_file(${CMAKE_CURRENT_SOURCE_DIR}/STEER/ARVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h @ONLY)
117
118# Get list of enabled root features
119execute_process(COMMAND root-config --features OUTPUT_VARIABLE FEATURES)
120string(REGEX MATCH "pythia6" PYTHIA6 ${FEATURES})
121string(REGEX MATCH "pythia8" PYTHIA8 ${FEATURES})
7c786cf9 122string(REGEX MATCH "opengl" OPENGL ${FEATURES})
7f40fabf 123if(PYTHIA6)
124 message(STATUS "Pythia6 enabled")
125endif(PYTHIA6)
126if(PYTHIA8)
127 message(STATUS "Pythia8 enabled")
128endif(PYTHIA8)
7c786cf9 129if(OPENGL)
130 message(STATUS "OpenGL enabled")
131endif(OPENGL)
132option (TFLUKA "Build TFluka" OFF)
133option (THYDJET "Build THydjet" OFF)
134option (SHUTTLE "Build SHUTTLE" OFF)
135
136
e969a926 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.
e969a926 140Add_subdirectory(ACORDE)
141Add_subdirectory(ANALYSIS)
142Add_subdirectory(BCM)
143Add_subdirectory(CORRFW)
144Add_subdirectory(DPMJET)
145Add_subdirectory(EMCAL)
fe9fbf07 146Add_subdirectory(EPOS)
e969a926 147Add_subdirectory(ESDCheck)
7c786cf9 148if(OPENGL)
e969a926 149Add_subdirectory(EVE)
7c786cf9 150endif(OPENGL)
e969a926 151Add_subdirectory(EVGEN)
152Add_subdirectory(FASTSIM)
153Add_subdirectory(FMD)
e969a926 154Add_subdirectory(HERWIG)
155Add_subdirectory(HIJING)
156Add_subdirectory(HLT)
157Add_subdirectory(HMPID)
158Add_subdirectory(ITS)
159Add_subdirectory(JETAN)
160Add_subdirectory(LHAPDF)
161Add_subdirectory(LHC)
162Add_subdirectory(MICROCERN)
163Add_subdirectory(MONITOR)
164Add_subdirectory(MUON)
165Add_subdirectory(PHOS)
166Add_subdirectory(PMD)
167Add_subdirectory(PWG0)
168Add_subdirectory(PWG1)
169Add_subdirectory(PWG2)
170Add_subdirectory(PWG3)
171Add_subdirectory(PWG4)
7f40fabf 172if(PYTHIA6)
e969a926 173Add_subdirectory(PYTHIA6)
174Add_subdirectory(RALICE)
7f40fabf 175Add_subdirectory(TPHIC)
176endif(PYTHIA6)
177if(PYTHIA8)
178Add_subdirectory(PYTHIA8)
179endif(PYTHIA8)
e969a926 180Add_subdirectory(RAW)
7c786cf9 181if(SHUTTLE)
7c786cf9 182Add_subdirectory(SHUTTLE)
183endif(SHUTTLE)
e969a926 184Add_subdirectory(STAT)
185Add_subdirectory(STEER)
186Add_subdirectory(STRUCT)
187Add_subdirectory(T0)
188Add_subdirectory(TDPMjet)
189Add_subdirectory(TEPEMGEN)
190Add_subdirectory(THbtp)
191Add_subdirectory(THerwig)
192Add_subdirectory(THijing)
7c786cf9 193if(TFLUKA)
194Add_subdirectory(TFluka)
195endif(TFLUKA)
196if(THYDJET)
197Add_subdirectory(THydjet)
198endif(THYDJET)
e969a926 199Add_subdirectory(TOF)
200Add_subdirectory(TPC)
e969a926 201Add_subdirectory(TRD)
96c0c856 202Add_subdirectory(TRIGGER)
e969a926 203Add_subdirectory(TTherminator)
fe9fbf07 204Add_subdirectory(TUHKMgen)
e969a926 205Add_subdirectory(VZERO)
206Add_subdirectory(ZDC)
e969a926 207Add_subdirectory(ALIROOT)
3ea0d710 208add_subdirectory(test)
eee962e6 209add_test ("Aliroot_executable" aliroot -q)
210#copy testing files
035ff9fb 211if(EXISTS "${PROJECT_SOURCE_DIRECTORY}/CTestCustom.cmake")
212configure_file("CTestCustom.cmake" "${PROJECT_BINARY_DIRECTORY}" COPYONLY)
213endif(EXISTS "${PROJECT_SOURCE_DIRECTORY}/CTestCustom.cmake")
eee962e6 214execute_process(COMMAND "cmake" "-E" "copy_directory" "${ALICE_ROOT}/test" "${ALICE_INSTALL}/test")
e969a926 215
7c786cf9 216message("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")