-
Notifications
You must be signed in to change notification settings - Fork 224
/
CMakeLists.txt
94 lines (77 loc) · 2.97 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
cmake_minimum_required(VERSION 3.0)
project(Delphes)
add_compile_options(-fPIC -Wall -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL)
# Set the runtime path of the libraries by default but allow to switch it off:
option(SET_RPATH "Set runtime path of the ${project} libraries?" ON)
IF(SET_RPATH)
# Set up the RPATH so executables find the libraries even when installed in non-default location
SET(CMAKE_MACOSX_RPATH 1)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# Add the automatically determined parts of the RPATH which point to directories outside
# the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF(${isSystemDir} EQUAL -1)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF(${isSystemDir} EQUAL -1)
ENDIF(SET_RPATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
# Declare ROOT dependency
find_package(ROOT COMPONENTS EG Eve Geom Gui GuiHtml GenVector Hist Physics Matrix Graf RIO Tree Gpad RGL MathCore)
include(${ROOT_USE_FILE})
# Declare Pythia8 dependancy
find_package(Pythia8)
if(PYTHIA8_FOUND)
include_directories(${PYTHIA8_INCLUDE_DIRS})
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
function(DELPHES_GENERATE_DICTIONARY dictionary)
if(${ROOT_VERSION} LESS 6.0)
ROOT_GENERATE_DICTIONARY(${dictionary} ${ARGN})
else()
ROOT_GENERATE_DICTIONARY(${dictionary} MODULE ${dictionary} ${ARGN})
endif()
endfunction()
# Declare position of all other externals needed
set(DelphesExternals_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external)
add_subdirectory(classes)
add_subdirectory(converters)
add_subdirectory(display)
add_subdirectory(examples)
add_subdirectory(external)
add_subdirectory(modules)
add_subdirectory(readers)
add_subdirectory(cards)
add_library(Delphes SHARED
$<TARGET_OBJECTS:classes>
$<TARGET_OBJECTS:modules>
$<TARGET_OBJECTS:ExRootAnalysis>
$<TARGET_OBJECTS:fastjet>
$<TARGET_OBJECTS:tcl>
$<TARGET_OBJECTS:Hector>
$<TARGET_OBJECTS:PUPPI>
$<TARGET_OBJECTS:TrackCovariance>
)
add_library(DelphesDisplay SHARED
$<TARGET_OBJECTS:classes>
$<TARGET_OBJECTS:display>
$<TARGET_OBJECTS:modules>
$<TARGET_OBJECTS:ExRootAnalysis>
$<TARGET_OBJECTS:fastjet>
$<TARGET_OBJECTS:tcl>
$<TARGET_OBJECTS:Hector>
$<TARGET_OBJECTS:PUPPI>
$<TARGET_OBJECTS:TrackCovariance>
)
target_link_Libraries(Delphes ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
target_link_Libraries(DelphesDisplay ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
if(PYTHIA8_FOUND)
target_link_libraries(Delphes ${PYTHIA8_LIBRARIES} ${CMAKE_DL_LIBS})
target_link_libraries(DelphesDisplay ${PYTHIA8_LIBRARIES} ${CMAKE_DL_LIBS})
endif()
install(TARGETS Delphes DelphesDisplay DESTINATION lib)