]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CMakeLists.txt
Correct value for ROOT_HAS*
[u/mrichter/AliRoot.git] / CMakeLists.txt
index 0c144f2be7aadb684f91f40043abb2ce9c864680..850686441fe829beb64becfda27562575887e78e 100644 (file)
-# Top level CMakeList.txt file for the AliRoot Build System
-#
-# Author: Johny Jose (johny.jose@cern.ch)
-#         Port of previous Makefile build to cmake
-
-
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
-
-#--------------------------------------------------------------------------------#
-# Set Basic CMake Configuration                                                  #
-#--------------------------------------------------------------------------------#
-
-project(AliRoot CXX C Fortran)
-set(ALICE_ROOT $ENV{ALICE_ROOT})
-set(ALICE $ENV{ALICE})
-
-if(NOT ALICE)
-  message(WARNING "Environment variable ALICE is not set")
-endif(NOT ALICE)
-
-if(NOT ALICE_ROOT)
-  message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
-endif(NOT ALICE_ROOT)
-
-# Set AliRoot Installation directory 
-if(NOT ALICE_INSTALL)
-  message(STATUS "AliRoot files will be installed in ${ALICE_ROOT}. You can specify a different location by setting ALICE_INSTALL environment variable")
-  set(ALICE_INSTALL ${ALICE_ROOT})
-else()
-  message(STATUS "AliRoot files will be installed in ${ALICE_INSTALL}")
-endif(NOT ALICE_INSTALL)
-
-get_filename_component(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
+# **************************************************************************
+# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
+# *                                                                        *
+# * Author: The ALICE Off-line Project.                                    *
+# * Contributors are mentioned in the code where appropriate.              *
+# *                                                                        *
+# * Permission to use, copy, modify and distribute this software and its   *
+# * documentation strictly for non-commercial purposes is hereby granted   *
+# * without fee, provided that the above copyright notice appears in all   *
+# * copies and that both the copyright notice and this permission notice   *
+# * appear in the supporting documentation. The authors make no claims     *
+# * about the suitability of this software for any purpose. It is          *
+# * provided "as is" without express or implied warranty.                  *
+# **************************************************************************
+
+#--------------------------------------------------------------------------#
+# Set Basic CMake Configuration                                            #
+#--------------------------------------------------------------------------#
+
+cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
+
+project(AliRoot CXX C)
+
+# Path to additonal modules
 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
-set(CPACK_COMPONENTS_ALL MDC)
 
-include(ALICE_CMake)
+#       - CLANG_MAJOR.CLANG_MINOR or
+#       - GCC_MAJOR.GCC_MINOR.GCC_PATCH
+include(CheckCompiler)
 
-#--------------------------------------------------------------------------------#
-# Find Packages                                                                  #
-#--------------------------------------------------------------------------------#
+# ROOT dictionaries and maps
+include(CMakeALICE)
 
-# Subversion
-# ------------------------------
-
-find_package(Subversion REQUIRED)
-
-# ROOT
-# ------------------------------
-
-find_package(ROOT REQUIRED)
-
-# IRST Rule Checker 
-# ------------------------------
-
-find_package(RuleChecker)
+# Checking first for DIM, DATE, AMORE and daqDA 
+# in case ROOT Extra static library needs to be enabled
 
 # DATE
-# ------------------------------ 
-
-find_package(DATE)
+if(DATE_CONFIG)
+    find_package(DATE)
+endif(DATE_CONFIG)
 
-# GEANT3
-# ------------------------------
-
-find_package(GEANT3)
+# daqDA
+if(daqDA)
+    find_package(daqDA)
+endif(daqDA)
 
 # AMORE
-# ------------------------------
-
-find_package(AMORE)
-
-# AliRoot CPack configuration                                                    
-#-------------------------------
-
-find_package(CPack)
-
-
-#--------------------------------------------------------------------------------#
-# Environment/Compiler Configuration                                             #
-#--------------------------------------------------------------------------------#
-
-ALICE_CheckOutOfSourceBuild()
-ALICE_RootConfig(CMAKE_CXX_COMPILER --cxx)
-ALICE_RootConfig(CMAKE_C_COMPILER --cc)
-ALICE_RootConfig(CMAKE_Fortran_COMPILER --f77)
-ALICE_ConfigurePlatform()
-ALICE_ConfigureCompiler()
-
-
-#--------------------------------------------------------------------------------#
-# AliRoot Path Settings                                                          #
-#--------------------------------------------------------------------------------#
-
-ALICE_DevFlagsOutput()
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}")
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
-set(CMAKE_INCLUDE_EXPORT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
-file(MAKE_DIRECTORY ${CMAKE_INCLUDE_EXPORT_DIRECTORY})
-set(EXPORTDIRS "${ALICE_INSTALL}/include")
-set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
-
-
-#--------------------------------------------------------------------------------#
-# AliRoot Modules                                                                #
-#--------------------------------------------------------------------------------#
-
-# Exclude Module from all target
-# ------------------------------
+if(AMORE_CONFIG)
+    find_package(AMORE)
+endif(AMORE_CONFIG)
+
+# DA is enabled
+if(DA)
+    if(NOT DIMDIR AND NOT ODIR)
+        set(DA FALSE)
+        message(FATAL_ERROR "Das enabled but no DIMDIR and ODIR set. Please set DIMDIR to DIM installation and ODIR to platform (default linux)")
+    endif()
+
+    if(NOT DATE_FOUND)
+        set(DA FALSE)
+        message(FATAL_ERROR "DAs enabled but no DATE support found. Please point to your date installation using \"DATE_CONFIG\" variable")
+    endif()
+
+    if(NOT daqDA_FOUND)
+        set(DA FALSE)
+        message(FATAL_ERROR "DAs enabled but no daqDA support found. Please point to your daqDA installation using \"daqDA\" variable")
+    endif()
+
+    if(NOT AMORE_FOUND)
+        set(DA FALSE)
+        message(FATAL_ERROR "DAs enabled but no AMORE support found. Please point to your AMORE installation using \"AMORE_CONFIG\" variable")
+    endif()
+    
+    # Enable static libraries
+    set(ALIROOT_STATIC TRUE)
+    message(STATUS "DAs enabled")
+endif(DA)
+
+# ROOT configuration mandatory
+if(ROOTSYS)
+    find_package(ROOT REQUIRED)
+
+    # ROOT must be build with XML2 support
+    if(NOT ROOT_HASXML)
+        message(FATAL_ERROR "ROOT was not build with xml2 support. Please reinstall or rebuild ROOT with xml2 support")
+    endif(ROOT_HASXML)
+else()
+    message(FATAL_ERROR "ROOT installation not found!\nPlease point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR")
+endif(ROOTSYS)
 
-#set(EXCLUDEMODULES THydjet SHUTTLE)
+# If no Fortran, i.e on Windows
+# We need to specify ROOT fortran
+# (f95 comes before gfortran in default module)
+include(CheckLanguage)
 
+if(ROOT_FORTRAN)
+    message(STATUS "Using the Fortran compiler defined by ROOT configuration: ${ROOT_FORTRAN}")
+    set(CMAKE_Fortran_COMPILER ${ROOT_FORTRAN})
+else()
+    message(STATUS "Using default system Fortran compiler")
+endif(ROOT_FORTRAN)
 
-# Standard Modules
-# ------------------------------
-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 PYTHIA8 TAmpt )
+check_language(Fortran)
+if(CMAKE_Fortran_COMPILER)
+    enable_language(Fortran OPTIONAL)
+else()
+    message(STATUS "No Fortran support. Disabling LHAPDF, PHYTIA6, MICROCERN, etc.")
+endif()
 
-if(THydjet)
-  list(APPEND ALIROOTMODULES THydjet)
-endif(THydjet)
 
+# DATE
+if(DATE_CONFIG)
+    find_package(DATE)
+endif(DATE_CONFIG)
+
+# daqDA
+if(daqDA)
+    find_package(daqDA)
+endif(daqDA)
+
+# DA is enabled
+if(DA)
+    if(NOT DATE_FOUND)
+        set(DA FALSE)
+        message(FATAL_ERROR "DAs enabled but no DATE support found. Please point to your date installation using \"DATE_CONFIG\"")
+    endif()
+    
+    if(NOT daqDA_FOUND)
+        set(DA FALSE)
+        message(FATAL_ERROR "DAs enabled but no daqDA support found. Please point to your daqDA installation using \"daqDA\" variable")
+    endif()
+    
+    # Enable static libraries
+    set(ALIROOT_STATIC TRUE)
+    message(STATUS "DAs enabled")
+endif(DA)
+
+# FastJet
+find_package(FASTJET)
+
+# ZEROMQ
+find_package(ZeroMQ)
+
+# AliRoot version extracted from Git repository
+# Sets 4 git variables
+#  - GIT_REFSPEC - complete name of the current reference
+#  - ALIROOT_BRANCH - name of the branch or tag extracted from the current reference
+#  - GIT_SHA1 - current hash in the long format
+#  - GIT_SHORT_SHA1 - current hash in the short format
+include(CheckGitVersion)
+
+message(STATUS "CMake platform: ${CMAKE_SYSTEM}")
+message(STATUS "Build folder: ${AliRoot_BINARY_DIR}")
+message(STATUS "Source folder: ${AliRoot_SOURCE_DIR}")
+message(STATUS "Installation folder: ${CMAKE_INSTALL_PREFIX}")
+
+# General flags -> Should be moved into a configuration file
+set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+
+# AliRoot base modules
+add_subdirectory(STEER)
+add_subdirectory(RAW)
+add_subdirectory(ANALYSIS)
+
+# Include Vc own cmake
+include(Vc/Vc.cmake)
+add_subdirectory(Vc)
+
+# AliRoot modules
+add_subdirectory(ACORDE)
+add_subdirectory(AD)
+add_subdirectory(BCM)
+add_subdirectory(CORRFW)
+add_subdirectory(EMCAL)
+add_subdirectory(EPOS)
+add_subdirectory(EVE)
+add_subdirectory(EVGEN)
+add_subdirectory(FASTSIM)
+add_subdirectory(FIT)
+add_subdirectory(FMD)
+add_subdirectory(HLT)
+add_subdirectory(HMPID)
+add_subdirectory(ITS)
+add_subdirectory(JETAN)
+add_subdirectory(MFT)
+add_subdirectory(MONITOR)
+add_subdirectory(MUON)
+add_subdirectory(OADB)
+add_subdirectory(PHOS)
+add_subdirectory(PMD)
+add_subdirectory(PYTHIA8)
+add_subdirectory(STARLIGHT)
+add_subdirectory(STAT)
+add_subdirectory(STRUCT)
+add_subdirectory(T0)
+add_subdirectory(TDPMjet)
+add_subdirectory(TEvtGen)
+add_subdirectory(THerwig)
+add_subdirectory(TOF)
+add_subdirectory(TPC)
+add_subdirectory(TRD)
+add_subdirectory(TRIGGER)
+add_subdirectory(TTherminator)
+add_subdirectory(VZERO)
+add_subdirectory(ZDC)
+
+# Fortran modules
+if(CMAKE_Fortran_COMPILER)
+  add_subdirectory(DIME)
+  add_subdirectory(DPMJET)
+  add_subdirectory(HERWIG)
+  add_subdirectory(HIJING)
+  add_subdirectory(LHAPDF)
+  add_subdirectory(MICROCERN)
+  add_subdirectory(PYTHIA6)
+  add_subdirectory(TEPEMGEN)
+  add_subdirectory(THbtp)
+  add_subdirectory(THijing)
+  add_subdirectory(THydjet)
+  add_subdirectory(TPHIC)
+  add_subdirectory(TUHKMgen)
+  add_subdirectory(TAmpt)
+endif(CMAKE_Fortran_COMPILER)
+
+# Enable SHUTTLE compilation
+# Check if DIMDIR and ODIR are set
 if(SHUTTLE)
-  list(APPEND ALIROOTMODULES SHUTTLE)
+    if(DIMDIR AND ODIR AND ALIEN)
+        add_subdirectory(SHUTTLE)
+    else()
+        message(FATAL_ERROR "SHUTTLE enabled! Please specify DIMDIR, ODIR and ALIEN")
+    endif()
 endif(SHUTTLE)
 
-# Additional Modules
-# ------------------------------
-list(APPEND ALIROOTMODULES TUHKMgen EPOS)
-
-# EVE
-# ------------------------------
-ALICE_RootConfig(EVE --has-opengl)
-if(NOT EVE STREQUAL "no")
-  list(APPEND ALIROOTMODULES EVE)
-endif(NOT EVE STREQUAL "no")
-
-# CERN Modules
-# ------------------------------
-set(CERNMODULES LHAPDF HIJING MICROCERN HERWIG)
-
-# Check for Pythia 6
-if(EXISTS ${ROOTINCDIR}/TPythia6.h)
-  set(PYTHIA6 TRUE)
-  list(APPEND CERNMODULES PYTHIA6 RALICE EVGEN)
-elseif(NOT NOPYTHIA)
-  message(FATAL_ERROR "ROOT must have Pythia6 enabled !")
-endif(EXISTS ${ROOTINCDIR}/TPythia6.h)
-
-# Set Final list of modules 
-set(MODULES ${ALIROOTMODULES} ${CERNMODULES} ALIROOT)
-
-# Set Module directories
-set(MODDIRS ${MODULES})
-
-# Libraries for Linking
-# ------------------------------
-set(ALILIBS MUON TPC PMD TRD FMD TOF ITS PHOS ACORDE HMPID VZERO ZDC STRUCT T0 EVGEN STEER TRIGGER)
-set(LIBS ${ROOTCLIBS} ${ROOTPLIBS} ${SYSLIBS})
-
-# Configure ARVerion.h
-# ------------------------------
-if(Subversion_FOUND)
-  Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
-  set(ALIROOT_SVN_REVISION ${PROJECT_WC_REVISION})
-  set(ALIROOT_SVN_BRANCH ${PROJECT_WC_URL})
-  string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
-  message(STATUS "Aliroot Revision - ${ALIROOT_SVN_REVISION} Branch - ${ALIROOT_SVN_BRANCH}")
-  if(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
-    file(REMOVE ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
-  endif(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
-  configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h @ONLY)
-endif(Subversion_FOUND)
-
-#--------------------------------------------------------------------------------#
-# Build Modules                                                                  #
-#--------------------------------------------------------------------------------#
-
-# Module Variables
-# ------------------------------
-set(ALLLIBS)
-set(ALLEXECS)
-set(INCLUDEFILES)
-set(BINLIBS)
-set(EXPORTFILES)
-
-# Top Level Build Targets
-# ------------------------------
-
-add_custom_target(alilibs-static)
-add_custom_target(include-headers)
-add_custom_target(DA-all)
-add_custom_target(check-all)
-add_custom_target(par-all)
-add_custom_target(test-par-all)
-
-# Add Modules
-# ------------------------------
-foreach(MODULE ${MODDIRS})
-  set(${MODULE}ALIBS)
-  configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
-  add_custom_target(${MODULE}-all ALL)
-  add_custom_target(${MODULE}-check-all)
-  add_custom_target(${MODULE}-par-all)
-  add_custom_target(test-${MODULE}-par-all)
-  add_dependencies(check-all "${MODULE}-check-all")
-  add_custom_target(${MODULE}-all-static)
-  add_dependencies(alilibs-static "${MODULE}-static")
-  add_subdirectory(${MODULE})
-endforeach(MODULE)
-
-if(DATE_FOUND AND AMORE_FOUND)
-  include (CMakeDA)
-endif(DATE_FOUND AND AMORE_FOUND)
-
-#--------------------------------------------------------------------------------#
-# Additional Targets                                                             #
-#--------------------------------------------------------------------------------#
-
-# AliMdc RPM
-# ------------------------------
-
-include (InstallRequiredSystemLibraries)
-include (CPack)
-
+add_subdirectory(ALIROOT)