Skip to content

Commit 316899a

Browse files
authored
Merge pull request #5 from emornacchi/master
Patch to compile with Geant4 > 10.6
2 parents ed4ae8a + 3a1ca8d commit 316899a

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ else()
2424
find_package(Geant4 REQUIRED)
2525
endif()
2626

27+
# In Geant4 > 10.6 the preprocessing macros for excluding UI and VIS
28+
# are not available anymore. Preprocess variable GEANT4_GT_10_6
29+
# is used to exclude checks on UI and VIS in A2.cc file.
30+
if ( Geant4_VERSION GREATER_EQUAL 10.6 )
31+
message(STATUS "Configuring A2Geant4 for Geant4 version >= 10.6")
32+
add_compile_definitions(GEANT4_GT_10_6=1)
33+
endif()
34+
2735
# define variables
2836
set(EXT_LIBRARIES)
2937

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ August 17, 2018
4949
## Installation
5050

5151
### Dependencies
52-
* Geant4 10.2/10.3/10.4/10.5
52+
* Geant4 10.2/10.3/10.4/10.5/10.6/10.7
5353
* ROOT 5 or 6
5454
* CMake 3.3
5555
* Optional: Qt 4 or 5
@@ -69,8 +69,11 @@ tar xvfz geant4.10.04.p02.tar.gz
6969
Create a build directory (not inside the source directory) and run cmake. Set
7070
CMAKE_INSTALL_PREFIX to the final installation location and GEANT4_USE_QT to ON
7171
if you want to use the graphical user interface. Set GEANT4_INSTALL_DATA to ON
72-
so the large data packages will be downloaded automatically. Set N to the number
73-
of CPU cores to speed up the compilation process:
72+
so the large data packages will be downloaded automatically.
73+
Modern versions of ROOT require at least C++-14. In such cases, you need to
74+
tell the compiler to use C++-14 standards here as well, by adding
75+
-DCMAKE_CXX_STANDARD=14 to the cmake line.
76+
Set N to the number of CPU cores to speed up the compilation process:
7477
```
7578
cd /tmp
7679
mkdir build

src/A2.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@
1717
#include "G4UIQt.hh"
1818
#include "G4Qt.hh"
1919
#endif
20+
#ifdef GEANT4_GT_10_6
21+
#include "G4VisExecutive.hh"
22+
#include "G4UIExecutive.hh"
23+
#else
2024
#ifdef G4VIS_USE
2125
#include "G4VisExecutive.hh"
2226
#endif
2327
#ifdef G4UI_USE
2428
#include "G4UIExecutive.hh"
2529
#endif
30+
#endif
2631

2732
#include "A2DetectorConstruction.hh"
2833
#include "A2PhysicsList.hh"

0 commit comments

Comments
 (0)