Skip to content

Commit

Permalink
Add compile-time consistency check for Celeritas and Geant4 versions (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed Feb 23, 2024
1 parent 23ee7e0 commit 8230b45
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/geocel/GeantGeoUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <G4Threading.hh>
#include <G4TouchableHistory.hh>
#include <G4VPhysicalVolume.hh>
#include <G4Version.hh>
#include <G4ios.hh>

#include "corecel/Assert.hh"
Expand All @@ -34,6 +35,15 @@
#include "ScopedGeantExceptionHandler.hh"
#include "ScopedGeantLogger.hh"

// Check Geant4-reported and CMake-configured versions, mapping from
// Geant4's base-10 XXYZ -> to Celeritas base-16 0xXXYYZZ
static_assert(G4VERSION_NUMBER
== 100 * (CELERITAS_GEANT4_VERSION / 0x10000)
+ 10 * ((CELERITAS_GEANT4_VERSION / 0x100) % 0x100)
+ (CELERITAS_GEANT4_VERSION % 0x100),
"CMake-reported Geant4 version does not match installed "
"<G4Version.hh>: compare to 'celeritas_sys_config.h'");

namespace celeritas
{
namespace
Expand Down

0 comments on commit 8230b45

Please sign in to comment.