]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CMakeLists.txt
doxy: TPC/macros root converted
[u/mrichter/AliRoot.git] / CMakeLists.txt
index cb18d66da9ce4391313bc3c415581a67bfee008d..fcc380cb8165ccb992e3692c0375d4d2a584cafb 100644 (file)
@@ -21,6 +21,27 @@ cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 
 project(AliRoot CXX C)
 
+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}")
+
+# CMake supports different build types by default. We want the DEBUG build type
+# to have "-g -O0" flags: by default it only has "-g"
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+
+# You can change the build type using
+# cmake -DCMAKE_BUILD_TYPE=DEBUG | RELEASE | RELWITHDEBINFO | MINSIZEREL ...
+if (NOT CMAKE_BUILD_TYPE)
+  set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE} (${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}})")
+
+if(CMAKE_INSTALL_PREFIX STREQUAL "${AliRoot_SOURCE_DIR}")
+    message(FATAL_ERROR "Please choose a different installation point than the source tree!")
+endif()
+
 # Path to additonal modules
 set(CMAKE_MODULE_PATH "${AliRoot_SOURCE_DIR}/cmake")
 
@@ -38,20 +59,23 @@ include(CheckGitVersion)
 #       - GCC_MAJOR.GCC_MINOR.GCC_PATCH
 include(CheckCompiler)
 
-# You can change the build type using 
-# cmake -DCMAKE_BUILD_TYPE=DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL...
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
-endif(NOT CMAKE_BUILD_TYPE)
+# Utility to generate PARfiles
+include(cmake/GenParFile.cmake)
 
-# ROOT dictionaries and maps
-include(CMakeALICE)
+# Shared library suffix
+if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+  set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
+endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
 
 # Checking first for DIM, DATE, AMORE and daqDA 
 # in case ROOT Extra static library needs to be enabled
 
 # DATE
 # date-config needs DIMDIR and ODIR set
+# Setting variables in cache to be accesible by ccmake
+set(DATE_CONFIG CACHE STRING "date-config script location")
+set(DIMDIT CACHE STRING "dim installation folder")
+set(ODIR CACHE STRING "dim plaform, usually \"linux\"")
 if(DATE_CONFIG)
     if(DIMDIR AND ODIR)
         find_package(DATE)
@@ -61,11 +85,15 @@ if(DATE_CONFIG)
 endif()
 
 # daqDA
+# Setting variables in cache to be accesible by ccmake
+set(daqDA CACHE STRING "daqDA library folder installation")
 if(daqDA)
     find_package(daqDA)
 endif(daqDA)
 
 # AMORE
+# Setting variables in cache to be accesible by ccmake
+set(AMORE_CONFIG CACHE STRING "amore-config script location")
 if(AMORE_CONFIG)
     if(ROOTSYS)
         find_package(AMORE)
@@ -74,11 +102,23 @@ if(AMORE_CONFIG)
     endif()
 endif(AMORE_CONFIG)
 
+# id DARPM we enable DA if it is not set
+# Setting variables in cache to be accesible by ccmake
+set(DARPM CACHE STRING "Enable DARPM: ON")
+set(DA CACHE STRING "Enable DA: ON")
+if(DARPM)
+    if(NOT DA)
+        set(DA ON)
+    endif(NOT DA)
+endif(DARPM)
+
 # DA is enabled
+# Setting variables in cache to be accesible by ccmake
+set(ALIROOT_STATIC CACHE STRING "ENABLE static building of AliRoot: ON")
 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)")
+        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)
@@ -102,12 +142,18 @@ if(DA)
 endif(DA)
 
 # MDC rpm creation enables the static build
+# Setting variables in cache to be accesible by ccmake
+set(MDCRPM CACHE STRING "Enable mdc rpm build")
 if(MDCRPM)
     set(ALIROOT_STATIC TRUE)
     message(STATUS "AliMDC RPM enabled. AliRoot static build enabled")
 endif(MDCRPM)
 
 # ROOT configuration mandatory
+# FindRoot has to be after the enabling of DA due to libRootExtra
+# Do not put it above DA
+# Setting variables in cache to be accesible by ccmake
+set(ROOTSYS CACHE STRING "ROOT installation folder")
 if(ROOTSYS)
     find_package(ROOT REQUIRED)
 
@@ -119,6 +165,10 @@ else()
     message(FATAL_ERROR "ROOT installation not found!\nPlease point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR")
 endif(ROOTSYS)
 
+# ROOT dictionaries and maps
+include(CMakeALICE)
+
+
 # If no Fortran, i.e on Windows
 # We need to specify ROOT fortran
 # (f95 comes before gfortran in default module)
@@ -138,32 +188,14 @@ else()
     message(STATUS "No Fortran support. Disabling LHAPDF, PHYTIA6, MICROCERN, etc.")
 endif()
 
-# 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)
+# Optional: Doxygen for reference doc generation
+find_package(Doxygen)
+if(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+    message(STATUS "Doxygen ${DOXYGEN_VERSION} and Graphviz found: ${DOXYGEN_EXECUTABLE}, ${DOXYGEN_DOT_EXECUTABLE}")
+    set(CAN_GENERATE_DOC TRUE)
+else()
+    message(STATUS "Doxygen and Graphviz not found. Disabling support for documentation generation")
+endif(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
 
 # FastJet
 find_package(FASTJET)
@@ -171,15 +203,17 @@ find_package(FASTJET)
 # ZEROMQ
 find_package(ZeroMQ)
 
-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}")
+# Generating the AliRoot-config.cmake file
+configure_file(${PROJECT_SOURCE_DIR}/cmake/AliRoot-config.cmake.in ${CMAKE_BINARY_DIR}/version/AliRoot-config.cmake @ONLY)
+install(FILES ${PROJECT_BINARY_DIR}/version/AliRoot-config.cmake DESTINATION etc)
 
 # General flags -> Should be moved into a configuration file
 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
 set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE)
 
+# List of modules for which PARfiles are enabled -- use the cache as global scope and clean it
+set(ALIPARFILES "" CACHE INTERNAL "ALIPARFILES" FORCE)
+
 # AliRoot base modules
 add_subdirectory(STEER)
 add_subdirectory(RAW)
@@ -189,11 +223,13 @@ add_subdirectory(ANALYSIS)
 include(Vc/Vc.cmake)
 add_subdirectory(Vc)
 
+# AliRoot common macros
+add_subdirectory(macros)
+
 # AliRoot modules
 add_subdirectory(ACORDE)
 add_subdirectory(AD)
 add_subdirectory(BCM)
-add_subdirectory(CORRFW)
 add_subdirectory(EMCAL)
 add_subdirectory(EPOS)
 add_subdirectory(EVE)
@@ -204,11 +240,9 @@ 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)
@@ -226,6 +260,7 @@ add_subdirectory(TRIGGER)
 add_subdirectory(TTherminator)
 add_subdirectory(VZERO)
 add_subdirectory(ZDC)
+add_subdirectory(doxygen)
 
 # Fortran modules
 if(CMAKE_Fortran_COMPILER)
@@ -245,20 +280,20 @@ if(CMAKE_Fortran_COMPILER)
   add_subdirectory(TAmpt)
 endif(CMAKE_Fortran_COMPILER)
 
-# PWG libraries
-add_subdirectory(PWG)
-# Depends on PWGCF - To fix dependencies
-add_subdirectory(PWGGA)
-# Depends on CF and LF - To fix the dependencies
-add_subdirectory(PWGDQ)
-add_subdirectory(PWGJE)
-add_subdirectory(PWGLF)
-# Depends on PP - To fix depedencies
-add_subdirectory(PWGUD)
+add_subdirectory(data)
+add_subdirectory(GRP)
+add_subdirectory(OCDB)
+add_subdirectory(QAref)
 
 # Enable SHUTTLE compilation
 # Check if DIMDIR and ODIR are set
+# # Setting variables in cache to be accesible by ccmake
+set(SHUTTLE CACHE STRING "Enable SHUTTLE build : ON")
 if(SHUTTLE)
+    if(ROOT_HASALIEN STREQUAL "no")
+       message(FATAL_ERROR "Shuttle needs ROOT build with AliEn support. Please build ROOT with AliEn support. Do not forget to set ALIEN to your AliEn installation")
+    endif()
+    
     if(DIMDIR AND ODIR AND ALIEN)
         add_subdirectory(SHUTTLE)
     else()
@@ -267,3 +302,17 @@ if(SHUTTLE)
 endif(SHUTTLE)
 
 add_subdirectory(ALIROOT)
+
+# List modules with PARfiles
+string(REPLACE ";" " " ALIPARFILES_FLAT "${ALIPARFILES}")
+message(STATUS "PARfile target enabled for the following modules: ${ALIPARFILES_FLAT}")
+
+# Install Find macros for common packages to be further used by AliPhysics
+install(FILES 
+           cmake/CMakeALICE.cmake
+           cmake/FindROOT.cmake
+           cmake/FindFASTJET.cmake
+           cmake/FindZeroMQ.cmake
+           cmake/GetGitRevisionDescription.cmake
+           cmake/GetGitRevisionDescription.cmake.in
+       DESTINATION cmake)