-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
104 lines (90 loc) · 3.9 KB
/
CMakeLists.txt
File metadata and controls
104 lines (90 loc) · 3.9 KB
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
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(pinpoint)
set(CMAKE_BUILD_TYPE Release)
##----------------------------------------------------------------------------
# Find Pythia8 (required package)
set(PYTHIA8_PREFIX "/cvmfs/sft.cern.ch/lcg/views/LCG_107/x86_64-el9-gcc11-opt")
add_library(Pythia8::Pythia8 UNKNOWN IMPORTED)
set_target_properties(Pythia8::Pythia8 PROPERTIES
IMPORTED_LOCATION "${PYTHIA8_PREFIX}/lib/libpythia8.so"
INTERFACE_INCLUDE_DIRECTORIES "${PYTHIA8_PREFIX}/include"
)
#----------------------------------------------------------------------------
# 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
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Find HepMC3 (required package)
#
find_package(HepMC3 REQUIRED) # <-- For HepMC3
# find_package(HepMC REQUIRED) # <-- For HepMC2
#----------------------------------------------------------------------------
# Find ROOT (required package)
#
find_package(ROOT REQUIRED COMPONENTS Geom EG RIO)
include(${ROOT_USE_FILE})
message(STATUS "Set ROOT : ${ROOT_USE_FILE}")
message(STATUS "ROOT : ${ROOT_LIBRARIES}")
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR}
${HEPMC3_INCLUDE_DIR}
${ROOT_INCLUDE_DIR}
${PYTHIA8_INCLUDE_DIRS}
)
file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/src/*.cc
${PROJECT_SOURCE_DIR}/src/reco/*.cc
${PROJECT_SOURCE_DIR}/src/generators/*.cc)
file(GLOB_RECURSE headers ${PROJECT_SOURCE_DIR}/include/*.hh
${PROJECT_SOURCE_DIR}/include/reco/*.hh
${PROJECT_SOURCE_DIR}/include/generators/*.hh)
file(GLOB_RECURSE macros RELATIVE ${PROJECT_SOURCE_DIR} macros/*.mac)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build pinpoint. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
# Enable macros for out-of-source build
foreach(_file ${macros})
configure_file(
${_file}
${PROJECT_BINARY_DIR}/${_file}
COPYONLY
)
#message(STATUS "Copying ${_file} in ${PROJECT_BINARY_DIR}/${_file}")
endforeach()
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(pinpoint /afs/cern.ch/work/d/dchouhan/work/Pinpoint_G4/Pinpoint/Pinpoint.cc ${sources})
# add_compile_definitions(G4MULTITHREADED)
target_link_libraries(pinpoint
${Geant4_LIBRARIES}
${HEPMC3_LIBRARIES}
${HEPMC3_FIO_LIBRARIES}
${HEPMC3_LIB}
${ROOT_LIBRARIES}
Pythia8::Pythia8
)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS pinpoint DESTINATION bin)