Skip to content

Commit 4b75256

Browse files
committed
Implemented optional modular build:
- triggered with ALICEO2_MODULAR_BUILD option - does not require the environment variables SIMPATH and FAIRROOTPATH
1 parent 2b74ab0 commit 4b75256

11 files changed

Lines changed: 93 additions & 41 deletions

File tree

Base/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
set(INCLUDE_DIRECTORIES
22
${CMAKE_SOURCE_DIR}/Base
3+
${Boost_INCLUDE_DIRS}
4+
${FAIRROOT_INCLUDE_DIR}
35
${BASE_INCLUDE_DIRECTORIES}
46
${ROOT_INCLUDE_DIR}
57
)

CMakeLists.txt

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,30 @@ project(ALICEO2)
1616
#ENABLE_LANGUAGE(Fortran)
1717

1818
# Check for needed environment variables
19-
IF(NOT DEFINED ENV{FAIRROOTPATH})
20-
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.")
21-
ENDIF(NOT DEFINED ENV{FAIRROOTPATH})
22-
23-
IF(NOT DEFINED ENV{SIMPATH})
24-
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.")
25-
ENDIF(NOT DEFINED ENV{SIMPATH})
26-
27-
SET(SIMPATH $ENV{SIMPATH})
28-
SET(FAIRROOTPATH $ENV{FAIRROOTPATH})
29-
30-
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
31-
# is checked
32-
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
33-
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})
34-
35-
Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
19+
#If not stop execution unless modular build is activated
20+
Option(ALICEO2_MODULAR_BUILD "Modular build without environment variables" OFF)
21+
if(NOT ALICEO2_MODULAR_BUILD)
22+
IF(NOT DEFINED ENV{FAIRROOTPATH})
23+
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.")
24+
ENDIF(NOT DEFINED ENV{FAIRROOTPATH})
25+
26+
IF(NOT DEFINED ENV{SIMPATH})
27+
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.")
28+
ENDIF(NOT DEFINED ENV{SIMPATH})
29+
30+
SET(SIMPATH $ENV{SIMPATH})
31+
SET(FAIRROOTPATH $ENV{FAIRROOTPATH})
32+
33+
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
34+
# is checked
35+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
36+
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})
37+
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH})
38+
39+
Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
40+
else(NOT ALICEO2_MODULAR_BUILD)
41+
find_package(Boost REQUIRED)
42+
endif(NOT ALICEO2_MODULAR_BUILD)
3643

3744
find_package(FairRoot)
3845

@@ -88,32 +95,42 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR()
8895

8996
find_package(ROOT 5.32.00 REQUIRED)
9097
find_package(Pythia8)
91-
find_package(GENERATORS REQUIRED)
92-
find_package(GEANT3 REQUIRED)
93-
find_package(GEANT4)
94-
find_package(GEANT4DATA)
95-
find_package(GEANT4VMC)
96-
find_package(CLHEP)
98+
find_package(Pythia6)
99+
if(ALICEO2_MODULAR_BUILD)
100+
# Geant3, Geant4 installed via cmake
101+
find_package(Geant3 REQUIRED)
102+
find_package(Geant4 REQUIRED)
103+
else(ALICEO2_MODULAR_BUILD)
104+
# For old versions of VMC packages (to be removed)
105+
find_package(GEANT3 REQUIRED)
106+
find_package(GEANT4)
107+
find_package(GEANT4DATA)
108+
find_package(GEANT4VMC)
109+
find_package(CLHEP)
110+
endif(ALICEO2_MODULAR_BUILD)
97111
find_package(CERNLIB)
98112
find_package(HEPMC)
99113

100-
Set(Boost_NO_SYSTEM_PATHS TRUE)
101-
Set(Boost_NO_BOOST_CMAKE TRUE)
102-
If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
103-
set(BOOST_ROOT ${SIMPATH})
104-
set(GSL_DIR ${SIMPATH})
105-
Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
106-
set(BOOST_ROOT ${SIMPATH}/basics/boost)
107-
set(GSL_DIR ${SIMPATH}/basics/gsl)
108-
EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
109-
Message("-- Looking for Boost ...")
110-
# If an older version of boost is found both of the variables below are
111-
# cached and in a second cmake run, a good boost version is found even
112-
# if the version is to old.
113-
# To overcome this problem both variables are cleared before checking
114-
# for boost.
115-
Unset(Boost_INCLUDE_DIR CACHE)
116-
Unset(Boost_LIBRARY_DIRS CACHE)
114+
115+
if(NOT BOOST_ROOT)
116+
Set(Boost_NO_SYSTEM_PATHS TRUE)
117+
Set(Boost_NO_BOOST_CMAKE TRUE)
118+
If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
119+
set(BOOST_ROOT ${SIMPATH})
120+
set(GSL_DIR ${SIMPATH})
121+
Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
122+
set(BOOST_ROOT ${SIMPATH}/basics/boost)
123+
set(GSL_DIR ${SIMPATH}/basics/gsl)
124+
EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
125+
Message("-- Looking for Boost ...")
126+
# If an older version of boost is found both of the variables below are
127+
# cached and in a second cmake run, a good boost version is found even
128+
# if the version is to old.
129+
# To overcome this problem both variables are cleared before checking
130+
# for boost.
131+
Unset(Boost_INCLUDE_DIR CACHE)
132+
Unset(Boost_LIBRARY_DIRS CACHE)
133+
endif(NOT BOOST_ROOT)
117134
find_package(Boost 1.41)
118135
If (Boost_FOUND)
119136
Set(Boost_Avail 1)
@@ -123,7 +140,9 @@ EndIf (Boost_FOUND)
123140

124141
# set a variable which should be used in all CMakeLists.txt
125142
# Defines all basic include directories from fairbase
126-
SetBasicVariables()
143+
if(NOT ALICEO2_MODULAR_BUILD)
144+
SetBasicVariables()
145+
endif(NOT ALICEO2_MODULAR_BUILD)
127146

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

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

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

178+
else(NOT ALICEO2_MODULAR_BUILD)
179+
# This needs to be improved
180+
# (hopefully by making CheckCXX11Features working also with this build option)
181+
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
182+
endif(NOT ALICEO2_MODULAR_BUILD)
183+
157184
# Recurse into the given subdirectories. This does not actually
158185
# cause another cmake executable to run. The same process will walk through
159186
# the project's entire directory structure.

Data/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
set(INCLUDE_DIRECTORIES
22
${CMAKE_SOURCE_DIR}/Data
3+
${Boost_INCLUDE_DIRS}
4+
${FAIRROOT_INCLUDE_DIR}
5+
${AlFa_DIR}/include
36
${BASE_INCLUDE_DIRECTORIES}
47
${ROOT_INCLUDE_DIR}
58
)

Generators/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
set(INCLUDE_DIRECTORIES
66
${ROOT_INCLUDE_DIR}
7+
${FAIRROOT_INCLUDE_DIR}
8+
${AlFa_DIR}/include
79
${PYTHIA8_INCLUDE_DIR}
810
${SIMPATH}/include
911
${BASE_INCLUDE_DIRECTORIES}
@@ -15,6 +17,7 @@ include_directories( ${INCLUDE_DIRECTORIES})
1517
set(LINK_DIRECTORIES
1618
${ROOT_LIBRARY_DIR}
1719
${FAIRROOT_LIBRARY_DIR}
20+
${AlFa_DIR}/lib
1821
${SIMPATH}/lib
1922
)
2023

devices/alicehlt/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ set(INCLUDE_DIRECTORIES
22
${BASE_INCLUDE_DIRECTORIES}
33
${ZMQ_INCLUDE_DIR}
44
${Boost_INCLUDE_DIR}
5+
${FAIRROOT_INCLUDE_DIR}
6+
${AlFa_DIR}/include
57
${CMAKE_SOURCE_DIR}/devices/alicehlt
68
)
79

@@ -14,6 +16,7 @@ include_directories(${INCLUDE_DIRECTORIES})
1416
set(LINK_DIRECTORIES
1517
${FAIRROOT_LIBRARY_DIR}
1618
${Boost_LIBRARY_DIRS}
19+
${AlFa_DIR}/lib
1720
)
1821

1922
link_directories(${LINK_DIRECTORIES})

devices/flp2epn-distributed/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set(INCLUDE_DIRECTORIES
22
${BASE_INCLUDE_DIRECTORIES}
33
${Boost_INCLUDE_DIR}
4+
${FAIRROOT_INCLUDE_DIR}
5+
${AlFa_DIR}/include
46
${CMAKE_SOURCE_DIR}/devices/flp2epn-distributed
57
)
68

@@ -13,6 +15,7 @@ configure_file(
1315
set(LINK_DIRECTORIES
1416
${Boost_LIBRARY_DIRS}
1517
${FAIRROOT_LIBRARY_DIR}
18+
${AlFa_DIR}/lib
1619
)
1720

1821
link_directories(${LINK_DIRECTORIES})

devices/flp2epn-dynamic/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set(INCLUDE_DIRECTORIES
22
${BASE_INCLUDE_DIRECTORIES}
33
${Boost_INCLUDE_DIR}
4+
${FAIRROOT_INCLUDE_DIR}
5+
${AlFa_DIR}/include
46
${CMAKE_SOURCE_DIR}/devices/flp2epn-dynamic
57
)
68

@@ -11,6 +13,7 @@ configure_file( ${CMAKE_SOURCE_DIR}/devices/flp2epn-dynamic/run/startFLP2EPN-dyn
1113
set(LINK_DIRECTORIES
1214
${Boost_LIBRARY_DIRS}
1315
${FAIRROOT_LIBRARY_DIR}
16+
${AlFa_DIR}/lib
1417
)
1518

1619
link_directories(${LINK_DIRECTORIES})

devices/flp2epn/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set(INCLUDE_DIRECTORIES
22
${BASE_INCLUDE_DIRECTORIES}
33
${Boost_INCLUDE_DIR}
4+
${FAIRROOT_INCLUDE_DIR}
5+
${AlFa_DIR}/include
46
${CMAKE_SOURCE_DIR}/devices/flp2epn
57
)
68

@@ -12,6 +14,7 @@ configure_file( ${CMAKE_SOURCE_DIR}/devices/flp2epn/run/startMerger.sh.in ${CMAK
1214
set(LINK_DIRECTORIES
1315
${Boost_LIBRARY_DIRS}
1416
${FAIRROOT_LIBRARY_DIR}
17+
${AlFa_DIR}/lib
1518
)
1619

1720
link_directories(${LINK_DIRECTORIES})

field/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(INCLUDE_DIRECTORIES
66
${CMAKE_SOURCE_DIR}/field
77
${CMAKE_SOURCE_DIR}/header
88
${BASE_INCLUDE_DIRECTORIES}
9+
${FAIRROOT_INCLUDE_DIR}
910
${ROOT_INCLUDE_DIR}
1011
)
1112

its/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ ${CMAKE_SOURCE_DIR}
33
${CMAKE_SOURCE_DIR}/its
44
${CMAKE_SOURCE_DIR}/header
55
${BASE_INCLUDE_DIRECTORIES}
6+
${Boost_INCLUDE_DIRS}
7+
${FAIRROOT_INCLUDE_DIR}
8+
${AlFa_DIR}/include
69
${ROOT_INCLUDE_DIR}
710
)
811

0 commit comments

Comments
 (0)