-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt.default
150 lines (117 loc) · 5.76 KB
/
CMakeLists.txt.default
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
145
146
147
148
149
150
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
############ Make your changes here ############
#set(CMAKE_INSTALL_RPATH "${CMAKE_CURRENT_SOURCE_DIR}/lib")
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_STANDARD 17)
SET(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,$ORIGIN")
string(TIMESTAMP timeVar)
string(REPLACE ":" "_" time ${timeVar})
EXECUTE_PROCESS(COMMAND "date" "+%d_%m_%Y" ${date})
set(name MilliQan) # equivalent to "name := exampleN01" in G4 GNUmakefiles
set(useROOT true) # use true or false
############ What's below should not need to be changed ############
# http://www.cmake.org/cmake/help/cmake_tutorial.html
# http://www.cmake.org/cmake/help/cmake2.6docs.html
# http://www.cmake.org/Wiki/CMake_FAQ
set(mymain ${name}.cc )
set(myexe ${name}${time}${date} )
set(myproj ${name}_ ) # any name as long as it is different from myexe
project(${myproj})
#----------------------------------------------------------------------------
# CMakeModules
#----------------------------------------------------------------------------
set(CMAKE_PREFIX_PATH "$ENV{ROOTSYS}/cmake")
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
# 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()
include(${Geant4_USE_FILE})
set(Geant4_INCLUDE_DIRS "${_use_geant4_dir}/../../include/Geant4")
# find ROOT6 cling
find_package(ROOT 6.00 COMPONENTS Cling Physics)
# find ROOT5 cint
#find_package(ROOT 5.30 COMPONENTS Cintex)
include(${ROOT_USE_FILE})
#set(Boost_INCLUDE_DIRS "/cvmfs/cms.cern.ch/slc7_amd64_gcc900/external/boost/1.67.0/include")
set(Boost_INCLUDE_DIRS "/home/collin/CERN/boost_1_81_0")
option(ANALYSIS_HH_ "Build with ROOT" 1)
add_definitions(-DG4UI_USE -DG4VIS_USE -DANALYSIS_HH_)
message("ROOTSYS: " $ENV{ROOTSYS})
message("GEANT4 INCLUDE DIRS: " ${Geant4_INCLUDE_DIRS})
message("BOOST INCLUDE DIRS: " ${Boost_INCLUDE_DIRS})
message("PROJECT DIRECTORY: " ${CMAKE_CURRENT_SOURCE_DIR})
#----------------------------------------------------------------------------
# Setup include directories and compile definitions
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# ROOTIO
#----------------------------------------------------------------------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIRS}
${ROOT_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
#include files for ROOT dictionary
set(INCLUDE_DICT ${CMAKE_CURRENT_SOURCE_DIR}/include/mqGammaTrack.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqNeutronTrack.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqMuonTrack.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqElectronTrack.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqMCPTrack.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqPhotonTrack.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqPMTRHit.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqScintRHit.hh
${CMAKE_CURRENT_SOURCE_DIR}/include/mqROOTEvent.hh
)
#source files for ROOT dictionary
set(SRC_DICT ${CMAKE_CURRENT_SOURCE_DIR}/src/mqGammaTrack.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqNeutronTrack.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqMuonTrack.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqElectronTrack.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqMCPTrack.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqPhotonTrack.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqPMTRHit.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqScintRHit.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/mqROOTEvent.cc
)
#----------------------------------------------------------------------------
# Use this for ROOT Linkdef
#----------------------------------------------------------------------------
ROOT_GENERATE_DICTIONARY(MilliQanDict ${INCLUDE_DICT} LINKDEF include/EventLinkDef.hh)
add_library(${name}Core SHARED ${SRC_DICT} ${CMAKE_CURRENT_BINARY_DIR}/MilliQanDict.cxx)
add_executable(${name} ${name}.cc ${sources})
set_target_properties(${name} PROPERTIES LINK_FLAGS "-Wl,-rpath,./")
target_link_libraries(${name} ${name}Core ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} )
#----------------------------------------------------------------------------
# Use this for reflex
#----------------------------------------------------------------------------
#REFLEX_GENERATE_DICTIONARY(Classes include/Classes.hh SELECTION xml/selection.xml)
#
#add_library(ClassesDict SHARED ${sources} Classes.cpp)
#
#target_link_libraries(ClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} Cintex Reflex)
#
#set(libsuffix .so)
#
#set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} SUFFIX ${libsuffix})
#
#add_executable(readEventInformation readEventInformation.C )
#
#target_link_libraries(readEventInformation ClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} Cintex)
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this example standalone
#----------------------------------------------------------------------------
add_custom_target(${myproj} DEPENDS ${myexe})
#----------------------------------------------------------------------------
# OPTIONAL: Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#----------------------------------------------------------------------------
#install(TARGETS ${myexe} DESTINATION bin)