Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented optional modular build: #20

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/Base
${Boost_INCLUDE_DIRS}
${FAIRROOT_INCLUDE_DIR}
${BASE_INCLUDE_DIRECTORIES}
${ROOT_INCLUDE_DIR}
)
Expand Down
109 changes: 68 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,30 @@ project(ALICEO2)
#ENABLE_LANGUAGE(Fortran)

# Check for needed environment variables
IF(NOT DEFINED ENV{FAIRROOTPATH})
MESSAGE(FATAL_ERROR "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot. Please set this variable and execute cmake again.")
ENDIF(NOT DEFINED ENV{FAIRROOTPATH})

IF(NOT DEFINED ENV{SIMPATH})
MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.")
ENDIF(NOT DEFINED ENV{SIMPATH})

SET(SIMPATH $ENV{SIMPATH})
SET(FAIRROOTPATH $ENV{FAIRROOTPATH})

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
# is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})

Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
#If not stop execution unless modular build is activated
Option(ALICEO2_MODULAR_BUILD "Modular build without environment variables" OFF)
if(NOT ALICEO2_MODULAR_BUILD)
IF(NOT DEFINED ENV{FAIRROOTPATH})
MESSAGE(FATAL_ERROR "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot. Please set this variable and execute cmake again.")
ENDIF(NOT DEFINED ENV{FAIRROOTPATH})

IF(NOT DEFINED ENV{SIMPATH})
MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.")
ENDIF(NOT DEFINED ENV{SIMPATH})

SET(SIMPATH $ENV{SIMPATH})
SET(FAIRROOTPATH $ENV{FAIRROOTPATH})

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
# is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH})

Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
else(NOT ALICEO2_MODULAR_BUILD)
find_package(Boost REQUIRED)
endif(NOT ALICEO2_MODULAR_BUILD)

find_package(FairRoot)

Expand Down Expand Up @@ -88,32 +95,42 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR()

find_package(ROOT 5.32.00 REQUIRED)
find_package(Pythia8)
find_package(GENERATORS REQUIRED)
find_package(GEANT3 REQUIRED)
find_package(GEANT4)
find_package(GEANT4DATA)
find_package(GEANT4VMC)
find_package(CLHEP)
find_package(Pythia6)
if(ALICEO2_MODULAR_BUILD)
# Geant3, Geant4 installed via cmake
find_package(Geant3 REQUIRED)
find_package(Geant4 REQUIRED)
else(ALICEO2_MODULAR_BUILD)
# For old versions of VMC packages (to be removed)
find_package(GEANT3 REQUIRED)
find_package(GEANT4)
find_package(GEANT4DATA)
find_package(GEANT4VMC)
find_package(CLHEP)
endif(ALICEO2_MODULAR_BUILD)
find_package(CERNLIB)
find_package(HEPMC)

Set(Boost_NO_SYSTEM_PATHS TRUE)
Set(Boost_NO_BOOST_CMAKE TRUE)
If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
set(BOOST_ROOT ${SIMPATH})
set(GSL_DIR ${SIMPATH})
Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
set(BOOST_ROOT ${SIMPATH}/basics/boost)
set(GSL_DIR ${SIMPATH}/basics/gsl)
EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
Message("-- Looking for Boost ...")
# If an older version of boost is found both of the variables below are
# cached and in a second cmake run, a good boost version is found even
# if the version is to old.
# To overcome this problem both variables are cleared before checking
# for boost.
Unset(Boost_INCLUDE_DIR CACHE)
Unset(Boost_LIBRARY_DIRS CACHE)

if(NOT BOOST_ROOT)
Set(Boost_NO_SYSTEM_PATHS TRUE)
Set(Boost_NO_BOOST_CMAKE TRUE)
If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
set(BOOST_ROOT ${SIMPATH})
set(GSL_DIR ${SIMPATH})
Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
set(BOOST_ROOT ${SIMPATH}/basics/boost)
set(GSL_DIR ${SIMPATH}/basics/gsl)
EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
Message("-- Looking for Boost ...")
# If an older version of boost is found both of the variables below are
# cached and in a second cmake run, a good boost version is found even
# if the version is to old.
# To overcome this problem both variables are cleared before checking
# for boost.
Unset(Boost_INCLUDE_DIR CACHE)
Unset(Boost_LIBRARY_DIRS CACHE)
endif(NOT BOOST_ROOT)
find_package(Boost 1.41)
If (Boost_FOUND)
Set(Boost_Avail 1)
Expand All @@ -123,7 +140,9 @@ EndIf (Boost_FOUND)

# set a variable which should be used in all CMakeLists.txt
# Defines all basic include directories from fairbase
SetBasicVariables()
if(NOT ALICEO2_MODULAR_BUILD)
SetBasicVariables()
endif(NOT ALICEO2_MODULAR_BUILD)

# Set the library version in the main CMakeLists.txt
SET(FAIRROOT_MAJOR_VERSION 0)
Expand All @@ -144,16 +163,24 @@ SET(LD_LIBRARY_PATH ${_LIBDIR} ${LD_LIBRARY_PATH})
#install(DIRECTORY geometry DESTINATION pnd_install
# )

if(NOT ALICEO2_MODULAR_BUILD)
# Check if the compiler support specific C++11 features
# Up to now this is only a check since the code does not use
# any of the features of the new standard
# does not work straightforward
include(CheckCXX11Features)

# Check if the compilation flag -std=c++11 is set
If(NOT CMAKE_CXX_FLAGS)
Message(FATAL_ERROR "No C++11 support found. AliceO2 require C++11 be build.")
EndIF(NOT CMAKE_CXX_FLAGS)

else(NOT ALICEO2_MODULAR_BUILD)
# This needs to be improved
# (hopefully by making CheckCXX11Features working also with this build option)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif(NOT ALICEO2_MODULAR_BUILD)

# Recurse into the given subdirectories. This does not actually
# cause another cmake executable to run. The same process will walk through
# the project's entire directory structure.
Expand Down
3 changes: 3 additions & 0 deletions Data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
set(INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/Data
${Boost_INCLUDE_DIRS}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${BASE_INCLUDE_DIRECTORIES}
${ROOT_INCLUDE_DIR}
)
Expand Down
3 changes: 3 additions & 0 deletions Generators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

set(INCLUDE_DIRECTORIES
${ROOT_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${PYTHIA8_INCLUDE_DIR}
${SIMPATH}/include
${BASE_INCLUDE_DIRECTORIES}
Expand All @@ -15,6 +17,7 @@ include_directories( ${INCLUDE_DIRECTORIES})
set(LINK_DIRECTORIES
${ROOT_LIBRARY_DIR}
${FAIRROOT_LIBRARY_DIR}
${AlFa_DIR}/lib
${SIMPATH}/lib
)

Expand Down
3 changes: 3 additions & 0 deletions devices/alicehlt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
${ZMQ_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${CMAKE_SOURCE_DIR}/devices/alicehlt
)

Expand All @@ -14,6 +16,7 @@ include_directories(${INCLUDE_DIRECTORIES})
set(LINK_DIRECTORIES
${FAIRROOT_LIBRARY_DIR}
${Boost_LIBRARY_DIRS}
${AlFa_DIR}/lib
)

link_directories(${LINK_DIRECTORIES})
Expand Down
3 changes: 3 additions & 0 deletions devices/flp2epn-distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
${Boost_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${CMAKE_SOURCE_DIR}/devices/flp2epn-distributed
)

Expand All @@ -13,6 +15,7 @@ configure_file(
set(LINK_DIRECTORIES
${Boost_LIBRARY_DIRS}
${FAIRROOT_LIBRARY_DIR}
${AlFa_DIR}/lib
)

link_directories(${LINK_DIRECTORIES})
Expand Down
3 changes: 3 additions & 0 deletions devices/flp2epn-dynamic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
${Boost_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${CMAKE_SOURCE_DIR}/devices/flp2epn-dynamic
)

Expand All @@ -11,6 +13,7 @@ configure_file( ${CMAKE_SOURCE_DIR}/devices/flp2epn-dynamic/run/startFLP2EPN-dyn
set(LINK_DIRECTORIES
${Boost_LIBRARY_DIRS}
${FAIRROOT_LIBRARY_DIR}
${AlFa_DIR}/lib
)

link_directories(${LINK_DIRECTORIES})
Expand Down
3 changes: 3 additions & 0 deletions devices/flp2epn/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
${Boost_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${CMAKE_SOURCE_DIR}/devices/flp2epn
)

Expand All @@ -12,6 +14,7 @@ configure_file( ${CMAKE_SOURCE_DIR}/devices/flp2epn/run/startMerger.sh.in ${CMAK
set(LINK_DIRECTORIES
${Boost_LIBRARY_DIRS}
${FAIRROOT_LIBRARY_DIR}
${AlFa_DIR}/lib
)

link_directories(${LINK_DIRECTORIES})
Expand Down
1 change: 1 addition & 0 deletions field/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/field
${CMAKE_SOURCE_DIR}/header
${BASE_INCLUDE_DIRECTORIES}
${FAIRROOT_INCLUDE_DIR}
${ROOT_INCLUDE_DIR}
)

Expand Down
3 changes: 3 additions & 0 deletions its/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/its
${CMAKE_SOURCE_DIR}/header
${BASE_INCLUDE_DIRECTORIES}
${Boost_INCLUDE_DIRS}
${FAIRROOT_INCLUDE_DIR}
${AlFa_DIR}/include
${ROOT_INCLUDE_DIR}
)

Expand Down
1 change: 1 addition & 0 deletions passive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
${CMAKE_SOURCE_DIR}/passive
${FAIRROOT_INCLUDE_DIR}
${ROOT_INCLUDE_DIR}

)
Expand Down