Skip to content

Commit 7b11aba

Browse files
committed
Generate header providing build-time ENABLE_UPGRADES status
If the O2 was built with ENABLE_UPGRADES, using installed headers dependin on the latter in the compiled macros leads to the conflicts since the ACLIC is not aware of ENABLE_UPGRADES. This PR will generate and install a header which defines ENABLE_UPGRADES if it was used at build-time.
1 parent 0c41caf commit 7b11aba

6 files changed

Lines changed: 49 additions & 3 deletions

File tree

DataFormats/Detectors/Common/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ o2_target_root_dictionary(
3434
include/DetectorsCommonDataFormats/CTFHeader.h
3535
include/DetectorsCommonDataFormats/DetMatrixCache.h)
3636

37+
configure_file(UpgradesStatus.h.in
38+
${CMAKE_CURRENT_BINARY_DIR}/include/DetectorsCommonDataFormats/UpgradesStatus.h)
39+
40+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/DetectorsCommonDataFormats/UpgradesStatus.h
41+
DESTINATION include/DetectorsCommonDataFormats)
42+
3743
o2_add_test(DetID
3844
SOURCES test/testDetID.cxx
3945
PUBLIC_LINK_LIBRARIES O2::DetectorsCommonDataFormats
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef O2_UPGRADES_STATUS_H
12+
#define O2_UPGRADES_STATUS_H
13+
14+
// cmake-generated define to make installed headers aware of what was used at build-time
15+
#cmakedefine ENABLE_UPGRADES
16+
17+
#endif

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "GPUCommonRtypes.h"
3131
#include "GPUCommonBitSet.h"
3232
#include "MathUtils/Utils.h"
33+
#include "DetectorsCommonDataFormats/UpgradesStatus.h"
3334
#ifndef GPUCA_GPUCODE_DEVICE
3435
#include "Headers/DataHeader.h"
3536
#include <array>
@@ -143,6 +144,15 @@ class DetID
143144

144145
#endif // GPUCA_GPUCODE_DEVICE
145146

147+
static bool upgradesEnabled()
148+
{
149+
#ifdef ENABLE_UPGRADES
150+
return true;
151+
#else
152+
return false;
153+
#endif
154+
}
155+
146156
private:
147157
// are 2 strings equal ? (trick from Giulio)
148158
GPUdi() static constexpr bool sameStr(char const* x, char const* y)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef O2_UPGRADES_STATUS_H
12+
#define O2_UPGRADES_STATUS_H
13+
#endif
14+
// dummy header, will be regenerated and installed at built time from UpgradesStatus.h.in

DataFormats/Headers/include/Headers/DataHeader.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,13 +565,11 @@ constexpr o2::header::DataOrigin gDataOriginTOF{"TOF"};
565565
constexpr o2::header::DataOrigin gDataOriginTPC{"TPC"};
566566
constexpr o2::header::DataOrigin gDataOriginTRD{"TRD"};
567567
constexpr o2::header::DataOrigin gDataOriginZDC{"ZDC"};
568-
#ifdef ENABLE_UPGRADES
568+
569569
constexpr o2::header::DataOrigin gDataOriginIT3{"IT3"};
570570
constexpr o2::header::DataOrigin gDataOriginTRK{"TRK"};
571571
constexpr o2::header::DataOrigin gDataOriginFT3{"FT3"};
572572

573-
#endif
574-
575573
//possible data types
576574
constexpr o2::header::DataDescription gDataDescriptionAny{"***************"};
577575
constexpr o2::header::DataDescription gDataDescriptionInvalid{"INVALID_DESC"};

macro/build_geometry.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "FairRunSim.h"
4444
#include <FairLogger.h>
4545
#include <algorithm>
46+
#include "DetectorsCommonDataFormats/UpgradesStatus.h"
4647
#endif
4748

4849
#ifdef ENABLE_UPGRADES

0 commit comments

Comments
 (0)