]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CMakeLists.txt
a6c15628f66f17d59c900dacbf5ff109b957b69d
[u/mrichter/AliRoot.git] / CMakeLists.txt
1 # **************************************************************************
2 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3 # *                                                                        *
4 # * Author: The ALICE Off-line Project.                                    *
5 # * Contributors are mentioned in the code where appropriate.              *
6 # *                                                                        *
7 # * Permission to use, copy, modify and distribute this software and its   *
8 # * documentation strictly for non-commercial purposes is hereby granted   *
9 # * without fee, provided that the above copyright notice appears in all   *
10 # * copies and that both the copyright notice and this permission notice   *
11 # * appear in the supporting documentation. The authors make no claims     *
12 # * about the suitability of this software for any purpose. It is          *
13 # * provided "as is" without express or implied warranty.                  *
14 # **************************************************************************
15
16 #--------------------------------------------------------------------------#
17 # Set Basic CMake Configuration                                            #
18 #--------------------------------------------------------------------------#
19
20 cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
21
22 project(AliRoot CXX C)
23
24 # If no Fortran, i.e on Windows
25 include(CheckLanguage)
26 check_language(Fortran)
27 if(CMAKE_Fortran_COMPILER)
28     enable_language(Fortran OPTIONAL)
29 else()
30     message("No Fortran support. Disabling LHAPDF, PHYTIA6, MICROCERN")
31 endif()
32
33 # Path to additonal modules
34 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
35 include(CMakeALICE)
36
37 # ROOT configuration mandatory
38 if(ROOTSYS)
39     find_package(ROOT REQUIRED)
40
41     # ROOT must be build with XML2 support
42     if(ROOT_HASXML STREQUAL "no")
43         message(FATAL_ERROR "ROOT was not build with xml2 support. Please reinstall or rebuild ROOT with xml2 support")
44     endif(ROOT_HASXML STREQUAL "no")
45 else()
46     message(FATAL_ERROR "ROOT installation not found!\nPlease point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR")
47 endif(ROOTSYS)
48
49 # DATE
50 find_package(DATE)
51
52 # Configure ARVerion.h using Git informatiion
53 # Sets 3 git variables
54 #  - GIT_REFSPEC - complete name of the current reference
55 #  - ALIROOT_BRANCH - name of the branch or tag extracted from the current reference
56 #  - GIT_SHA1 - current hash in the long format
57 #  - GIT_SHORT_SHA1 - current hash in the short format
58 if(EXISTS ${PROJECT_SOURCE_DIR}/.git/)
59     include(GetGitRevisionDescription)
60     
61     find_package(Git)
62     
63     if(GIT_FOUND)
64         get_git_head_revision(GIT_REFSPEC GIT_SHA1)
65
66         # GIT_REFSPEC is empty for detached mode = tags in detached mode or checkout to specific hash
67
68         # returns the closest reference to the current hash
69         # name of the current tag or heads/branch in the case of branches
70         git_describe(ALIROOT_GIT_TAG "--all" "--abbrev=0")
71
72         STRING(REGEX REPLACE "^(.+/)(.+)/(.*)$" "\\2" BRANCH_TYPE "${GIT_REFSPEC}" )
73         
74         # the revision is not set in the case of a branch, it means we are doing development
75         # and the revision will trigger a reconfiguration
76         if(BRANCH_TYPE STREQUAL "heads")
77             set(ALIROOT_REVISION "ThisIsaBranchNoRevisionProvided")
78             STRING(REGEX REPLACE "^(.+/)(.+/)(.*)$" "\\3" SHORT_BRANCH "${GIT_REFSPEC}" )
79         else()
80             set(SHORT_BRANCH ${ALIROOT_GIT_TAG})
81             set(ALIROOT_REVISION ${GIT_SHA1})
82         endif()
83
84         set(ALIROOT_BRANCH ${SHORT_BRANCH})
85   
86         # generate the short version of the revision hash
87         execute_process(COMMAND git rev-parse --short ${GIT_SHA1} 
88                           WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 
89                           OUTPUT_STRIP_TRAILING_WHITESPACE 
90                           RESULT_VARIABLE res
91                           OUTPUT_VARIABLE GIT_SHORT_SHA1)
92
93         # if the rev-parse fails we set the short sha to the long initial one
94         if(NOT res EQUAL 0)
95             set(GIT_SHORT_SHA1 ${GIT_SHA1})
96         endif()
97   
98         message(STATUS "Aliroot branch/tag: \"${ALIROOT_BRANCH}\" - Revision:  \"${GIT_SHORT_SHA1}\" ")
99
100     else()
101         message(STATUS "Git not installed. I can't tell you which revision you are using!")
102     endif(GIT_FOUND)
103 else()
104     message("AliRoot sources not downloaded from a Version Control System. I can't tell which revision you are using!")
105 endif(EXISTS ${PROJECT_SOURCE_DIR}/.git/)
106
107 configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_BINARY_DIR}/version/ARVersion.h @ONLY)
108 install(FILES ${PROJECT_BINARY_DIR}/version/ARVersion.h DESTINATION include)
109
110 string (REPLACE "-" "." ALIROOT_BRANCH_SPEC "${ALIROOT_BRANCH}")
111
112 message(STATUS "CMake platform: ${CMAKE_SYSTEM}")
113 message(STATUS "Build folder: ${AliRoot_BINARY_DIR}")
114 message(STATUS "Source folder: ${AliRoot_SOURCE_DIR}")
115 message(STATUS "Installation folder: ${CMAKE_INSTALL_PREFIX}")
116
117
118 # AliRoot modules
119 add_subdirectory(STEER)
120 add_subdirectory(STAT)
121 add_subdirectory(OADB)
122 add_subdirectory(ANALYSIS)
123 add_subdirectory(RAW)
124 add_subdirectory(ITS)
125 add_subdirectory(TPC)
126 add_subdirectory(VZERO)
127 add_subdirectory (T0)
128 add_subdirectory (TOF)
129 add_subdirectory (TRD)
130 add_subdirectory (ZDC)
131 add_subdirectory (STRUCT)
132 add_subdirectory (HMPID)
133 #add_subdirectory (PMD)
134 #add_subdirectory (MUON)
135 #add_subdirectory (FMD)
136 #add_subdirectory (ACORDE)
137 #add_subdirectory (EMCAL)
138 #add_subdirectory (PHOS)
139 #add_subdirectory (TRIGGER)
140 #add_subdirectory (BCM)
141 #add_subdirectory (CORRFW)
142 #add_subdirectory (FASTSIM)
143 #if(CMAKE_Fortran_COMPILER_WORKS)
144 #  add_subdirectory (LHAPDF)
145 #  add_subdirectory (PYTHIA6)
146 #  add_subdirectory (MICROCERN)
147 #endif(CMAKE_Fortran_COMPILER_WORKS)
148 #add_subdirectory (EVGEN)
149 #add_subdirectory (TUHKMgen)
150 #add_subdirectory (TTherminator)
151 #add_subdirectory (TPHIC)
152 #add_subdirectory (THydjet)
153 #add_subdirectory (PWG)
154 #add_subdirectory (Vc)
155 #add_subdirectory (HLT)