-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
111 lines (95 loc) · 4.18 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
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(msc)
# Find Geant4
SITE_NAME(mySite)
if(${mySite} MATCHES "ifarm*")
set(Geant4_DIR /lustre/expphy/work/hallc/qweak/ciprian/geant41001p02/geant4.10.01.p02/build)
message( "On ifarm using custom geant4_dir: " ${Geant4_DIR})
find_package(Geant4 REQUIRED COMPONENTS qt ui_all vis_all)
execute_process(COMMAND ${Geant4_DIR}/geant4-config --version
OUTPUT_VARIABLE GEANT4_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
if(NOT DEFINED Geant4_DIR)
set(Geant4_DIR $ENV{G4INSTALL}/build)
endif(NOT DEFINED Geant4_DIR)
find_package(Geant4 REQUIRED COMPONENTS qt ui_all vis_all)
execute_process(COMMAND geant4-config --version
OUTPUT_VARIABLE GEANT4_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
execute_process(COMMAND geant4-config --version
OUTPUT_VARIABLE GEANT4_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Found Geant4 ${GEANT4_VERSION}")
message(STATUS "Found Geant4 ${GEANT4_VERSION}")
# Add the project include directory and put all source files in sources
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
if(GEANT4_VERSION VERSION_LESS "10.0.0")
message(STATUS "Geant4 is < 10.0.0: skip building custom physics processes")
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hh)
else(GEANT4_VERSION VERSION_LESS "10.0.0")
message(STATUS "Geant4 > 10.0.0: include building custom physics processes")
file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
file(GLOB_RECURSE headers ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hh)
endif(GEANT4_VERSION VERSION_LESS "10.0.0")
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
# Setup include directory for this project
#
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
message(STATUS "Geant4 include files come from: ${Geant4_USE_FILE}")
# Load ROOT and setup include directory
find_package(ROOT REQUIRED)
include_directories(${ROOT_INCLUDE_DIR})
add_definitions(-std=c++11)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(msc msc.cc ${sources} ${headers})
target_link_libraries(msc ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(calcPMTDD CalcPEsPMTDD.cc ${sources} ${headers})
target_link_libraries(calcPMTDD ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(anaTree anaTree.cc ${sources} ${headers})
target_link_libraries(anaTree ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(anaStp analyzeWithSteps.cc ${sources} ${headers})
target_link_libraries(anaStp ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(multipleAsymSteps multipleAsymSteps.cc)
target_link_libraries(multipleAsymSteps ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(anaWght anaWght.cc)
target_link_libraries(anaWght ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(anaTrk anaTrk.cc)
target_link_libraries(anaTrk ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
add_executable(rotateSpinTst rotateSpinTst.cc)
target_link_libraries(rotateSpinTst ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build msc. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(MSC_SCRIPTS
macros/icons.mac
macros/gui.mac
macros/run.png
macros/init.mac
macros/init_vis.mac
macros/run1.mac
macros/run2.mac
macros/vis.mac
)
foreach(_script ${MSC_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS msc DESTINATION bin)