1 # Top level CMakeList.txt file for the AliRoot Build System
3 # Author: Johny Jose (johny.jose@cern.ch)
4 # Port of previous Makefile build to cmake
7 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
9 #--------------------------------------------------------------------------------#
10 # Set Basic CMake Configuration #
11 #--------------------------------------------------------------------------------#
13 project(AliRoot CXX C Fortran)
14 set(ALICE_ROOT $ENV{ALICE_ROOT})
15 set(ALICE $ENV{ALICE})
18 message(WARNING "Environment variable ALICE is not set")
22 message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
25 # Set AliRoot Installation directory
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})
30 message(STATUS "AliRoot files will be installed in ${ALICE_INSTALL}")
31 endif(NOT ALICE_INSTALL)
33 set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake")
37 #--------------------------------------------------------------------------------#
39 #--------------------------------------------------------------------------------#
42 # ------------------------------
44 find_package(Subversion REQUIRED)
47 # ------------------------------
49 find_package(ROOT REQUIRED)
52 # ------------------------------
54 find_package(RuleChecker)
57 # ------------------------------
62 # ------------------------------
67 # ------------------------------
71 #--------------------------------------------------------------------------------#
72 # Environment/Compiler Configuration #
73 #--------------------------------------------------------------------------------#
75 ALICE_CheckOutOfSourceBuild()
76 ALICE_RootConfig(CMAKE_CXX_COMPILER --cxx)
77 ALICE_RootConfig(CMAKE_C_COMPILER --cc)
78 ALICE_RootConfig(CMAKE_Fortran_COMPILER --f77)
79 ALICE_ConfigurePlatform()
80 ALICE_ConfigureCompiler()
83 #--------------------------------------------------------------------------------#
84 # AliRoot Path Settings #
85 #--------------------------------------------------------------------------------#
87 ALICE_DevFlagsOutput()
88 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}")
89 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
90 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
91 set(CMAKE_INCLUDE_EXPORT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
92 file(MAKE_DIRECTORY ${CMAKE_INCLUDE_EXPORT_DIRECTORY})
93 set(EXPORTDIRS "${ALICE_INSTALL}/include")
94 set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
96 #--------------------------------------------------------------------------------#
98 #--------------------------------------------------------------------------------#
100 # Exclude Module from all target
101 # ------------------------------
103 set(EXCLUDEMODULES THydjet SHUTTLE)
106 # ------------------------------
107 set(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 THydjet PYTHIA8)
110 # ------------------------------
111 list(APPEND ALIROOTMODULES TUHKMgen EPOS)
114 # ------------------------------
115 ALICE_RootConfig(EVE --has-opengl)
116 if(NOT EVE STREQUAL "no")
117 list(APPEND ALIROOTMODULES EVE)
118 endif(NOT EVE STREQUAL "no")
121 # ------------------------------
122 set(CERNMODULES LHAPDF HIJING MICROCERN HERWIG)
125 if(EXISTS ${ROOTINCDIR}/TPythia6.h)
127 list(APPEND CERNMODULES PYTHIA6 RALICE EVGEN)
129 message(FATAL_ERROR "Pythia6 is required !")
130 endif(EXISTS ${ROOTINCDIR}/TPythia6.h)
132 # Set Final list of modules
133 set(MODULES ${ALIROOTMODULES} ${CERNMODULES} ALIROOT)
135 # Set Module directories
136 set(MODDIRS ${MODULES})
138 # Libraries for Linking
139 # ------------------------------
140 set(ALILIBS MUON TPC PMD TRD FMD TOF ITS PHOS ACORDE HMPID VZERO ZDC STRUCT T0 EVGEN STEER TRIGGER)
141 set(LIBS ${ROOTCLIBS} ${ROOTPLIBS} ${SYSLIBS})
143 # Configure ARVerion.h
144 # ------------------------------
146 Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
147 set(ALIROOT_SVN_REVISION ${PROJECT_WC_REVISION})
148 set(ALIROOT_SVN_BRANCH ${PROJECT_WC_URL})
149 string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
150 message(STATUS "Aliroot Revision - ${ALIROOT_SVN_REVISION} Branch - ${ALIROOT_SVN_BRANCH}")
151 if(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
152 file(REMOVE ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
153 endif(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
154 configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h @ONLY)
155 endif(Subversion_FOUND)
157 #--------------------------------------------------------------------------------#
159 #--------------------------------------------------------------------------------#
162 # ------------------------------
169 # Top Level Build Targets
170 # ------------------------------
172 add_custom_target(alilibs-static)
173 add_custom_target(include-headers)
176 # ------------------------------
177 foreach(MODULE ${MODDIRS})
178 configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
179 add_custom_target(${MODULE}-all ALL)
180 add_custom_target(${MODULE}-static)
181 add_dependencies(alilibs-static "${MODULE}-static")
182 add_subdirectory(${MODULE})
186 if(DATE_FOUND AND AMORE_FOUND)
188 endif(DATE_FOUND AND AMORE_FOUND)
190 #--------------------------------------------------------------------------------#
191 # Additional Targets #
192 #--------------------------------------------------------------------------------#
194 include (InstallRequiredSystemLibraries)