-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
255 lines (214 loc) · 6.68 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
project(star-travex LANGUAGES CXX)
# Add to path in order to pick up the FindXXX.cmake files included in this project
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# By default build shared libraries but allow the user to change if desired
OPTION(BUILD_SHARED_LIBS "Global flag to cause add_library to create shared libraries if on" ON)
find_package(ROOT COMPONENTS Cint Table HistPainter Minuit Geom Spectrum EG MathMore Eve RGL)
if( ${ROOT_CXX_FLAGS} MATCHES "-m32" )
message(STATUS "Found -m32 option in $ROOT_CXX_FLAGS (root-config). Will add it to $CMAKE_CXX_FLAGS")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" )
set(ENV{PKG_CONFIG_PATH} "/usr/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
endif()
find_package(STAR)
find_package(Boost 1.54.0 COMPONENTS filesystem program_options regex system)
find_package(MySQL)
find_package(LibXml2)
find_package(CURL)
set(CMAKE_CXX_STANDARD 11)
include(cmake/ExternalProject_star-vertex.cmake)
include(cmake/ExternalProject_trackml.cmake)
include(cmake/ExternalProject_travex.cmake)
include_directories(
${Boost_INCLUDE_DIR}
${ROOT_INCLUDE_DIR}
${MYSQL_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIR}
${STAR_INCLUDE_DIRS}
${TRAVEX_INCLUDE_DIR}
${STAR_VERTEX_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
)
root_generate_dictionary(stirootio_dict
stirootio/H2D.h
stirootio/H3D.h
stirootio/Profile2D.h
stirootio/Profile3D.h
stirootio/StiTreeMaker.h
stirootio/TStiEvent.h
stirootio/TStiHit.h
stirootio/TStiHitProxy.h
stirootio/TStiKalmanTrack.h
stirootio/TStiKalmanTrackNode.h
LINKDEF stirootio/stirootioLinkDef.h
)
root_generate_dictionary(gearootio_dict
gearootio/TGeaEvent.h
LINKDEF gearootio/LinkDef.h
)
root_generate_dictionary(stihify_dict
stihify/StiHifyEvent.h
stihify/StiHifyTreeMaker.h
LINKDEF stihify/StiHifyLinkDef.h
)
root_generate_dictionary(stiscan_dict
stiscan/StiScanEvent.h
stiscan/StiScanTreeMaker.h
LINKDEF stiscan/StiScanLinkDef.h
)
add_library(stirootiolib
src/stirootio/H2D.cxx
src/stirootio/H3D.cxx
src/stirootio/PrgOptionProcessor.cxx
src/stirootio/Profile2D.cxx
src/stirootio/Profile3D.cxx
src/stirootio/StiTreeMaker.cxx
src/stirootio/StiVolumeFilter.cxx
src/stirootio/TStiEvent.cxx
src/stirootio/TStiHit.cxx
src/stirootio/TStiHitProxy.cxx
src/stirootio/TStiKalmanTrack.cxx
src/stirootio/TStiKalmanTrackNode.cxx
stirootio_dict.cxx
)
add_library(gearootiolib
src/gearootio/TGeaEvent.cxx
gearootio_dict.cxx
)
add_library(stihifylib
src/stihify/StiHifyEvent.cxx
src/stihify/StiHifyTreeMaker.cxx
src/stihify/StiHifyHistContainer.cxx
src/stihify/StiHifyAnalysisTreeMaker.cxx
src/stihify/StiHifyRatiosHistContainer.cxx
src/stihify/StiHifyPrgOptions.cxx
src/stihify/StiHifyRootFile.cxx
stihify_dict.cxx
)
add_library(stiscanlib
src/stiscan/StiScanEvent.cxx
src/stiscan/StiScanTreeMaker.cxx
src/stiscan/StiScanHistContainer.cxx
src/stiscan/StiScanRatiosHistContainer.cxx
src/stiscan/StiScanHistsByVolume.cxx
src/stiscan/StiScanPrgOptions.cxx
src/stiscan/StiScanRootFile.cxx
stiscan_dict.cxx
)
add_executable(stiscan
src/stiscan/stiscan.cxx
src/common/stiglob.cxx
)
add_dependencies(stiscan travex-proj)
target_link_libraries(stiscan
${TRAVEX_LIBRARIES}
stiscanlib gearootiolib stirootiolib
${STAR_LIBRARIES} ${ROOT_LIBRARIES}
${Boost_LIBRARIES}
${CURL_LIBRARIES} ${MYSQL_LIBRARIES} ${LIBXML2_LIBRARIES}
)
add_executable(stihify
src/stihify/stihify.cxx
src/common/stiglob.cxx
)
add_dependencies(stihify travex-proj)
target_link_libraries(stihify
${TRAVEX_LIBRARIES}
stihifylib stirootiolib
${STAR_LIBRARIES} ${ROOT_LIBRARIES}
${Boost_LIBRARIES}
${CURL_LIBRARIES} ${MYSQL_LIBRARIES} ${LIBXML2_LIBRARIES}
)
add_executable(vtxhist
src/vtxeval/vtxhist.cxx
src/vtxeval/StarEventHistContainer.cxx
src/vtxeval/StarVertexHistContainer.cxx
src/vtxeval/StarVertexHftHistContainer.cxx
src/vtxeval/DecayVertexHists.cxx
src/vtxeval/VertexRootFile.cxx
src/common/stiglob.cxx
)
target_include_directories(vtxhist PRIVATE ${STAR_VERTEX_INCLUDE_DIR})
add_dependencies(vtxhist star-vertex travex-proj)
set(star_libraries_except_vertex ${STAR_LIBRARIES})
list(FILTER star_libraries_except_vertex EXCLUDE REGEX StGenericVertexMaker)
target_link_libraries(vtxhist
${TRAVEX_LIBRARIES}
${STAR_VERTEX_LIBRARIES}
${star_libraries_except_vertex} ${ROOT_LIBRARIES}
${Boost_LIBRARIES}
${CURL_LIBRARIES} ${MYSQL_LIBRARIES} ${LIBXML2_LIBRARIES}
)
add_executable(vtxreco
src/vtxeval/vtxreco.cxx
src/vtxeval/VtxRecoProgramOptions.cxx
src/common/stiglob.cxx
)
add_dependencies(vtxreco travex-proj)
target_link_libraries(vtxreco
${TRAVEX_LIBRARIES}
${STAR_LIBRARIES} ${ROOT_LIBRARIES}
${Boost_LIBRARIES}
${CURL_LIBRARIES} ${MYSQL_LIBRARIES} ${LIBXML2_LIBRARIES}
)
add_executable(stargeo
src/geo/stargeo.cxx
)
target_link_libraries(stargeo
${STAR_LIBRARY_StarRoot}
${STAR_LIBRARY_StChain}
${STAR_LIBRARY_StUtilities}
${STAR_LIBRARY_St_base}
${STAR_LIBRARY_StarGeometry}
${STAR_LIBRARY_StarAgmlLib}
${STAR_LIBRARY_StarAgmlUtil}
${ROOT_LIBRARIES}
${Boost_LIBRARIES}
)
add_executable(stigeo
src/geo/stigeo.cxx
src/common/stiglob.cxx
)
target_link_libraries(stigeo
${STAR_LIBRARIES} ${ROOT_LIBRARIES}
${CURL_LIBRARIES} ${MYSQL_LIBRARIES} ${LIBXML2_LIBRARIES}
)
add_executable(evedisp
src/evedisp/evedisp.cxx
src/evedisp/EventReader.cxx
src/evedisp/ProgramOptions.cxx
src/geo/common.cxx
src/common/root_v6.cxx
src/common/stiglob.cxx
)
target_include_directories(evedisp PRIVATE ${TRACKML_INCLUDE_DIR})
add_dependencies(evedisp trackml)
target_link_libraries(evedisp
${TRACKML_LIBRARIES}
${STAR_LIBRARIES} ${ROOT_LIBRARIES}
${Boost_LIBRARIES}
${CURL_LIBRARIES} ${MYSQL_LIBRARIES} ${LIBXML2_LIBRARIES}
)
add_executable(tgeo2shapes
src/geo/tgeo2shapes.cxx
src/geo/ProgramOptions.cxx
src/geo/common.cxx
src/common/root_v6.cxx
)
target_link_libraries(tgeo2shapes ${ROOT_LIBRARIES} ${Boost_LIBRARIES})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_target_properties(stiscan PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
set_target_properties(stihify PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
set_target_properties(vtxhist PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
set_target_properties(vtxreco PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
set_target_properties(stargeo PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
set_target_properties(stigeo PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
set_target_properties(evedisp PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
endif()
# Installation section
install(TARGETS
stirootiolib gearootiolib stihifylib stiscanlib
DESTINATION "${STAR_ADDITIONAL_INSTALL_PREFIX}/lib" OPTIONAL)
install(TARGETS stiscan stihify vtxhist vtxreco evedisp
DESTINATION "${STAR_ADDITIONAL_INSTALL_PREFIX}/bin" OPTIONAL)