-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·146 lines (116 loc) · 5.17 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(GENSIM)
#ROOT path
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
find_package(ROOT REQUIRED)
# Update header file
#add_custom_target( gitinfo ALL COMMAND ${PROJECT_SOURCE_DIR}/pullgitinfo.py ${PROJECT_SOURCE_DIR} COMMENT "Creating gitinfo.hh" )
# this is to ensure we find the header we need
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
#ROOT_GENERATE_DICTIONARY(
# GenSimDict # path to dictionary to generate
# "include/GenSimPrimaryEvent.hh" # list of classes to process
# "include/GenSimTargetEvent.hh"
# "include/GenSimBeamMonitorEvent.hh"
# "include/GenSimMainEvent.hh"
# "include/GenSimPrimaryEventGenerator.hh"
# LINKDEF "include/GenSimLinkDef.hh" # ROOT linkDef file
#)
ROOT_GENERATE_DICTIONARY(
GenSimPrimaryEventDict # path to dictionary to generate
"include/GenSimPrimaryEvent.hh" # list of classes to process
LINKDEF "include/GenSimPrimaryEvent_LinkDef.hh" # ROOT linkDef file
)
ROOT_GENERATE_DICTIONARY(
GenSimADetEventDict
"include/GenSimADetEvent.hh"
LINKDEF "include/GenSimADetEvent_LinkDef.hh"
)
ROOT_GENERATE_DICTIONARY(
GenSimMainEventDict
"include/GenSimMainEvent.hh"
LINKDEF "include/GenSimMainEvent_LinkDef.hh"
)
ROOT_GENERATE_DICTIONARY(
GenSimPrimaryEventGeneratorDict
"include/GenSimPrimaryEventGenerator.hh"
LINKDEF "include/GenSimPrimaryEventGenerator_LinkDef.hh" # ROOT linkDef file
)
#----------------------------------------------------------------------------
# Find Boost libraries, in particular iostreams
if(USE_BOOST)
find_package(Boost COMPONENTS iostreams)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIR})
ADD_DEFINITIONS(-D__USE_BOOST)
if(Boost_IOSTREAMS_FOUND)
ADD_DEFINITIONS(-D__USE_BOOST_IOSTREAMS)
endif()
endif()
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
# Setup include directory for this project
#
include(${Geant4_USE_FILE})
#debugging symbols, complains
set(CMAKE_CXX_FLAGS "-g -Wall -pg")
#----------------------------------------------------------------------------
# Generate dictionaries as well (so we can write objects to ROOT files
include_directories(${PROJECT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/GenSim*.cc)
#file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh)
file(GLOB libsources ${PROJECT_SOURCE_DIR}/src/GenSimPrimaryEvent.cc ${PROJECT_SOURCE_DIR}/src/GenSimADetEvent.cc ${PROJECT_SOURCE_DIR}/src/GenSimMainEvent.cc ${PROJECT_SOURCE_DIR}/src/GenSimPrimaryEventGenerator.cc)
file(GLOB libheaders ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(GenSim GenSim.cc ${sources} ${headers} GenSimMainEventDict.cxx GenSimPrimaryEventGeneratorDict.cxx GenSimADetEventDict.cxx GenSimPrimaryEventDict.cxx)
add_library(libGenSim SHARED ${libsources} ${libheaders} GenSimMainEventDict.cxx GenSimPrimaryEventGeneratorDict.cxx GenSimADetEventDict.cxx GenSimPrimaryEventDict.cxx)
target_link_libraries(GenSim ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES} )
target_link_libraries(libGenSim ${ROOT_LIBRARIES} ${Boost_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build remoll. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
#FILE( GLOB REMOLL_GEO "geometry/*" )
set(N3HESIM_SCRIPTS
macros/myRun.mac
macros/vis.mac
macros/gui.mac
macros/Qt.mac
)
foreach(_script ${N3HESIM_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
#
add_custom_target(N3HESIM DEPENDS GenSim)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS GenSim DESTINATION bin)