forked from mnovak42/hepemshow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
113 lines (95 loc) · 3.71 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.8...3.19)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(hepemshow)
# Have linker set RPATH, not RUNPATH
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags")
#----------------------------------------------------------------------------
# Find G4HepEm (sets G4HepEm_geant4_FOUND if a complete, Geant4 dependent build)
find_package(G4HepEm REQUIRED)
#----------------------------------------------------------------------------
# Find Geant4: only if G4HepEm was built with Geant4
if(G4HepEm_geant4_FOUND)
find_package(Geant4 REQUIRED)
endif()
if(G4HepEm_codi_forward)
message(NOTICE "G4HepEm has been configured with forward-mode AD using CoDiPack, \nso we will build a forward-mode AD version of HepEmShow.")
set(CODI_FORWARD ON) # Actually, not any further change required, as the compile definition and library link have PUBLIC inheritance.
endif()
if(G4HepEm_codi_reverse)
message(NOTICE "G4HepEm has been configured with reverse-mode AD using CoDiPack, \nso we will build a reverse-mode AD version of HepEmShow.")
set(CODI_REVERSE ON) # Actually, not any further change required, as the compile definition and library link have PUBLIC inheritance.
endif()
#-------------------------------------------------------------------------------
# Set the headers, sources and include directory:
# For the Simulation application:
set(headers_SIM
${CMAKE_SOURCE_DIR}/Simulation/include/Box.hh
${CMAKE_SOURCE_DIR}/Simulation/include/EventLoop.hh
${CMAKE_SOURCE_DIR}/Simulation/include/Geometry.hh
${CMAKE_SOURCE_DIR}/Simulation/include/Hist.hh
${CMAKE_SOURCE_DIR}/Simulation/include/Physics.hh
${CMAKE_SOURCE_DIR}/Simulation/include/PrimaryGenerator.hh
${CMAKE_SOURCE_DIR}/Simulation/include/Results.hh
${CMAKE_SOURCE_DIR}/Simulation/include/SteppingLoop.hh
${CMAKE_SOURCE_DIR}/Simulation/include/TrackStack.hh
${CMAKE_SOURCE_DIR}/Simulation/include/URandom.hh
)
set(sources_SIM
${CMAKE_SOURCE_DIR}/Simulation/src/Box.cc
${CMAKE_SOURCE_DIR}/Simulation/src/EventLoop.cc
${CMAKE_SOURCE_DIR}/Simulation/src/Geometry.cc
${CMAKE_SOURCE_DIR}/Simulation/src/Hist.cc
${CMAKE_SOURCE_DIR}/Simulation/src/Physics.cc
${CMAKE_SOURCE_DIR}/Simulation/src/PrimaryGenerator.cc
${CMAKE_SOURCE_DIR}/Simulation/src/Results.cc
${CMAKE_SOURCE_DIR}/Simulation/src/SteppingLoop.cc
${CMAKE_SOURCE_DIR}/Simulation/src/TrackStack.cc
${CMAKE_SOURCE_DIR}/Simulation/src/URandom.cc
)
# For the Data-Generation application: only if G4HepEm was built with Geant4
if(G4HepEm_geant4_FOUND)
set(headers_GEN
${CMAKE_SOURCE_DIR}/DataGeneration/include/G4Setup.hh
)
set(sources_GEN
${CMAKE_SOURCE_DIR}/DataGeneration/src/G4Setup.cc
)
endif()
#----------------------------------------------------------------------------
# Build target(s):
#
# The Simulation application:
add_executable(HepEmShow
${CMAKE_SOURCE_DIR}/HepEmShow.cc
${sources_SIM}
)
target_include_directories(HepEmShow
PRIVATE
${CMAKE_SOURCE_DIR}/Simulation/include/
)
target_link_libraries(HepEmShow
G4HepEm::g4HepEmData
G4HepEm::g4HepEmDataJsonIO
)
# The Data-Generation application: only if G4HepEm was built with Geant4
if(G4HepEm_geant4_FOUND)
add_executable(HepEmShow-DataGeneration
${CMAKE_SOURCE_DIR}/HepEmShow-DataGeneration.cc
${sources_GEN}
)
target_include_directories(HepEmShow-DataGeneration
PRIVATE
${CMAKE_SOURCE_DIR}/DataGeneration/include/
)
target_link_libraries (HepEmShow-DataGeneration
${Geant4_LIBRARIES}
G4HepEm::g4HepEmData
G4HepEm::g4HepEmDataJsonIO
G4HepEm::g4HepEmInit
G4HepEm::g4HepEm
)
endif()