Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • side-projects/ganil/merger-stat
1 result
Show changes
Commits on Source (4)
Showing
with 776 additions and 335 deletions
*.cflags *.cflags
*.config *.config
*.creator *.creator
*.creator.user
*.cxxflags *.cxxflags
*.files *.files
*.includes *.includes
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 3.22)
set(proj_name fazia-ecc) project(merger-stat
set(proj_version 2.0) VERSION 3.0
if(${CMAKE_VERSION} VERSION_LESS 3.0) DESCRIPTION "Utility tha make some useful stats from merged data"
project(${proj_name}) LANGUAGES CXX C
set(PROJECT_VERSION ${proj_version})
set(${proj_name}_VERSION ${proj_version})
else()
cmake_policy(VERSION 3.0)
project(${proj_name} VERSION ${proj_version})
endif()
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/externals/cmake/AddSubproject
) )
include(AddSubproject) #- set path to our cmake modules
set(CMAKE_MODULE_PATH
# automatically add paths to external libraries to RPATH of all binaries ${PROJECT_SOURCE_DIR}/cmake
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) ${PROJECT_SOURCE_DIR}/external/CMakeListsUtilities
${PROJECT_SOURCE_DIR}/external/FindPackageAddDependency
# ============================================================================= ${PROJECT_SOURCE_DIR}/external/FindZeroMQ
# ------------------------------ Build options -------------------------------- ${CMAKE_MODULE_PATH}
# ============================================================================= )
option(USE_TAPIRMQ "use TapirMQ-client to push metadata and logs to InfluxDB" ON)
set(LIBARIES_TO_LINK)
# look for KaliVeda with FAZIA libraries and optionally sqlite
find_package(KaliVeda 1.10 REQUIRED FAZIA)
include(${KALIVEDA_USE_FILE})
list(APPEND LIBRARIES_TO_LINK ${KALIVEDA_LIBRARIES})
# look for ROOT
find_package(ROOT REQUIRED GuiHtml Thread)
include(SetUpROOTBuild)
list(APPEND LIBRARIES_TO_LINK ${ROOT_LIBRARIES})
# look for libcurl
find_package(CURL REQUIRED)
if(CURL_FOUND)
include_directories(${CURL_INCLUDE_DIRS})
endif()
# to read GANIL MFM merged frame (INDRA-FAZIA) #-- to handle dependencies on other packages
#---sources available from: https://gitlab.in2p3.fr/jdfcode/mfmlib.git include(FindPackageAddDependency)
find_package(mfmlib QUIET)
if(mfmlib_FOUND)
set(HAVE_MFMLIB yes)
include_directories(${mfmlib_INCLUDE_DIRS})
list(APPEND LIBRARIES_TO_LINK ${mfmlib_LIBRARIES})
endif(mfmlib_FOUND)
# to read GANIL Mesytec data include(GNUPackageInstallDirs)
#---sources available from: https://gitlab.in2p3.fr/mesytec-ganil/mesytec_data
find_package(mesytec_data REQUIRED)
if(mesytec_data_FOUND)
set(WITH_MESYTEC yes)
include_directories(${mesytec_data_INCLUDE_DIRS})
list(APPEND LIBRARIES_TO_LINK ${mesytec_data_LIBRARIES})
else() include(StandardRpathHandling)
message(STATUS "mesytec_data not found...")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
# look for boost find_package_add_dependency(Protobuf REQUIRED)
find_package(Boost COMPONENTS program_options) if(Protobuf_FOUND)
if(Boost_PROGRAM_OPTIONS_FOUND) set(HAVE_PROTOBUF yes)
set(HAVE_BOOST yes)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND LIBRARIES_TO_LINK ${Boost_PROGRAM_OPTIONS_LIBRARY})
endif() endif()
include(GNUInstallDirs) #-- look for ZeroMQ (not obligatory)
set(CMAKE_INSTALL_PKGINCDIR ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) find_package_add_dependency(ZeroMQ QUIET
set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) BEFORE_FIND "set(CMAKE_MODULE_PATH \${CMAKE_CURRENT_LIST_DIR} \${CMAKE_MODULE_PATH})"
set(CMAKE_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) )
if(ZeroMQ_FOUND)
#------------------------------------------------------------------------------------------- set(HAVE_ZMQ_H yes)
# Build & install analysis tools (former fazia-oscillo branch) install(
# look for protobuf FILES ${PROJECT_SOURCE_DIR}/external/FindZeroMQ/FindZeroMQ.cmake
find_package(Protobuf) DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
if(NOT PROTOBUF_FOUND) )
# we may need pkg-config to find installation
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
message(STATUS "Looking for protobuf with pkg-config")
## use pkg-config to get hints for protobuf locations
pkg_check_modules(PROTOBUF QUIET protobuf)
if(PROTOBUF_FOUND)
set(CMAKE_LIBRARY_PATH ${PROTOBUF_LIBRARY_DIRS} ${CMAKE_LIBRARY_PATH})
set(PROTOBUF_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIRS})
set(Protobuf_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIRS})
find_package(Protobuf)
endif(PROTOBUF_FOUND)
endif(PkgConfig_FOUND)
endif(NOT PROTOBUF_FOUND)
if(PROTOBUF_FOUND)
# protobuf requires C++11 or higher
# check if -std=c++11/4/7 flag already in cxx flags
string(FIND ${CMAKE_CXX_FLAGS} "-std=c++11" CPP11_FLAGS)
string(FIND ${CMAKE_CXX_FLAGS} "-std=c++14" CPP14_FLAGS)
string(FIND ${CMAKE_CXX_FLAGS} "-std=c++17" CPP17_FLAGS)
if((CPP11_FLAGS GREATER 0) OR (CPP14_FLAGS GREATER 0) OR (CPP17_FLAGS GREATER 0))
# nothing to do, one of flags is already present
else()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
endif(PROTOBUF_FOUND)
add_definitions( -DOSCILLO_DATADIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}" )
# look for ZeroMQ
find_package(ZMQ)
if(PROTOBUF_FOUND AND ZMQ_FOUND)
set(HAVE_PROTOBUF yes)
include_directories(${PROTOBUF_INCLUDE_DIRS})
message(STATUS "Protobuf include dir = ${PROTOBUF_INCLUDE_DIRS}")
include_directories(${CMAKE_BINARY_DIR}/protobuf)
set(HAVE_ZMQ_H yes)
include_directories(${ZMQ_INCLUDE_DIRS})
list(APPEND LIBRARIES_TO_LINK ${ZMQ_LIBRARIES})
message(STATUS "ZMQ include dir = ${ZMQ_INCLUDE_DIRS}")
message(STATUS "ZMQ library = ${ZMQ_LIBRARIES}")
# generate protobuf source from event description
set(FAZIA_EVENT_PROTO FzEventSet.proto)
add_subdirectory(protobuf)
get_property(FAZIA_PROTOBUF_LIB GLOBAL PROPERTY FAZIA_PROTOBUF_LIB)
list(APPEND LIBRARIES_TO_LINK ${FAZIA_PROTOBUF_LIB})
endif(PROTOBUF_FOUND AND ZMQ_FOUND)
set(LIBRARY_TARGETS)
if(USE_TAPIRMQ)
list(APPEND LIBRARY_TARGETS tapirmq-client)
add_subproject(externals/tapirmq-client
PATH_TO_LIBS "$ORIGIN/fazia-ecc:$ORIGIN/../lib/fazia-ecc")
message(NOTICE "using TapirMQ-client library")
endif(USE_TAPIRMQ)
# generate config.h
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/fzoscillo-config.h)
install(FILES ${CMAKE_BINARY_DIR}/fzoscillo-config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
include_directories(${CMAKE_BINARY_DIR})
add_definitions( -DHAVE_CONFIG_H )
add_definitions( -DPKGBUILDDIR=${PROJECT_BINARY_DIR} -DPKGDATADIR=${CMAKE_INSTALL_FULL_DATADIR} -DPKGHTMLDIR=${CMAKE_INSTALL_FULL_HTMLDIR} )
list(APPEND LIBRARY_TARGETS fazia-ecc-base)
add_subdirectory(base)
include_directories(${CMAKE_SOURCE_DIR}/base)
list(APPEND LIBRARY_TARGETS fazia-ecc-ecc)
add_subdirectory(ecc)
install_subproject_targets()
include_directories(${CMAKE_SOURCE_DIR}/ecc)
list(APPEND LIBRARY_TARGETS fazia-ecc-mon)
add_subdirectory(monitoring)
include_directories(${CMAKE_SOURCE_DIR}/monitoring)
add_subdirectory(merger)
list(APPEND LIBRARIES_TO_LINK ${LIBRARY_TARGETS})
add_subdirectory(execs)
set(doc_DATA README INSTALL README.server README.usersguide COPYING)
install(FILES ${doc_DATA} DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY etc/ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR})
# install PHP scripts for webserver database access
install(DIRECTORY webserver DESTINATION ${CMAKE_INSTALL_SYSCONFDIR})
include(CreateConfigScript)
create_config_script()
if(PROTOBUF_FOUND AND ZMQ_FOUND)
if(DEFINED ENV{SITE})
if($ENV{SITE} STREQUAL "CCIN2P3") #-at IN2P3 Computing Centre, build with support for xrootd
find_package(XROOTD)
if(XROOTD_FOUND)
list(APPEND LIBRARIES_TO_LINK ${XROOTD_LIBRARIES})
endif()
endif()
endif()
# configure subdirectories for different executables
add_subdirectory(oscillo)
add_subdirectory(viewer)
if(HAVE_MFMLIB AND WITH_MESYTEC)
add_subdirectory(indra-viewer)
add_subdirectory(indra-scaler)
endif()
# - obsolete: do not build
# add_subdirectory(converter)
add_subdirectory(database)
add_subdirectory(replay)
add_subdirectory(scaler)
endif(PROTOBUF_FOUND AND ZMQ_FOUND)
include(CheckCXXSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${KALIVEDA_INCLUDE_DIR})
CHECK_CXX_SYMBOL_EXISTS(WITH_RSQLITE KVConfig.h GOT_KVSQLITE)
if(GOT_KVSQLITE)
message(STATUS "Got KVSQLITE")
add_subdirectory(dbviewer)
else()
message(STATUS "No KVSQLITE: dbviewer directory will not be compiled")
endif() endif()
find_package(Boost REQUIRED COMPONENTS program_options)
# set RPATH on all executables in order to find private utility libraries find_package(mfmlib REQUIRED)
# libfazia_protobuf_event.so & libfazia_sound.so which will not be installed in a
# standard library directory but in $PREFIX/bin/fazia-ecc/
get_property(EXEC_TARGET_LIST GLOBAL PROPERTY EXEC_TARGET_LIST)
foreach(exec_target ${EXEC_TARGET_LIST})
get_target_property(TARGET_RUNPATH ${exec_target} INSTALL_RPATH)
list(APPEND TARGET_RUNPATH ${CMAKE_INSTALL_FULL_BINDIR}/${PROJECT_NAME})
set_target_properties(${exec_target} PROPERTIES INSTALL_RPATH "${TARGET_RUNPATH}")
endforeach()
#install user's guides
install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_HTMLDIR})
#generate & install class reference doc
add_custom_target(html
make -f ${PROJECT_SOURCE_DIR}/make.html ROOTEXEC=${ROOT_EXECUTABLE} srcdir=${PROJECT_SOURCE_DIR} builddir=${PROJECT_BUILD_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/htmldoc ${CMAKE_INSTALL_FULL_HTMLDIR}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
find_package(Protobuf REQUIRED) find_package(ROOT REQUIRED)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS MergerInfo.proto)
add_executable(merger-spy merger-spy.cpp MergerInfo.pb.cc merger_spy.cpp) add_subdirectory(src)
target_include_directories(merger-spy PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(merger-spy ${LIBRARIES_TO_LINK})
install(TARGETS merger-spy DESTINATION ${CMAKE_INSTALL_BINDIR})
set_property(GLOBAL APPEND PROPERTY EXEC_TARGET_LIST merger-spy)
syntax = "proto3";
package myprotobuf;
option optimize_for = SPEED;
option cc_generic_services = false;
message log{
enum log_type{
fDebug = 0;
fInfo = 1;
fWarning = 2;
fError = 3;
}
log_type type = 1;
string value=2;
}
message point{
double x=1;
double y=2;
}
message histogram{
string name = 1;
string labelx = 2;
string labely= 3;
repeated point points = 4;
}
message rate{
string name = 1;
double value = 2;
//repeated point points = 2;
}
message histogram_frame{
string name = 1;
repeated histogram histos = 2;
}
message rate_frame{
string name = 1;
repeated rate rates = 2;
}
message merger_info{
repeated histogram_frame histo_frames = 1;
repeated rate_frame rate_frames = 2;
repeated log logs = 3;
}
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://gitlab.in2p3.fr/jdfcode/cmake/cmakelistsutilities.git
branch = main
commit = fdd5cbce133e9bf1788203ad6f12f0682409ec89
parent = 6aca437baffc61d0a03c51c1aaac164713346ad9
method = merge
cmdver = 0.4.9
# make sure we know if we are the top level project or just a subdirectory
if(${CMAKE_VERSION} VERSION_LESS 3.21)
if(${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set(PROJECT_IS_TOP_LEVEL TRUE)
else(${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set(PROJECT_IS_TOP_LEVEL FALSE)
endif(${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
endif(${CMAKE_VERSION} VERSION_LESS 3.21)
cmake_minimum_required(VERSION 3.7) # for GNUInstallDirs_get_absolute_install_dir macro
# for CMake versions < 3.21
include(CheckProjectIsTopLevel)
# by default, we lower-case the project name for installation directories
if(NOT DO_NOT_LOWER_CASE_PROJECT_INSTALL_DIRS)
string(TOLOWER ${PROJECT_NAME} proj_name)
endif()
if(PROJECT_IS_TOP_LEVEL)
#-- if this a stand-alone installation, define our installataion layout
include(GNUInstallDirs)
set(CMAKE_INSTALL_PKGINCDIR ${CMAKE_INSTALL_INCLUDEDIR}/${proj_name})
set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/${proj_name})
set(CMAKE_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${proj_name})
set(CMAKE_INSTALL_PKGDATADIR ${CMAKE_INSTALL_DATADIR}/${proj_name})
else()
#-- when built as a subproject, we define our installation relative to the main project
set(CMAKE_INSTALL_PKGINCDIR ${CMAKE_INSTALL_PKGINCDIR}/${proj_name})
set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_PKGLIBDIR}/${proj_name})
set(CMAKE_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_PKGCONFIGDIR}/${proj_name})
set(CMAKE_INSTALL_PKGDATADIR ${CMAKE_INSTALL_PKGDATADIR}/${proj_name})
endif()
#-- make absolute path variables using macro from GNUInstallDirs >=3.7
foreach(dir
PKGINCDIR
PKGLIBDIR
PKGCONFIGDIR
PKGDATADIR
)
if(CMAKE_VERSION VERSION_LESS 3.20)
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
else()
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir} ${dir})
endif()
endforeach()
#---install cmake stuff for find_package for use by other projects
# -- (no version information)
#-- no namespace for project targets if defined
if(NOT NO_PROJECT_TARGETS_NAMESPACE)
#-- namespace by default = project name
if(NOT PROJECT_TARGETS_NAMESPACE)
set(PROJECT_TARGETS_NAMESPACE ${PROJECT_NAME})
endif()
set(project_namespace_instruction NAMESPACE ${PROJECT_TARGETS_NAMESPACE}::)
endif()
install(EXPORT ${PROJECT_NAME}Exports
DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
${project_namespace_instruction}
FILE ${PROJECT_NAME}-targets.cmake
)
include(CMakePackageConfigHelpers)
#---retrieve any package dependencies set by calls to find_package_add_dependency
get_property(PACKAGE_DEPENDENCIES GLOBAL PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES)
#---retrieve any package dependencies set by calls to add_subproject
get_property(SUBPROJECT_DEPENDENCIES GLOBAL PROPERTY ${PROJECT_NAME}_SUBPROJECT_DEPENDENCIES)
#-- config template file by default: ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in
if(NOT PROJECT_CONFIG_TEMPLATE_FILE)
set(PROJECT_CONFIG_TEMPLATE_FILE ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in)
endif()
configure_package_config_file(${PROJECT_CONFIG_TEMPLATE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION
${CMAKE_INSTALL_PKGCONFIGDIR}
)
#---install cmake stuff for find_package for use by other projects
# -- (with version information)
#-- no namespace for project targets if defined
if(NOT NO_PROJECT_TARGETS_NAMESPACE)
#-- namespace by default = project name
if(NOT PROJECT_TARGETS_NAMESPACE)
set(PROJECT_TARGETS_NAMESPACE ${PROJECT_NAME})
endif()
set(project_namespace_instruction NAMESPACE ${PROJECT_TARGETS_NAMESPACE}::)
endif()
install(EXPORT ${PROJECT_NAME}Exports
DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
${project_namespace_instruction}
FILE ${PROJECT_NAME}-targets.cmake
)
include(CMakePackageConfigHelpers)
#---retrieve any package dependencies set by calls to find_package_add_dependency
get_property(PACKAGE_DEPENDENCIES GLOBAL PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES)
#---retrieve any package dependencies set by calls to add_subproject
get_property(SUBPROJECT_DEPENDENCIES GLOBAL PROPERTY ${PROJECT_NAME}_SUBPROJECT_DEPENDENCIES)
#-- config template file by default: ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in
if(NOT PROJECT_CONFIG_TEMPLATE_FILE)
set(PROJECT_CONFIG_TEMPLATE_FILE ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in)
endif()
configure_package_config_file(${PROJECT_CONFIG_TEMPLATE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION
${CMAKE_INSTALL_PKGCONFIGDIR}
)
# CMakeListsUtilities
Various useful bits of code used for writing CMakeLists.txt files:
- CheckProjectIsTopLevel: sets PROJECT_IS_TOP_LEVEL even if CMake version < 3.21
- GNUPackageInstallDirs: extension of GNUInstallDirs which adds project-specific directories for libraries, header files, data files, and CMake package config files
- StandardRpathHandling: make sure all libraries/executables have correct RPATH settings
- InstallConfigPackage: installs Config files so other packages can find us (no version information)
- InstallConfigPackageVersion: installs Config files so other packages can find us (with version information)
- projectConfig.cmake.in: template to be used as base for package Config files
## StandardRpathHandling
Usage:
~~~{.cmake}
include(StandardRpathHandling)
~~~
+ Ensures the RPATH/RUNPATH for all executables & libraries is set to find our package's libraries at runtime, as well as any 3rd party libraries on which they depend, without needing to modify `LD_LIBRARY_PATH`
+ `CMAKE_INSTALL_PKGLIBDIR` must be set beforehand: it should contain the path (relative to `CMAKE_INSTALL_PREFIX`) which contains our package's libraries (e.g. `lib` or `lib/packageName`)
## InstallConfigPackage, InstallConfigPackageVersion
Usage:
~~~{.cmake}
include(InstallConfigPackage)
~~~
or
~~~{.cmake}
include(InstallConfigPackageVersion)
~~~
+ Typically used at the end of the top level CMakeLists.txt in order to generate and install the `projectNameConfig.cmake` file which will allow others to find and use our package with a `find_package(projectName)` command
+ use `InstallConfigPackageVersion` if your project has a version number, otherwise use `InstallConfigPackage`
+ The project's exported targets will be written in a projectName-targets.cmake file, make sure that:
- when exporting targets, use `${PROJECT_NAME}Exports` as the name of the target set;
- if required, set `PROJECT_TARGETS_NAMESPACE` to the name that will be prefixed to targets (as `${PROJECT_TARGETS_NAMESPACE}::[target]`). By default, `${PROJECT_NAME}` will be used, unless the variable NO_PROJECT_TARGETS_NAMESPACE is set;;
- if required, set `PROJECT_CONFIG_TEMPLATE_FILE` to contain the path to the template Config file (see projectConfig.cmake.in below). By default, we look for a file `${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in`;
+ set `CMAKE_INSTALL_PKGCONFIGDIR` beforehand to the relative path where all Config files will be installed (typicaly, `lib/cmake/projectName`)
+ any calls to `find_dependency` generated by `FindPackageAddDependency` (see https://gitlab.in2p3.fr/jdfcode/cmake/findpackageadddependency.git) will be automatically added to the Config script, as long as the template file contains the necessary code (see projectConfig.cmake.in below).
+ for any subprojects added with `add_subproject` (see https://gitlab.in2p3.fr/jdfcode/cmake/addsubproject) the list of subproject RPATH additions is retrieved and will be automatically added to the Config script, as long as the template file contains the necessary code (see projectConfig.cmake.in below).
## projectConfig.cmake.in
Template file to be used with `configure_package_config_file()` or with `InstallConfigPackage[Version]` (see above).
Some manual intervention may be required depending on the project, but it should work (minimally) as is.
+ any calls to `find_dependency` generated by `FindPackageAddDependency` (see https://gitlab.in2p3.fr/jdfcode/cmake/findpackageadddependency.git) will be automatically added to the Config script
+ all subprojects added with `add_subproject` (see https://gitlab.in2p3.fr/jdfcode/cmake/addsubproject) will have the paths to their libraries added to the install RPATH
+ any library or executable linking to our targets gets a full RPATH to allow it to find all the required shared libs
## GNUPackageInstallDirs
Just an extension of GNUInstallDirs which adds project-specific directories for installing
libraries, header files, data files and CMake package config files. The result depends on
whether the current project is being built as a top-level project or a subproject of
another:
~~~{.cmake}
if(PROJECT_IS_TOP_LEVEL)
#-- if this a stand-alone installation, define our installataion layout
include(GNUInstallDirs)
set(CMAKE_INSTALL_PKGINCDIR ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
set(CMAKE_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
set(CMAKE_INSTALL_PKGDATADIR ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
else()
#-- when built as a subproject, we define our installation relative to the main project
set(CMAKE_INSTALL_PKGINCDIR ${CMAKE_INSTALL_PKGINCDIR}/${PROJECT_NAME})
set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_PKGLIBDIR}/${PROJECT_NAME})
set(CMAKE_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_PKGCONFIGDIR}/${PROJECT_NAME})
set(CMAKE_INSTALL_PKGDATADIR ${CMAKE_INSTALL_PKGDATADIR}/${PROJECT_NAME})
endif()
~~~
PROJECT_NAME must be set before calling. By default, the project name is converted to all lower case to be used in the directory names, unless variable DO_NOT_LOWER_CASE_PROJECT_INSTALL_DIRS is set.
If being used as a subproject, the master project must have defined the CMAKE_INSTALL_* variables
(e.g. by itself calling `include(GNUPackageInstallDirs)`)
# RPATH handling - executables can be used without setting LD_LIBRARY_PATH
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
# use, i.e. don't skip the full RPATH for the build or install tree
set(CMAKE_SKIP_RPATH FALSE)
# use, i.e. don't skip the full RPATH for the install tree
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# Enable $ORIGIN in the rpath if supported by the target platform.
SET(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../${CMAKE_INSTALL_PKGLIBDIR}")
# 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)
#
#---Config file for @PROJECT_NAME@ to be used with find_package()
# Usage:
# find_package(@PROJECT_NAME@)
# if(@PROJECT_NAME@_FOUND)
# target_link_libraries([some target] PUBLIC [@PROJECT_NAME@ targets...])
# endif(@PROJECT_NAME@_FOUND)
@PACKAGE_INIT@
#-- handle dependencies of project on external projects
include(CMakeFindDependencyMacro)
@PACKAGE_DEPENDENCIES@
#-- handle dependencies of project on subprojects
@SUBPROJECT_DEPENDENCIES@
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
check_required_components(@PROJECT_NAME@)
include ( FindPackageHandleStandardArgs )
if( @PROJECT_NAME@_VERSION )
find_package_handle_standard_args (@PROJECT_NAME@
VERSION_VAR @PROJECT_NAME@_VERSION
REQUIRED_VARS PACKAGE_PREFIX_DIR
)
else()
find_package_handle_standard_args (@PROJECT_NAME@
REQUIRED_VARS PACKAGE_PREFIX_DIR
)
endif()
# make sure that any library or executable linking to our targets gets
# a full RPATH to allow it to find all the required shared libs
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://gitlab.in2p3.fr/jdfcode/cmake/findpackageadddependency.git
branch = main
commit = 22ffbb667be1f09c24d9777c058447f790100c75
parent = 60d5202fb34e32ae005a43f96dbf1e43f70851df
method = merge
cmdver = 0.4.9
####################################################################################################
#
# This is a wrapper around find_package() which tries to handle consistently the resulting
# dependency of the currently built package on other packages once it is installed.
#
# It populates a global property ${PROJECT_NAME}_PACKAGE_DEPENDENCIES which can be used in your template
# [my_pkg]Config.cmake.in file like so:
#
# @PACKAGE_INIT@
#
# include(CMakeFindDependencyMacro)
# @MYPROJ_PACKAGE_DEPENDENCIES@
#
# MYPROJ_PACKAGE_DEPENDENCIES will contain 1 call to find_dependency() for each package which
# was successfully found by the call to find_package().
#
# Usage:
#
# find_package_add_dependency([PACKAGE] [WITH_VAR [TRUE_IF_FOUND]] [ANY OTHER FIND_PACKAGE ARGUMENTS])
#
# Optional argument WITH_VAR is the name of the variable which find_package([pkg]) sets
# to TRUE if the package is found - if not given, by default we assume this to be pkg_FOUND
#
# Optional argument BEFORE_FIND can be used to add any code that may be required
# before calling find_dependency() for the package, for example modifying the CMAKE_MODULE_PATH
#
# Any other argument values are passed to find_package() (QUIET, REQUIRED, VERSION, etc.)
#
# include(FindPackageAddDependency)
# find_package_add_dependency(SomeGreatPackage 3.10 REQUIRED)
#
# -> if found, this will set SomeGreatPackage_FOUND to TRUE,
# and we add a call to find_dependency(SomeGreatPackage 3.10 REQUIRED) to the
# dependency list
#
# find_package_add_dependency(UnusualPackage WITH_VAR HAVE_UnusualPackage
# 6.3 COMPONENTS UnusualComponentA UnusualComponentF)
#
# -> if UnusualPackage is found with its components UnusualComponentA and UnusualComponentF,
# HAVE_UnnusualPackage is set to TRUE and we add a call to
# find_dependency(UnusualPackage 6.3 COMPONENTS UnusualComponentA UnusualComponentF)
# to the dependency list
#
# find_package_add_dependency(HardToFind
# BEFORE_FIND "set(CMAKE_MODULE_PATH \${CMAKE_MODULE_PATH} \${CMAKE_CURRENT_LIST_DIR})"
# )
#
# -> the FindHardToFind.cmake module can only be found in the CMAKE_CURRENT_LIST_DIR of the Config file
# Note that any '$' in the string needs to be escaped: '\$'
include(CMakeParseArguments)
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES "")
function(find_package_add_dependency package)
CMAKE_PARSE_ARGUMENTS(ARG "" "WITH_VAR;BEFORE_FIND" "" ${ARGN})
if(ARG_WITH_VAR)
set(PKG_FOUND_VAR ${ARG_WITH_VAR})
else(ARG_WITH_VAR)
set(PKG_FOUND_VAR "${package}_FOUND")
endif(ARG_WITH_VAR)
if(ARG_BEFORE_FIND)
set(FIND_PREAMBLE "${ARG_BEFORE_FIND}\n")
else(ARG_BEFORE_FIND)
set(FIND_PREAMBLE "")
endif(ARG_BEFORE_FIND)
find_package(${package} ${ARG_UNPARSED_ARGUMENTS})
if(${PKG_FOUND_VAR})
set_property(GLOBAL
APPEND_STRING
PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES
"#-- handle ${package} dependency\n${FIND_PREAMBLE}find_dependency(${package}")
if(ARG_UNPARSED_ARGUMENTS)
foreach(arg ${ARG_UNPARSED_ARGUMENTS})
set_property(GLOBAL
APPEND_STRING
PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES
" ${arg}")
endforeach()
endif(ARG_UNPARSED_ARGUMENTS)
set_property(GLOBAL
APPEND_STRING
PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES
")\n")
endif(${PKG_FOUND_VAR})
#-- set all variables defined by package in parent scope
get_property(dir_variables DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VARIABLES)
#-- make sure to escape the special regex character '+' in the package name
string(REPLACE "+" "\\+" package_regex ${package})
string(TOUPPER ${package_regex} PACKAGE_REGEX)
foreach(dir_var ${dir_variables})
if(dir_var MATCHES ${package_regex} OR dir_var MATCHES ${PACKAGE_REGEX})
set(${dir_var} ${${dir_var}} PARENT_SCOPE)
endif()
endforeach()
endfunction()
## FindPackageAddDependency
This is a wrapper around find_package() which tries to handle consistently the resulting
dependency of the currently built package on other packages once it is installed.
It populates a global property ${PROJECT_NAME}_PACKAGE_DEPENDENCIES which can be used in your template
[my_pkg]Config.cmake.in file like so:
~~~{.cmake}
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
@MYPROJ_PACKAGE_DEPENDENCIES@
~~~
(you have to first retrieve the contents of MYPROJ_PACKAGE_DEPENDENCIES like so:
~~~{.cmake}
get_property(MYPROJ_PACKAGE_DEPENDENCIES GLOBAL PROPERTY ${PROJECT_NAME}_PACKAGE_DEPENDENCIES)
~~~
before calling configure_package_config_file() - if you use InstallConfigPackage or
InstallConfigPackageVersion, this is handled by these scripts: see https://gitlab.in2p3.fr/jdfcode/cmake/cmakelistsutilities.git)
MYPROJ_PACKAGE_DEPENDENCIES will contain 1 call to find_dependency() for each package which
was successfully found by the call to find_package().
### Usage:
~~~{.cmake}
find_package_add_dependency([PACKAGE] [WITH_VAR [TRUE_IF_FOUND]]
[BEFORE_FIND [CODE_TO_INSERT]]
[ANY OTHER FIND_PACKAGE ARGUMENTS]
)
~~~
Optional argument WITH_VAR is the name of the variable which find_package([pkg]) sets
to TRUE if the package is found - if not given, by default we assume this to be pkg_FOUND
Optional argument BEFORE_FIND can be used to add any code that may be required
before calling find_dependency() for the package, for example modifying the CMAKE_MODULE_PATH
Any other argument values are passed to find_package() (QUIET, REQUIRED, VERSION, etc.)
In your CMakeLists.txt:
~~~{.cmake}
include(FindPackageAddDependency)
find_package_add_dependency(SomeGreatPackage 3.10 REQUIRED)
-> if found, this will set SomeGreatPackage_FOUND to TRUE,
and we add a call to find_dependency(SomeGreatPackage 3.10 REQUIRED) to the
dependency list
find_package_add_dependency(UnusualPackage WITH_VAR HAVE_UnusualPackage
6.3 COMPONENTS UnusualComponentA UnusualComponentF)
-> if UnusualPackage is found with its components UnusualComponentA and UnusualComponentF,
HAVE_UnnusualPackage is set to TRUE and we add a call to
find_dependency(UnusualPackage 6.3 COMPONENTS UnusualComponentA UnusualComponentF)
to the dependency list
find_package_add_dependency(HardToFind
BEFORE_FIND "set(CMAKE_MODULE_PATH \${CMAKE_MODULE_PATH} \${CMAKE_CURRENT_LIST_DIR})"
)
-> the FindHardToFind.cmake module can only be found in the CMAKE_CURRENT_LIST_DIR of the Config file
Note that any '$' in the string needs to be escaped: '\$'
~~~
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://gitlab.in2p3.fr/jdfcode/cmake/findzeromq.git
branch = main
commit = cf5510a787a6fb56fabf5809194d4d4d2a3c7577
parent = 678300f5392448097e98c607a5200196b4dee324
method = merge
cmdver = 0.4.9
# - Try to find ZeroMQ
#
# Usage:
#
# find_package(ZeroMQ [version] [REQUIRED|QUIET])
#
# Any (optional) [version] given to find_package() will be tested
#
# Once done this will define
#
# ZeroMQ_FOUND - System has ZeroMQ
# ZeroMQ_VERSION - ZeroMQ version
#
# and the IMPORTED target libzmq will be defined, with the required
# INTERFACE definitions to find zmq_compat.h etc. etc.
#
# target_link_libraries(MyTarget [PRIVATE|PUBLIC|INTERFACE] libzmq)
#
# should be sufficient to compile and link any code using the ZeroMQ C++ bindings.
#
# 'zmq_compat.h'
#
# We provide this utility header in order to handle deprecation warnings when using
# newer versions of ZeroMQ. It defines the following symbols:
#
#~~~{.cpp}
#define ZMQ_SETSOCKOPT_DEPRECATED
#define ZMQ_USE_SEND_FLAGS
#define ZMQ_USE_RECV_WITH_REFERENCE
#~~~
#
# The target libzmq contains the necessary include_directory path.
# The file will be automatically installed in CMAKE_INSTALL_PKGINCDIR (if defined), or in
# CMAKE_INSTALL_INCLUDEDIR
#
# NOTES:
#
# - By default the usual system directories are searched before all others
#
# - Any installation path in CMAKE_PREFIX_PATH will take precedence over system directories
#
# - Or you can set either of the following with the installation path :
#
# ZeroMQ_DIR
# ZeroMQ_ROOT
#
# CMake minimum version 3.12 required to use ZeroMQ_ROOT in find_path/library
cmake_minimum_required(VERSION 3.12)
if(NOT ZeroMQ_FOUND)
if(ZeroMQ_DIR)
find_path (ZeroMQ_INCLUDE_DIR
NAMES zmq.hpp
PATHS ${ZeroMQ_DIR}/include
NO_DEFAULT_PATH
)
find_library (ZeroMQ_LIBRARY
NAMES zmq
PATHS ${ZeroMQ_DIR}/lib ${ZeroMQ_DIR}/lib64
NO_DEFAULT_PATH
)
else(ZeroMQ_DIR)
find_path (ZeroMQ_INCLUDE_DIR
NAMES zmq.hpp
)
find_library (ZeroMQ_LIBRARY
NAMES zmq
)
endif(ZeroMQ_DIR)
if((NOT ZeroMQ_INCLUDE_DIR) OR (NOT ZeroMQ_LIBRARY))
## load in pkg-config support
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
## use pkg-config to get hints for 0mq locations
pkg_check_modules(PC_ZeroMQ QUIET libzmq)
## use the hint from above to find where 'zmq.hpp' is located
find_path(ZeroMQ_INCLUDE_DIR
NAMES zmq.hpp
PATHS ${PC_ZeroMQ_INCLUDE_DIRS}
)
## use the hint from above to find the location of libzmq
find_library(ZeroMQ_LIBRARY
NAMES zmq
PATHS ${PC_ZeroMQ_LIBRARY_DIRS}
)
endif(PkgConfig_FOUND)
endif((NOT ZeroMQ_INCLUDE_DIR) OR (NOT ZeroMQ_LIBRARY))
if(ZeroMQ_INCLUDE_DIR AND ZeroMQ_LIBRARY)
# get libzmq version from zmq.h header file
file(READ "${ZeroMQ_INCLUDE_DIR}/zmq.h" _ZMQ_H_CONTENTS)
string(REGEX REPLACE ".*#define ZMQ_VERSION_MAJOR ([0-9]+).*" "\\1" DETECTED_ZMQ_VERSION_MAJOR "${_ZMQ_H_CONTENTS}")
string(REGEX REPLACE ".*#define ZMQ_VERSION_MINOR ([0-9]+).*" "\\1" DETECTED_ZMQ_VERSION_MINOR "${_ZMQ_H_CONTENTS}")
string(REGEX REPLACE ".*#define ZMQ_VERSION_PATCH ([0-9]+).*" "\\1" DETECTED_ZMQ_VERSION_PATCH "${_ZMQ_H_CONTENTS}")
set(ZeroMQ_VERSION "${DETECTED_ZMQ_VERSION_MAJOR}.${DETECTED_ZMQ_VERSION_MINOR}.${DETECTED_ZMQ_VERSION_PATCH}")
endif(ZeroMQ_INCLUDE_DIR AND ZeroMQ_LIBRARY)
include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args (ZeroMQ
VERSION_VAR ZeroMQ_VERSION
REQUIRED_VARS ZeroMQ_LIBRARY ZeroMQ_INCLUDE_DIR
)
if(NOT TARGET libzmq)
# Create IMPORTED targets with all correct attributes
add_library(libzmq SHARED IMPORTED)
set_property(TARGET libzmq APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
get_filename_component(ZeroMQ_LIB_SO ${ZeroMQ_LIBRARY} NAME)
set_target_properties(libzmq PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZeroMQ_INCLUDE_DIR}"
INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
IMPORTED_LOCATION_NOCONFIG "${ZeroMQ_LIBRARY}"
IMPORTED_SONAME_NOCONFIG "${ZeroMQ_LIB_SO}"
)
endif()
# Install zmq_compat.h if it exists
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/zmq_compat.h)
if(CMAKE_INSTALL_PKGINCDIR)
install(FILES ${CMAKE_CURRENT_LIST_DIR}/zmq_compat.h DESTINATION ${CMAKE_INSTALL_PKGINCDIR})
elseif(CMAKE_INSTALL_INCLUDEDIR)
install(FILES ${CMAKE_CURRENT_LIST_DIR}/zmq_compat.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
endif()
endif(NOT ZeroMQ_FOUND)
# FindZeroMQ
Provides a CMake module which can be used to locate the C++ interface to ZeroMQ
(https://github.com/zeromq/cppzmq) on your system by calling find_package() in CMakeLists.txt:
~~~
# Usage:
#
# find_package(ZeroMQ [version] [REQUIRED|QUIET])
#
# Any (optional) [version] given to find_package() will be tested
#
# Once done this will define
#
# ZeroMQ_FOUND - System has ZeroMQ
# ZeroMQ_VERSION - ZeroMQ version
#
# and the IMPORTED target libzmq will be defined, with the required
# INTERFACE definitions to find zmq.hpp etc. etc.
#
# target_link_libraries(MyTarget [PRIVATE|PUBLIC|INTERFACE] libzmq)
#
# should be sufficient to compile and link any code using the ZeroMQ C++ bindings.
#
# NOTES:
#
# - By default the usual system directories are searched before all others
#
# - Any installation path in CMAKE_PREFIX_PATH will take precedence over system directories
#
# - Or you can set either of the following with the installation path :
#
# ZeroMQ_DIR
# ZeroMQ_ROOT
#
#
# CMake minimum version 3.12 required to use ZeroMQ_ROOT in find_path/library
~~~
### zmq_compat.h
This header file, which can be used to replace `#include "zmq.hpp"`, handles backwards compatibility for various methods which have
been deprecated in more recent versions of libzmq, providing the following symbols:
~~~{.cpp}
#define ZMQ_SETSOCKOPT_DEPRECATED
#define ZMQ_USE_SEND_FLAGS
#define ZMQ_USE_RECV_WITH_REFERENCE
~~~
The target libzmq contains the necessary include_directory path.
The file will be automatically installed in CMAKE_INSTALL_PKGINCDIR (if defined), or in
CMAKE_INSTALL_INCLUDEDIR
### Use with find_package_add_dependency()
If ZeroMQ is a dependency of your package and you use the [FindPackageAddDependency](https://gitlab.in2p3.fr/jdfcode/cmake/findpackageadddependency) module to handle the dependency for third-party projects that will use your package, remember that you need to install the FindZeroMQ.cmake module alongside your Config file for third-party projects to use:
~~~
find_package_add_dependency(ZeroMQ
BEFORE_FIND "set(CMAKE_MODULE_PATH \${CMAKE_CURRENT_LIST_DIR} \${CMAKE_MODULE_PATH})"
)
if(ZeroMQ_FOUND)
install(
FILES ${PROJECT_SOURCE_DIR}/external/cmake/FindZeroMQ/FindZeroMQ.cmake
DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
)
endif(ZeroMQ_FOUND)
~~~
\ No newline at end of file
#ifndef ZMQ_COMPAT_H
#define ZMQ_COMPAT_H
// Handle deprecated methods in cppzmq
#include <zmq.hpp>
// From CPPZMQ_VERSION 4.7.1 onwards:
// warning: void zmq::detail::socket_base::setsockopt(int, const void*, size_t) is deprecated: from 4.7.0, use `set` taking option from zmq::sockopt
// N.B. wrning says "from 4.7.0...", but socket_base::set is not defined in 4.7.0!!!
#if CPPZMQ_VERSION >= ZMQ_MAKE_VERSION(4,7,1)
#define ZMQ_SETSOCKOPT_DEPRECATED
#endif
// From CPPZMQ_VERSION 4.3.1 onwards:
// warning: bool zmq::detail::socket_base::send(zmq::message_t&, int) is deprecated: from 4.3.1, use send taking message_t and send_flags
#if CPPZMQ_VERSION >= ZMQ_MAKE_VERSION(4,3,1)
#define ZMQ_USE_SEND_FLAGS
#endif
// From CPPZMQ_VERSION 4.3.1 onwards:
// warning: bool zmq::detail::socket_base::recv(zmq::message_t*, int) is deprecated: from 4.3.1, use recv taking a reference to message_t and recv_flags
#if CPPZMQ_VERSION >= ZMQ_MAKE_VERSION(4,3,1)
#define ZMQ_USE_RECV_WITH_REFERENCE
#endif
#endif // ZMQ_COMPAT_H
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS MergerInfo.proto)
add_executable(merger-stat merger-spy.cpp ${PROTO_SRCS} merger_spy.cpp)
target_link_libraries(merger-stat PRIVATE ROOT::Hist ROOT::Thread Boost::program_options mfmlib::mfm libzmq protobuf::libprotobuf)
target_include_directories(merger-stat INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>)
install(TARGETS merger-stat DESTINATION ${CMAKE_INSTALL_BINDIR})
set_property(GLOBAL APPEND PROPERTY EXEC_TARGET_LIST merger-stat)
...@@ -4,37 +4,15 @@ ...@@ -4,37 +4,15 @@
#include "boost/program_options.hpp" #include "boost/program_options.hpp"
#include "math.h"
#include "Riostream.h" #include "Riostream.h"
#include "TMath.h"
#include "TApplication.h"
#include "KVEnv.h"
#include "KVString.h"
#include "MFMFileReader.h"
#include "KVDataRepositoryManager.h"
#include "KVDataSetManager.h"
#include "KVMultiDetArray.h"
#include "KVINDRADetector.h"
#include "KVNameValueList.h"
#include "KVINDRA.h"
#include "TRandom3.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include "zmq.hpp"
#include "MergerInfo.pb.h"
#include "merger_spy.h" #include "merger_spy.h"
#include "MFMMergeFrame.h"
#include "MFMFaziaFrame.h"
#include "MFMMesytecMDPPFrame.h"
namespace po = boost::program_options; namespace po = boost::program_options;
using namespace std; using namespace std;
......