Fixed install target
[u/mrichter/AliRoot.git] / CMakeLists.txt
CommitLineData
6db31708 1# Top level CMakeList.txt file for the AliRoot Build System
2#
3# Author: Johny Jose (johny.jose@cern.ch)
4# Port of previous Makefile build to cmake
e969a926 5
e969a926 6
6db31708 7cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
e969a926 8
6db31708 9#--------------------------------------------------------------------------------#
10# Set Basic CMake Configuration #
11#--------------------------------------------------------------------------------#
b07a2059 12
6db31708 13project(AliRoot CXX C Fortran)
7f40fabf 14set(ALICE_ROOT $ENV{ALICE_ROOT})
6db31708 15set(ALICE $ENV{ALICE})
16
17if(NOT ALICE)
18 message(WARNING "Environment variable ALICE is not set")
19endif(NOT ALICE)
3ea0d710 20
3ea0d710 21if(NOT ALICE_ROOT)
6db31708 22 message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
3ea0d710 23endif(NOT ALICE_ROOT)
24
6db31708 25# Set AliRoot Installation directory
26if(NOT ALICE_INSTALL)
27 message(STATUS "AliRoot files will be installed in ${ALICE_ROOT}. You can specify a different location by setting ALICE_INSTALL environment variable")
28 set(ALICE_INSTALL ${ALICE_ROOT})
29else()
30 message(STATUS "AliRoot files will be installed in ${ALICE_INSTALL}")
31endif(NOT ALICE_INSTALL)
24b052aa 32set(CMAKE_INSTALL_PREFIX ${ALICE_INSTALL})
6db31708 33
dad683d0 34get_filename_component(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
f72dcc4f 35set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
0742852a 36set(CPACK_COMPONENTS_ALL MDC)
e969a926 37
6db31708 38include(ALICE_CMake)
f2cec6fb 39
6db31708 40#--------------------------------------------------------------------------------#
41# Find Packages #
42#--------------------------------------------------------------------------------#
e969a926 43
6db31708 44# Subversion
45# ------------------------------
e969a926 46
6db31708 47find_package(Subversion REQUIRED)
f7d3fd75 48
6db31708 49# ROOT
50# ------------------------------
f7d3fd75 51
6db31708 52find_package(ROOT REQUIRED)
3ea0d710 53
6db31708 54# IRST Rule Checker
55# ------------------------------
e969a926 56
6db31708 57find_package(RuleChecker)
e969a926 58
6db31708 59# DATE
60# ------------------------------
e969a926 61
6db31708 62find_package(DATE)
e969a926 63
6db31708 64# GEANT3
65# ------------------------------
e969a926 66
6db31708 67find_package(GEANT3)
e969a926 68
6db31708 69# AMORE
70# ------------------------------
71
72find_package(AMORE)
73
0742852a 74# AliRoot CPack configuration
75#-------------------------------
76
77find_package(CPack)
78
79
6db31708 80#--------------------------------------------------------------------------------#
81# Environment/Compiler Configuration #
82#--------------------------------------------------------------------------------#
83
84ALICE_CheckOutOfSourceBuild()
85ALICE_RootConfig(CMAKE_CXX_COMPILER --cxx)
86ALICE_RootConfig(CMAKE_C_COMPILER --cc)
87ALICE_RootConfig(CMAKE_Fortran_COMPILER --f77)
88ALICE_ConfigurePlatform()
89ALICE_ConfigureCompiler()
90
91
92#--------------------------------------------------------------------------------#
93# AliRoot Path Settings #
94#--------------------------------------------------------------------------------#
95
96ALICE_DevFlagsOutput()
97set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}")
98set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
99set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
100set(CMAKE_INCLUDE_EXPORT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
101file(MAKE_DIRECTORY ${CMAKE_INCLUDE_EXPORT_DIRECTORY})
102set(EXPORTDIRS "${ALICE_INSTALL}/include")
103set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
104
0742852a 105
6db31708 106#--------------------------------------------------------------------------------#
107# AliRoot Modules #
108#--------------------------------------------------------------------------------#
109
110# Exclude Module from all target
111# ------------------------------
112
45526b5e 113#set(EXCLUDEMODULES THydjet SHUTTLE)
6db31708 114
0742852a 115
6db31708 116# Standard Modules
117# ------------------------------
c2a2c0b8 118set(ALIROOTMODULES STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS ACORDE HMPID T0 BCM STRUCT VZERO THijing THbtp EMCAL THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS JETAN HLT LHC ESDCheck STAT TTherminator CORRFW DPMJET TDPMjet PWG0 PWG1 PWG2 PWG3 PWG4 TRIGGER PYTHIA8 TAmpt )
45526b5e 119
120if(THydjet)
121 list(APPEND ALIROOTMODULES THydjet)
122endif(THydjet)
123
124if(SHUTTLE)
125 list(APPEND ALIROOTMODULES SHUTTLE)
126endif(SHUTTLE)
6db31708 127
128# Additional Modules
129# ------------------------------
130list(APPEND ALIROOTMODULES TUHKMgen EPOS)
131
132# EVE
133# ------------------------------
134ALICE_RootConfig(EVE --has-opengl)
135if(NOT EVE STREQUAL "no")
136 list(APPEND ALIROOTMODULES EVE)
137endif(NOT EVE STREQUAL "no")
138
139# CERN Modules
140# ------------------------------
141set(CERNMODULES LHAPDF HIJING MICROCERN HERWIG)
142
143# Check for Pythia 6
144if(EXISTS ${ROOTINCDIR}/TPythia6.h)
145 set(PYTHIA6 TRUE)
146 list(APPEND CERNMODULES PYTHIA6 RALICE EVGEN)
811ffdcc 147elseif(NOT NOPYTHIA)
45526b5e 148 message(FATAL_ERROR "ROOT must have Pythia6 enabled !")
6db31708 149endif(EXISTS ${ROOTINCDIR}/TPythia6.h)
150
151# Set Final list of modules
152set(MODULES ${ALIROOTMODULES} ${CERNMODULES} ALIROOT)
153
154# Set Module directories
155set(MODDIRS ${MODULES})
156
157# Libraries for Linking
158# ------------------------------
159set(ALILIBS MUON TPC PMD TRD FMD TOF ITS PHOS ACORDE HMPID VZERO ZDC STRUCT T0 EVGEN STEER TRIGGER)
160set(LIBS ${ROOTCLIBS} ${ROOTPLIBS} ${SYSLIBS})
161
162# Configure ARVerion.h
163# ------------------------------
164if(Subversion_FOUND)
165 Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
166 set(ALIROOT_SVN_REVISION ${PROJECT_WC_REVISION})
167 set(ALIROOT_SVN_BRANCH ${PROJECT_WC_URL})
168 string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
169 message(STATUS "Aliroot Revision - ${ALIROOT_SVN_REVISION} Branch - ${ALIROOT_SVN_BRANCH}")
170 if(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
171 file(REMOVE ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
172 endif(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
173 configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h @ONLY)
174endif(Subversion_FOUND)
175
176#--------------------------------------------------------------------------------#
177# Build Modules #
178#--------------------------------------------------------------------------------#
179
180# Module Variables
181# ------------------------------
182set(ALLLIBS)
183set(ALLEXECS)
184set(INCLUDEFILES)
185set(BINLIBS)
186set(EXPORTFILES)
187
188# Top Level Build Targets
189# ------------------------------
190
191add_custom_target(alilibs-static)
192add_custom_target(include-headers)
45526b5e 193add_custom_target(DA-all)
c2a2c0b8 194add_custom_target(check-all)
6a9e2760 195add_custom_target(par-all)
3a8dbb31 196add_custom_target(test-par-all)
7531a2ac 197
6db31708 198# Add Modules
199# ------------------------------
200foreach(MODULE ${MODDIRS})
45526b5e 201 set(${MODULE}ALIBS)
6db31708 202 configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
203 add_custom_target(${MODULE}-all ALL)
c2a2c0b8 204 add_custom_target(${MODULE}-check-all)
3a8dbb31 205 add_custom_target(${MODULE}-par-all)
206 add_custom_target(test-${MODULE}-par-all)
c2a2c0b8 207 add_dependencies(check-all "${MODULE}-check-all")
529f129e 208 add_custom_target(${MODULE}-all-static)
6db31708 209 add_dependencies(alilibs-static "${MODULE}-static")
210 add_subdirectory(${MODULE})
6db31708 211endforeach(MODULE)
212
c3b22277 213if(DATE_FOUND AND AMORE_FOUND)
214 include (CMakeDA)
215endif(DATE_FOUND AND AMORE_FOUND)
216
6db31708 217#--------------------------------------------------------------------------------#
218# Additional Targets #
219#--------------------------------------------------------------------------------#
220
7531a2ac 221# AliMdc RPM
222# ------------------------------
223
6db31708 224include (InstallRequiredSystemLibraries)
225include (CPack)
e969a926 226