Skip to content

Commit 4473a2d

Browse files
authored
Merge pull request #212 from sy-c/master
v2.9.0
2 parents 86620c3 + f37dd80 commit 4473a2d

File tree

9 files changed

+656
-5
lines changed

9 files changed

+656
-5
lines changed

CMakeLists.txt

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ find_package(RDMA)
7070
find_package(Occ)
7171
find_package(BookkeepingApiCpp)
7272
find_package(ZMQ)
73+
find_package(MySQL)
7374

7475
# extract include directories from targets
7576
get_target_property(InfoLogger_INCLUDE_DIRS AliceO2::InfoLogger INTERFACE_INCLUDE_DIRECTORIES)
@@ -128,8 +129,17 @@ else ()
128129
message(STATUS "ZMQ not found, corresponding features will be disabled.")
129130
endif()
130131

132+
# check MySQL
133+
if(${MYSQL_FOUND})
134+
message(
135+
STATUS
136+
"MySQL found: ${MYSQL_INCLUDE_DIRS} ${MYSQL_LIBRARIES}")
137+
else ()
138+
message(STATUS "MySQL not found, corresponding features will be disabled.")
139+
endif()
140+
131141
# add flags to enable optional features in Readout, based on available dependencies
132-
add_compile_definitions($<$<BOOL:${Numa_FOUND}>:WITH_NUMA> $<$<BOOL:${RDMA_FOUND}>:WITH_RDMA> $<$<BOOL:${Configuration_FOUND}>:WITH_CONFIG> $<$<BOOL:${FairMQ_FOUND}>:WITH_FAIRMQ> $<$<BOOL:${Occ_FOUND}>:WITH_OCC> $<$<BOOL:${BookkeepingApiCpp_FOUND}>:WITH_LOGBOOK> $<$<BOOL:${ZMQ_FOUND}>:WITH_ZMQ> $<$<BOOL:${ReadoutCard_FOUND}>:WITH_READOUTCARD> )
142+
add_compile_definitions($<$<BOOL:${Numa_FOUND}>:WITH_NUMA> $<$<BOOL:${RDMA_FOUND}>:WITH_RDMA> $<$<BOOL:${Configuration_FOUND}>:WITH_CONFIG> $<$<BOOL:${FairMQ_FOUND}>:WITH_FAIRMQ> $<$<BOOL:${Occ_FOUND}>:WITH_OCC> $<$<BOOL:${BookkeepingApiCpp_FOUND}>:WITH_LOGBOOK> $<$<BOOL:${ZMQ_FOUND}>:WITH_ZMQ> $<$<BOOL:${MYSQL_FOUND}>:WITH_DB> $<$<BOOL:${ReadoutCard_FOUND}>:WITH_READOUTCARD> )
133143

134144
# define include directories
135145
set(READOUT_INCLUDE_DIRS
@@ -165,6 +175,10 @@ if(ZMQ_FOUND)
165175
list(APPEND READOUT_INCLUDE_DIRS ${ZMQ_INCLUDE_DIRS})
166176
list(APPEND READOUT_LINK_LIBRARIES ${ZMQ_LIBRARIES})
167177
endif()
178+
if(MYSQL_FOUND)
179+
list(APPEND READOUT_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS})
180+
list(APPEND READOUT_LINK_LIBRARIES ${MYSQL_LIBRARIES})
181+
endif()
168182

169183
# some systems don't need an explicit library to have dlopen()
170184
if (CMAKE_DL_LIBS)
@@ -225,6 +239,15 @@ add_library(
225239
)
226240
target_include_directories(objReadoutUtils PRIVATE ${READOUT_INCLUDE_DIRS})
227241

242+
# internal readout database
243+
if (MYSQL_FOUND)
244+
add_library(
245+
objReadoutDatabase OBJECT
246+
${SOURCE_DIR}/ReadoutDatabase.cxx
247+
)
248+
target_include_directories(objReadoutDatabase PRIVATE ${READOUT_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS})
249+
endif()
250+
228251
# consumers
229252
add_library(
230253
objReadoutConsumers OBJECT
@@ -304,6 +327,7 @@ add_executable(
304327
$<TARGET_OBJECTS:objReadoutAggregator>
305328
$<TARGET_OBJECTS:objReadoutConsumers>
306329
$<TARGET_OBJECTS:objReadoutUtils>
330+
$<$<BOOL:${MYSQL_FOUND}>:$<TARGET_OBJECTS:objReadoutDatabase>>
307331
)
308332

309333
# a test FMQ device receiver
@@ -398,6 +422,16 @@ add_executable(
398422
target_include_directories(o2-readout-monitor PRIVATE ${READOUT_INCLUDE_DIRS})
399423
target_link_libraries(o2-readout-monitor PRIVATE AliceO2::InfoLogger AliceO2::Common ${ZMQ_LIBRARIES})
400424

425+
# a process to admin readout database
426+
if (MYSQL_FOUND)
427+
add_executable(
428+
o2-readout-admin-db
429+
${SOURCE_DIR}/readoutAdminDB.cxx
430+
$<TARGET_OBJECTS:objReadoutDatabase>
431+
)
432+
target_include_directories(o2-readout-admin-db PRIVATE ${READOUT_INCLUDE_DIRS})
433+
endif()
434+
401435
endif()
402436

403437
# a minimal test program to check Monitoring library
@@ -438,6 +472,9 @@ endif()
438472
if (BookkeepingApiCpp_FOUND)
439473
list (APPEND executables o2-readout-test-lib-bookkeeping)
440474
endif()
475+
if (MYSQL_FOUND)
476+
list (APPEND executables o2-readout-admin-db)
477+
endif()
441478
foreach (exe ${executables})
442479
target_include_directories(${exe} PRIVATE ${READOUT_INCLUDE_DIRS})
443480
target_link_libraries(${exe} PRIVATE ${READOUT_LINK_LIBRARIES})

cmake/FindMySQL.cmake

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# - Find mysqlclient
2+
# Find the native MySQL includes and library
3+
#
4+
# MYSQL_INCLUDE_DIRS - where to find mysql.h, etc.
5+
# MYSQL_LIBRARIES - List of libraries when using MySQL.
6+
# MYSQL_FOUND - True if MySQL found.
7+
8+
# MYSQL_PATH_SUFFIXES - by default it includes "mysql". Set it if you want to force extra suffixes to be used.
9+
10+
if(NOT MYSQL_PATH_SUFFIXES)
11+
set(MYSQL_PATH_SUFFIXES "" "mysql")
12+
endif()
13+
14+
FIND_PATH(MYSQL_INCLUDE_DIRS mysql.h
15+
/usr/local/include/mysql
16+
/usr/include/mysql
17+
)
18+
19+
SET(MYSQL_NAMES mysqlclient mysqlclient_r)
20+
FIND_LIBRARY(MYSQL_LIBRARY
21+
NAMES ${MYSQL_NAMES}
22+
PATHS /usr/lib /usr/lib64 /usr/local/lib
23+
PATH_SUFFIXES ${MYSQL_PATH_SUFFIXES}
24+
)
25+
26+
IF (MYSQL_INCLUDE_DIRS AND MYSQL_LIBRARY)
27+
SET(MYSQL_FOUND TRUE)
28+
SET( MYSQL_LIBRARIES ${MYSQL_LIBRARY} )
29+
ELSE (MYSQL_INCLUDE_DIRS AND MYSQL_LIBRARY)
30+
SET(MYSQL_FOUND FALSE)
31+
UNSET(MYSQL_LIBRARIES CACHE)
32+
UNSET(MYSQL_INCLUDE_DIRS CACHE)
33+
ENDIF (MYSQL_INCLUDE_DIRS AND MYSQL_LIBRARY)
34+
35+
IF (MYSQL_FOUND)
36+
MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}")
37+
ELSE (MYSQL_FOUND)
38+
IF (MYSQL_FIND_REQUIRED)
39+
MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
40+
MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
41+
ENDIF (MYSQL_FIND_REQUIRED)
42+
ENDIF (MYSQL_FOUND)
43+
44+
MARK_AS_ADVANCED(
45+
MYSQL_LIBRARY
46+
MYSQL_INCLUDE_DIRS
47+
)

doc/releaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,6 @@ This file describes the main feature changes for each readout.exe released versi
428428
## v2.8.7 - 16/03/2022
429429
- Explicit order for resources cleanup on unexpected state machine exit.
430430
- Reset TFid on file replay start/stop loop.
431+
432+
## v2.9.0 - 23/03/2022
433+
- Added optional database connection to store runtime statistics.

0 commit comments

Comments
 (0)