]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CMakeLists.txt
STAT module
[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 else()
41     message(FATAL_ERROR "ROOT installation not found!\nPlease point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR")
42 endif(ROOTSYS)
43
44 # Configure ARVerion.h using Git informatiion
45 # Sets 3 git variables
46 #  - GIT_REFSPEC - complete name of the current reference
47 #  - ALIROOT_BRANCH - name of the branch or tag extracted from the current reference
48 #  - GIT_SHA1 - current hash in the long format
49 #  - GIT_SHORT_SHA1 - current hash in the short format
50 if(EXISTS ${PROJECT_SOURCE_DIR}/.git/)
51     include(GetGitRevisionDescription)
52     
53     find_package(Git)
54     
55     if(GIT_FOUND)
56         get_git_head_revision(GIT_REFSPEC GIT_SHA1)
57
58         # GIT_REFSPEC is empty for detached mode = tags in detached mode or checkout to specific hash
59
60         # returns the closest reference to the current hash
61         # name of the current tag or heads/branch in the case of branches
62         git_describe(ALIROOT_GIT_TAG "--all" "--abbrev=0")
63
64         STRING(REGEX REPLACE "^(.+/)(.+)/(.*)$" "\\2" BRANCH_TYPE "${GIT_REFSPEC}" )
65         
66         # the revision is not set in the case of a branch, it means we are doing development
67         # and the revision will trigger a reconfiguration
68         if(BRANCH_TYPE STREQUAL "heads")
69             set(ALIROOT_REVISION "ThisIsaBranchNoRevisionProvided")
70             STRING(REGEX REPLACE "^(.+/)(.+/)(.*)$" "\\3" SHORT_BRANCH "${GIT_REFSPEC}" )
71         else()
72             set(SHORT_BRANCH ${ALIROOT_GIT_TAG})
73             set(ALIROOT_REVISION ${GIT_SHA1})
74         endif()
75
76         set(ALIROOT_BRANCH ${SHORT_BRANCH})
77   
78         # generate the short version of the revision hash
79         execute_process(COMMAND git rev-parse --short ${GIT_SHA1} 
80                           WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 
81                           OUTPUT_STRIP_TRAILING_WHITESPACE 
82                           RESULT_VARIABLE res
83                           OUTPUT_VARIABLE GIT_SHORT_SHA1)
84
85         # if the rev-parse fails we set the short sha to the long initial one
86         if(NOT res EQUAL 0)
87             set(GIT_SHORT_SHA1 ${GIT_SHA1})
88         endif()
89   
90         message(STATUS "Aliroot branch/tag: \"${ALIROOT_BRANCH}\" - Revision:  \"${GIT_SHORT_SHA1}\" ")
91
92     else()
93         message(STATUS "Git not installed. I can't tell you which revision you are using!")
94     endif(GIT_FOUND)
95 else()
96     message("AliRoot sources not downloaded from a Version Control System. I can't tell which revision you are using!")
97 endif(EXISTS ${PROJECT_SOURCE_DIR}/.git/)
98
99 configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_BINARY_DIR}/version/ARVersion.h @ONLY)
100 install(FILES ${PROJECT_BINARY_DIR}/version/ARVersion.h DESTINATION include)
101
102 string (REPLACE "-" "." ALIROOT_BRANCH_SPEC "${ALIROOT_BRANCH}")
103
104 message(STATUS "CMake platform: ${CMAKE_SYSTEM}")
105 message(STATUS "Build folder: ${AliRoot_BINARY_DIR}")
106 message(STATUS "Source folder: ${AliRoot_SOURCE_DIR}")
107 message(STATUS "Installation folder: ${CMAKE_INSTALL_PREFIX}")
108
109
110 # AliRoot modules
111 add_subdirectory (STEER)
112 add_subdirectory (STAT)
113 #add_subdirectory (OADB)
114 #add_subdirectory (ANALYSIS)
115 #add_subdirectory (RAW)
116 #add_subdirectory (ITS)
117 #add_subdirectory (TPC)
118 #add_subdirectory (VZERO)
119 #add_subdirectory (T0)
120 #add_subdirectory (TOF)
121 #add_subdirectory (TRD)
122 #add_subdirectory (ZDC)
123 #add_subdirectory (STRUCT)
124 #add_subdirectory (HMPID)
125 #add_subdirectory (PMD)
126 #add_subdirectory (MUON)
127 #add_subdirectory (FMD)
128 #add_subdirectory (ACORDE)
129 #add_subdirectory (EMCAL)
130 #add_subdirectory (PHOS)
131 #add_subdirectory (TRIGGER)
132 #add_subdirectory (BCM)
133 #add_subdirectory (CORRFW)
134 #add_subdirectory (FASTSIM)
135 #if(CMAKE_Fortran_COMPILER_WORKS)
136 #  add_subdirectory (LHAPDF)
137 #  add_subdirectory (PYTHIA6)
138 #  add_subdirectory (MICROCERN)
139 #endif(CMAKE_Fortran_COMPILER_WORKS)
140 #add_subdirectory (EVGEN)
141 #add_subdirectory (TUHKMgen)
142 #add_subdirectory (TTherminator)
143 #add_subdirectory (TPHIC)
144 #add_subdirectory (THydjet)
145 #add_subdirectory (PWG)
146 #add_subdirectory (Vc)
147 #add_subdirectory (HLT)