added gun, ppbench tests, and warnings and coding covention violation checking.
[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/
3ea0d710 29set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET})
30set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET})
7f40fabf 31set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules")
e969a926 32
f7d3fd75 33# To fix a hack that has been introduced for the Mac
7f40fabf 34if(APPLE)
35 set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
36endif(APPLE)
f7d3fd75 37
3ea0d710 38# Setup ROOT and C, C++ , Fortran Compilers
7f40fabf 39find_package(ROOT 5.0.0 REQUIRED)
7f40fabf 40set(CMAKE_C_COMPILER $ENV{CC})
41enable_language(C)
7f40fabf 42set(CMAKE_CXX_COMPILER $ENV{CXX})
43enable_language(CXX)
7f40fabf 44set(CMAKE_Fortran_COMPILER $ENV{F77})
45enable_language(Fortran)
f7d3fd75 46
e969a926 47# Load some basic macros which are needed later on
48#Include(WriteConfigFile)
3ea0d710 49
50include (CTest)
7f40fabf 51include(ALICEMacros)
e969a926 52
53# Check if the user wants to build the project in the source directory
54Check_out_of_Source_Build()
55
56# searches for needed packages
57
7f40fabf 58Set(ALIROOT_INSTALL_DIR ${ALICE_INSTALL}/${ALICE_TARGET})
e969a926 59
60# Setup GEANT3
7f40fabf 61find_package(GEANT3 REQUIRED)
e969a926 62
63# Setup RuleChecker
7f40fabf 64find_package(RuleChecker)
e969a926 65
66# Check if DATE is installed
7f40fabf 67find_package(DATE)
e969a926 68
69# Setup system dependent flags
70SetupSystem()
71
7f40fabf 72Include(CreateSubCMakeFiles)
73CreateSubCMakeFiles()
96c0c856 74
96c0c856 75
e969a926 76# Set the library version in the main CMakeLists.txt
7f40fabf 77
78set(ALIROOT_MAJOR_VERSION 0)
79set(ALIROOT_MINOR_VERSION 0)
80set(ALIROOT_PATCH_VERSION 0)
81set(ALIROOT_VERSION "${ALIROOT_MAJOR_VERSION}.${ALIROOT_MINOR_VERSION}.${ALIROOT_PATCH_VERSION}")
82
83set(ALIROOT_LIBRARY_PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES}
e969a926 84 VERSION "${ALIROOT_VERSION}"
85 SOVERSION "${ALIROOT_MAJOR_VERSION}"
86 SUFFIX ".so"
87)
88
89# Set version variables
7f40fabf 90find_program( READLINK_PROGRAM readlink)
6455495f 91
7f40fabf 92if(READLINK_PROGRAM)
93 execute_process(COMMAND readlink -f ${ALICE_ROOT}
6455495f 94 COMMAND xargs svn info
95 OUTPUT_VARIABLE _svn_out)
7f40fabf 96else(READLINK_PROGRAM)
97 execute_process(COMMAND svn info ${ALICE_ROOT}
6455495f 98 OUTPUT_VARIABLE _svn_out)
7f40fabf 99endif(READLINK_PROGRAM)
e969a926 100
7f40fabf 101string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1"
e969a926 102 ALIROOT_SVN_REVISION ${_svn_out})
7f40fabf 103string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1"
e969a926 104 ALIROOT_SVN_BRANCH ${_svn_out})
7f40fabf 105string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
106
e969a926 107
108# Additional targets
7f40fabf 109add_custom_target(check-all COMMENT "Checking coding conventions")
110message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}")
111message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}")
112
113# Delete and recreate header ARVersion Header file
114execute_process(COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h")
115configure_file(${CMAKE_CURRENT_SOURCE_DIR}/STEER/ARVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h @ONLY)
116
117# Get list of enabled root features
118execute_process(COMMAND root-config --features OUTPUT_VARIABLE FEATURES)
119string(REGEX MATCH "pythia6" PYTHIA6 ${FEATURES})
120string(REGEX MATCH "pythia8" PYTHIA8 ${FEATURES})
121if(PYTHIA6)
122 message(STATUS "Pythia6 enabled")
123endif(PYTHIA6)
124if(PYTHIA8)
125 message(STATUS "Pythia8 enabled")
126endif(PYTHIA8)
e969a926 127
128# Recurse into the given subdirectories. This does not actually
129# cause another cmake executable to run. The same process will walk through
130# the project's entire directory structure.
131
7f40fabf 132
e969a926 133#Add_subdirectory(TFluka)
134#Add_subdirectory(THydjet)
135
136Add_subdirectory(ACORDE)
137Add_subdirectory(ANALYSIS)
138Add_subdirectory(BCM)
139Add_subdirectory(CORRFW)
140Add_subdirectory(DPMJET)
141Add_subdirectory(EMCAL)
fe9fbf07 142Add_subdirectory(EPOS)
e969a926 143Add_subdirectory(ESDCheck)
144Add_subdirectory(EVE)
145Add_subdirectory(EVGEN)
146Add_subdirectory(FASTSIM)
147Add_subdirectory(FMD)
e969a926 148Add_subdirectory(HERWIG)
149Add_subdirectory(HIJING)
150Add_subdirectory(HLT)
151Add_subdirectory(HMPID)
152Add_subdirectory(ITS)
153Add_subdirectory(JETAN)
154Add_subdirectory(LHAPDF)
155Add_subdirectory(LHC)
156Add_subdirectory(MICROCERN)
157Add_subdirectory(MONITOR)
158Add_subdirectory(MUON)
159Add_subdirectory(PHOS)
160Add_subdirectory(PMD)
161Add_subdirectory(PWG0)
162Add_subdirectory(PWG1)
163Add_subdirectory(PWG2)
164Add_subdirectory(PWG3)
165Add_subdirectory(PWG4)
7f40fabf 166if(PYTHIA6)
e969a926 167Add_subdirectory(PYTHIA6)
168Add_subdirectory(RALICE)
7f40fabf 169Add_subdirectory(TPHIC)
170endif(PYTHIA6)
171if(PYTHIA8)
172Add_subdirectory(PYTHIA8)
173endif(PYTHIA8)
e969a926 174Add_subdirectory(RAW)
175Add_subdirectory(STAT)
176Add_subdirectory(STEER)
177Add_subdirectory(STRUCT)
178Add_subdirectory(T0)
179Add_subdirectory(TDPMjet)
180Add_subdirectory(TEPEMGEN)
181Add_subdirectory(THbtp)
182Add_subdirectory(THerwig)
183Add_subdirectory(THijing)
ddd9c299 184#Add_subdirectory(TIsajet)
e969a926 185Add_subdirectory(TOF)
186Add_subdirectory(TPC)
e969a926 187Add_subdirectory(TRD)
96c0c856 188Add_subdirectory(TRIGGER)
e969a926 189Add_subdirectory(TTherminator)
fe9fbf07 190Add_subdirectory(TUHKMgen)
e969a926 191Add_subdirectory(VZERO)
192Add_subdirectory(ZDC)
e969a926 193Add_subdirectory(ALIROOT)
3ea0d710 194add_subdirectory(test)
eee962e6 195add_test ("Aliroot_executable" aliroot -q)
196#copy testing files
197execute_process(COMMAND "cmake" "-E" "copy_directory" "${ALICE_ROOT}/test" "${ALICE_INSTALL}/test")
e969a926 198
eee962e6 199message("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")