mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
29f5ed006a | ||
|
a01aac4467 | ||
|
d98207b475 | ||
|
00f1b56137 | ||
|
5c6be09e58 | ||
|
f2a753e1bd | ||
|
c6ea5a5631 | ||
|
b9651437c3 | ||
|
83315b2951 | ||
|
bafed1b224 | ||
|
5e39011a5b | ||
|
2327fd2115 |
135
CMakeLists.txt
135
CMakeLists.txt
@@ -14,57 +14,156 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
include(FairMQLib)
|
||||
|
||||
set_fairmq_cmake_policies()
|
||||
get_git_version(OUTVAR_PREFIX FairMQ)
|
||||
get_git_version()
|
||||
|
||||
project(FairMQ VERSION ${FairMQ_VERSION} LANGUAGES CXX)
|
||||
message("${BWhite}${PROJECT_NAME}${CR} ${FairMQ_GIT_VERSION} from ${FairMQ_DATE}")
|
||||
project(FairMQ VERSION ${PROJECT_VERSION} LANGUAGES CXX)
|
||||
message(STATUS "${BWhite}${PROJECT_NAME}${CR} ${PROJECT_GIT_VERSION} from ${PROJECT_DATE}")
|
||||
|
||||
set_fairmq_defaults()
|
||||
|
||||
include(CTest)
|
||||
################################################################################
|
||||
|
||||
|
||||
# Build options ################################################################
|
||||
option(BUILD_OFI_TRANSPORT "Build OFI transport." OFF)
|
||||
option(BUILD_NANOMSG_TRANSPORT "Build nanomsg transport." OFF)
|
||||
option(BUILD_OFI_TRANSPORT "Build experimental OFI transport." OFF)
|
||||
option(BUILD_DDS_PLUGIN "Build DDS plugin." OFF)
|
||||
################################################################################
|
||||
|
||||
|
||||
# Dependencies #################################################################
|
||||
if(Boost_INCLUDE_DIR) # Silence output, if Boost was found already
|
||||
set(SILENCE_BOOST QUIET)
|
||||
find_package2(PUBLIC Boost VERSION 1.64 REQUIRED
|
||||
COMPONENTS program_options thread system filesystem regex date_time signals
|
||||
)
|
||||
find_package2(PUBLIC FairLogger VERSION 1.0.2 REQUIRED)
|
||||
find_package2(PRIVATE ZeroMQ VERSION 4.2.2 REQUIRED)
|
||||
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
find_package2(PRIVATE nanomsg VERSION 1.0.0 REQUIRED)
|
||||
find_package2(PRIVATE msgpack VERSION 2.1.5 REQUIRED)
|
||||
endif()
|
||||
find_package(Boost 1.64 ${SILENCE_BOOST} REQUIRED COMPONENTS system)
|
||||
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
find_package(OFI 1.6.0 REQUIRED COMPONENTS fi_sockets)
|
||||
find_package2(PRIVATE OFI VERSION 1.6.0 REQUIRED COMPONENTS fi_sockets)
|
||||
find_package2(PRIVATE Protobuf VERSION 3.4.0 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(BUILD_DDS_PLUGIN)
|
||||
find_package2(PRIVATE DDS VERSION 2.0 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package2(PRIVATE GTest VERSION 1.7.0 REQUIRED)
|
||||
endif()
|
||||
################################################################################
|
||||
|
||||
|
||||
# Targets ######################################################################
|
||||
# Configure Version.hpp
|
||||
configure_file(${PROJECT_NAME_LOWER}/Version.h.in
|
||||
${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}/Version.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
add_subdirectory(fairmq)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
################################################################################
|
||||
|
||||
|
||||
# Package components ###########################################################
|
||||
list(APPEND PROJECT_PACKAGE_COMPONENTS fairmq)
|
||||
list(APPEND PROJECT_PACKAGE_COMPONENTS tests)
|
||||
if(BUILD_DDS_PLUGIN)
|
||||
list(APPEND PROJECT_PACKAGE_COMPONENTS dds_plugin)
|
||||
endif()
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
list(APPEND PROJECT_PACKAGE_COMPONENTS nanomsg_transport)
|
||||
endif()
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
list(APPEND PROJECT_PACKAGE_COMPONENTS ofi_transport)
|
||||
endif()
|
||||
################################################################################
|
||||
|
||||
|
||||
# Installation #################################################################
|
||||
install_fairmq_cmake_package()
|
||||
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}/Version.h
|
||||
DESTINATION ${PROJECT_INSTALL_INCDIR}
|
||||
)
|
||||
|
||||
# Install cmake modules
|
||||
install(FILES cmake/FindZeroMQ.cmake
|
||||
DESTINATION ${PROJECT_INSTALL_CMAKEMODDIR}
|
||||
)
|
||||
if(BUILD_DDS_PLUGIN)
|
||||
install(FILES cmake/FindDDS.cmake
|
||||
DESTINATION ${PROJECT_INSTALL_CMAKEMODDIR}
|
||||
)
|
||||
endif()
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
install(FILES cmake/Findnanomsg.cmake
|
||||
DESTINATION ${PROJECT_INSTALL_CMAKEMODDIR}
|
||||
)
|
||||
endif()
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
install(FILES cmake/FindOFI.cmake
|
||||
DESTINATION ${PROJECT_INSTALL_CMAKEMODDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
install_cmake_package()
|
||||
################################################################################
|
||||
|
||||
|
||||
# Summary ######################################################################
|
||||
message(" ")
|
||||
message(" ${Cyan}COMPONENT BUILT? INFO${CR}")
|
||||
message(" ${BWhite}library${CR} ${BGreen}YES${CR} (default, always built)")
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
set(ofi_summary "${BGreen}YES${CR} (disable with ${BMagenta}-DBUILD_OFI_TRANSPORT=OFF${CR})")
|
||||
message(STATUS " ")
|
||||
message(STATUS " ${Cyan}DEPENDENCY VERSION ${CR}")
|
||||
foreach(dep IN LISTS PROJECT_PACKAGE_DEPENDENCIES)
|
||||
if(${dep}_VERSION)
|
||||
if(${dep} STREQUAL Boost)
|
||||
set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}")
|
||||
else()
|
||||
set(version_str "${BGreen}${${dep}_VERSION}${CR}")
|
||||
endif()
|
||||
else()
|
||||
set(version_str "${BYellow}unknown${CR}")
|
||||
endif()
|
||||
if(PROJECT_${dep}_VERSION)
|
||||
set(version_req_str " (>= ${PROJECT_${dep}_VERSION})")
|
||||
endif()
|
||||
pad(${dep} 15 " " dep_padded)
|
||||
pad("${version_str}${version_req_str}" 20 " " version_padded)
|
||||
message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}")
|
||||
unset(version_str)
|
||||
endforeach()
|
||||
message(STATUS " ")
|
||||
message(STATUS " ${Cyan}COMPONENT BUILT? INFO${CR}")
|
||||
message(STATUS " ${BWhite}fairmq${CR} ${BGreen}YES${CR} (default, always built)")
|
||||
if(BUILD_TESTING)
|
||||
set(tests_summary "${BGreen}YES${CR} (default, disable with ${BMagenta}-DBUILD_TESTING=OFF${CR})")
|
||||
else()
|
||||
set(ofi_summary "${BRed} NO${CR} (default, enable with ${BMagenta}-DBUILD_OFI_TRANSPORT=ON${CR})")
|
||||
set(tests_summary "${BRed} NO${CR} (enable with ${BMagenta}-DBUILD_TESTING=ON${CR})")
|
||||
endif()
|
||||
message(" ${BWhite}OFI transport${CR} ${ofi_summary}")
|
||||
message(" ")
|
||||
message(STATUS " ${BWhite}tests${CR} ${tests_summary}")
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
set(nn_summary "${BGreen}YES${CR} (disable with ${BMagenta}-DBUILD_NANOMSG_TRANSPORT=OFF${CR})")
|
||||
else()
|
||||
set(nn_summary "${BRed} NO${CR} (default, enable with ${BMagenta}-DBUILD_NANOMSG_TRANSPORT=ON${CR})")
|
||||
endif()
|
||||
message(STATUS " ${BWhite}nanomsg_transport${CR} ${nn_summary}")
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
set(ofi_summary "${BGreen}YES${CR} EXPERIMENTAL (disable with ${BMagenta}-DBUILD_OFI_TRANSPORT=OFF${CR})")
|
||||
else()
|
||||
set(ofi_summary "${BRed} NO${CR} EXPERIMENTAL (default, enable with ${BMagenta}-DBUILD_OFI_TRANSPORT=ON${CR})")
|
||||
endif()
|
||||
message(STATUS " ${BWhite}ofi_transport${CR} ${ofi_summary}")
|
||||
if(BUILD_DDS_PLUGIN)
|
||||
set(dds_summary "${BGreen}YES${CR} (disable with ${BMagenta}-DBUILD_DDS_PLUGIN=OFF${CR})")
|
||||
else()
|
||||
set(dds_summary "${BRed} NO${CR} (default, enable with ${BMagenta}-DBUILD_DDS_PLUGIN=ON${CR})")
|
||||
endif()
|
||||
message(STATUS " ${BWhite}dds_plugin${CR} ${dds_summary}")
|
||||
message(STATUS " ")
|
||||
################################################################################
|
||||
|
69
README.md
69
README.md
@@ -4,7 +4,19 @@ C++ Message Queuing Library
|
||||
|
||||
## Dependencies
|
||||
|
||||
TODO
|
||||
* **Boost** (PUBLIC)
|
||||
* **FairLogger** (PUBLIC)
|
||||
* CMake
|
||||
* dl
|
||||
* pthread
|
||||
* rt (Linux)
|
||||
* ZeroMQ
|
||||
* GTest (optional, `tests`)
|
||||
* Msgpack (optional, `nanomsg_transport`)
|
||||
* nanomsg (optional, `nanomsg_transport`)
|
||||
* OFI (optional, `ofi_transport`)
|
||||
* Protobuf (optional, `ofi_transport`)
|
||||
* DDS (optional, `dds_plugin`)
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -15,9 +27,17 @@ cmake -DCMAKE_INSTALL_PREFIX=./fairmq_install ../fairmq
|
||||
cmake --build . --target install
|
||||
```
|
||||
|
||||
If dependencies are not installed in standard system
|
||||
directories, you can hint the installation location
|
||||
via `-DCMAKE_PREFIX_PATH=...` or per dependency via
|
||||
`-D{DEPENDENCY}_ROOT=...`. `{DEPENDENCY}` can be `GTEST`,
|
||||
`BOOST`, `FAIRLOGGER`, `ZEROMQ`, `MSGPACK`, `NANOMSG`,
|
||||
`OFI`, `PROTOBUF`, or `DDS` (`*_ROOT` variables can also
|
||||
be environment variables).
|
||||
|
||||
## Usage
|
||||
|
||||
In your `CMakeLists.txt`:
|
||||
FairMQ ships as a CMake package, so in your `CMakeLists.txt` you can discover it like this:
|
||||
|
||||
```cmake
|
||||
find_package(FairMQ)
|
||||
@@ -26,42 +46,51 @@ find_package(FairMQ)
|
||||
If FairMQ is not installed in system directories, you can hint the installation:
|
||||
|
||||
```cmake
|
||||
set(CMAKE_PREFIX_PATH /path/to/FairMQ/installation ${CMAKE_PREFIX_PATH})
|
||||
set(CMAKE_PREFIX_PATH /path/to/FairMQ_install_prefix ${CMAKE_PREFIX_PATH})
|
||||
find_package(FairMQ)
|
||||
```
|
||||
|
||||
`find_package(FairMQ)` will define an imported target `FairMQ::FairMQ` (An alias `FairRoot::FairMQ` is also defined, but it is deprecated).
|
||||
`find_package(FairMQ)` will define an imported target `FairMQ::FairMQ` (An alias `FairRoot::FairMQ`
|
||||
is also defined for backwards compatibility, but it is deprecated).
|
||||
|
||||
By default, `find_package(FairMQ)` will also invoke `find_package` commands for all its dependencies. You can override this behaviour though, e.g.:
|
||||
In order to succesfully compile and link against the `FairMQ::FairMQ` target,
|
||||
you need to discover its public package dependencies, too.
|
||||
|
||||
```cmake
|
||||
set(FairMQ_PACKAGE_DEPENDENCIES_DISABLED ON)
|
||||
find_package(FairMQ)
|
||||
|
||||
find_package(Boost COMPONENTS ${FairMQ_BOOST_COMPONENTS})
|
||||
find_package(ZeroMQ)
|
||||
# ...
|
||||
find_package(FairLogger ${FairMQ_FairLogger_VERSION})
|
||||
find_package(Boost ${FairMQ_Boost_VERSION} COMPONENTS ${FairMQ_BOOST_COMPONENTS})
|
||||
```
|
||||
|
||||
The above is useful, if you need to customize the `find_package` calls of FairMQ's dependencies. Check the next section for more CMake options.
|
||||
Of course, feel free to customize the above commands to your needs.
|
||||
|
||||
Optionally, you can require certain FairMQ package components and a minimum version:
|
||||
|
||||
```cmake
|
||||
find_package(FairMQ 1.1.0 COMPONENTS nanomsg_transport dds_plugin)
|
||||
find_package(FairLogger ${FairMQ_FairLogger_VERSION})
|
||||
find_package(Boost ${FairMQ_Boost_VERSION} COMPONENTS ${FairMQ_BOOST_COMPONENTS})
|
||||
```
|
||||
|
||||
When building FairMQ, CMake will print a summary table of all available package components.
|
||||
|
||||
## CMake options
|
||||
|
||||
TODO complete list
|
||||
|
||||
On command line:
|
||||
|
||||
* `-DDISABLE_COLOR=ON` disables coloured console output.
|
||||
* `-DBUILD_TESTING=OFF` disables building of tests.
|
||||
* `-DBUILD_NANOMSG_TRANSPORT=ON` enables building of nanomsg transport.
|
||||
* `-DBUILD_OFI_TRANSPORT=ON` enables building of the experimental OFI transport.
|
||||
* `-DBUILD_DDS_PLUGIN=ON` enables building of the DDS plugin.
|
||||
* You can hint non-system installations for dependent packages, see the #Installation section above
|
||||
|
||||
In front of the `find_package(FairMQ)` call:
|
||||
After the `find_package(FairMQ)` call the following CMake variables are defined:
|
||||
|
||||
* `set(BUILD_OFI_TRANSPORT ON)` enables building of the experimental OFI transport.
|
||||
* `set(FairMQ_PACKAGE_DEPENDENCIES_DISABLED ON)` disables implicit discovery of all transitive package dependencies.
|
||||
|
||||
After the `find_package(FairMQ)` the following CMake variables are defined:
|
||||
|
||||
* `${FairMQ_BOOST_COMPONENTS}` contains the list of Boost components FairMQ depends on.
|
||||
* `${FairMQ_Boost_VERSION}` contains the minimum Boost version FairMQ requires.
|
||||
* `${FairMQ_Boost_COMPONENTS}` contains the list of Boost components FairMQ depends on.
|
||||
* `${FairMQ_FairLogger_VERSION}` contains the minimum FairLogger version FairMQ requires.
|
||||
* ... TODO
|
||||
|
||||
## Documentation
|
||||
|
||||
|
@@ -11,55 +11,28 @@ cmake_minimum_required(VERSION 3.9.4 FATAL_ERROR)
|
||||
@PACKAGE_INIT@
|
||||
|
||||
### General variables for project discovery/inspection
|
||||
set(FAIRMQ_VERSION @PROJECT_VERSION@)
|
||||
set(FAIRMQ_GIT_VERSION @FAIRMQ_GIT_VERSION@)
|
||||
set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@)
|
||||
set(@PROJECT_NAME@_GIT_VERSION @PROJECT_GIT_VERSION@)
|
||||
set(@PROJECT_NAME@_GIT_DATE @PROJECT_GIT_DATE@)
|
||||
|
||||
set_and_check(FairMQ_ROOT @PACKAGE_CMAKE_INSTALL_PREFIX@)
|
||||
set_and_check(FairMQ_BINDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@FairMQ_INSTALL_BINDIR@)
|
||||
set_and_check(FairMQ_INCDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@FairMQ_INSTALL_INCDIR@)
|
||||
set_and_check(FairMQ_LIBDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@FairMQ_INSTALL_LIBDIR@)
|
||||
set_and_check(FairMQ_DATADIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@FairMQ_INSTALL_DATADIR@)
|
||||
set_and_check(FairMQ_CMAKEMODDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@FairMQ_INSTALL_CMAKEMODDIR@)
|
||||
set_and_check(@PROJECT_NAME@_ROOT @PACKAGE_CMAKE_INSTALL_PREFIX@)
|
||||
set_and_check(@PROJECT_NAME@_BINDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@PROJECT_INSTALL_BINDIR@)
|
||||
set_and_check(@PROJECT_NAME@_INCDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@)
|
||||
set_and_check(@PROJECT_NAME@_LIBDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@PROJECT_INSTALL_LIBDIR@)
|
||||
set_and_check(@PROJECT_NAME@_DATADIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@PROJECT_INSTALL_DATADIR@)
|
||||
set_and_check(@PROJECT_NAME@_CMAKEMODDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@PROJECT_INSTALL_CMAKEMODDIR@)
|
||||
|
||||
### Import cmake modules
|
||||
set(CMAKE_MODULE_PATH ${FairMQ_CMAKEMODDIR} ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${@PROJECT_NAME@_CMAKEMODDIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
### Package dependencies
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if( NOT (FairMQ_BOOST_DISABLED OR FairMQ_PACKAGE_DEPENDENCIES_DISABLED)
|
||||
AND (@Boost_FOUND@ OR FairMQ_Boost_REQUIRED))
|
||||
set(FairMQ_Boost_COMPONENTS system)
|
||||
if(FairMQ_ADDITIONAL_Boost_COMPONENTS)
|
||||
list(APPEND FairMQ_Boost_COMPONENTS ${FairMQ_ADDITIONAL_Boost_COMPONENTS})
|
||||
list(REMOVE_DUPLICATES FairMQ_Boost_COMPONENTS)
|
||||
endif()
|
||||
if(Boost_INCLUDE_DIR) # checks for cached boost variable which indicates if Boost is already found
|
||||
set(SILENCE_BOOST QUIET)
|
||||
endif()
|
||||
find_dependency(Boost 1.64 ${SILENCE_BOOST}
|
||||
COMPONENTS ${FairMQ_Boost_COMPONENTS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if( NOT (FairMQ_OFI_DISABLED OR FairMQ_PACKAGE_DEPENDENCIES_DISABLED)
|
||||
AND (@OFI_FOUND@ OR FairMQ_OFI_REQUIRED))
|
||||
set(FairMQ_OFI_COMPONENTS fi_sockets)
|
||||
if(FairMQ_ADDITIONAL_OFI_COMPONENTS)
|
||||
list(APPEND FairMQ_OFI_COMPONENTS ${FairMQ_ADDITIONAL_OFI_COMPONENTS})
|
||||
list(REMOVE_DUPLICATES FairMQ_OFI_COMPONENTS)
|
||||
endif()
|
||||
find_dependency(OFI 1.6.0
|
||||
COMPONENTS ${FairMQ_OFI_COMPONENTS}
|
||||
)
|
||||
endif()
|
||||
@PACKAGE_DEPENDENCIES@
|
||||
|
||||
### Import targets
|
||||
include(@PACKAGE_CMAKE_INSTALL_PREFIX@/@PACKAGE_INSTALL_DESTINATION@/FairMQTargets.cmake)
|
||||
include(@PACKAGE_CMAKE_INSTALL_PREFIX@/@PACKAGE_INSTALL_DESTINATION@/@PROJECT_EXPORT_SET@.cmake)
|
||||
|
||||
### Alias target for backwards compat (DEPRECATED)
|
||||
if(NOT TARGET FairRoot::FairMQ)
|
||||
add_library(FairRoot::FairMQ ALIAS FairMQ::FairMQ)
|
||||
if(NOT TARGET FairRoot::@PROJECT_NAME@)
|
||||
add_library(FairRoot::@PROJECT_NAME@ ALIAS @PROJECT_NAME@::@PROJECT_NAME@)
|
||||
endif()
|
||||
|
||||
check_required_components(FairMQ)
|
||||
@PACKAGE_COMPONENTS@
|
||||
|
@@ -35,7 +35,9 @@ endif()
|
||||
macro(set_fairmq_cmake_policies)
|
||||
# Find more details to each policy with cmake --help-policy CMPXXXX
|
||||
foreach(policy
|
||||
CMP0025 # Compiler id for Apple Clang is now AppleClang.
|
||||
CMP0028 # Double colon in target name means ALIAS or IMPORTED target.
|
||||
CMP0042 # MACOSX_RPATH is enabled by default.
|
||||
CMP0048 # The ``project()`` command manages VERSION variables.
|
||||
CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted.
|
||||
)
|
||||
@@ -54,7 +56,7 @@ function(get_git_version)
|
||||
cmake_parse_arguments(ARGS "" "DEFAULT_VERSION;DEFAULT_DATE;OUTVAR_PREFIX" "" ${ARGN})
|
||||
|
||||
if(NOT ARGS_OUTVAR_PREFIX)
|
||||
set(ARGS_OUTVAR_PREFIX FairMQ)
|
||||
set(ARGS_OUTVAR_PREFIX PROJECT)
|
||||
endif()
|
||||
|
||||
if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
@@ -103,6 +105,7 @@ endfunction()
|
||||
# Set defaults
|
||||
macro(set_fairmq_defaults)
|
||||
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
|
||||
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
|
||||
|
||||
# Set a default build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
@@ -120,6 +123,9 @@ macro(set_fairmq_defaults)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
# Set -fpic as default for all library types
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# Generate compile_commands.json file (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
@@ -127,37 +133,106 @@ macro(set_fairmq_defaults)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Define install dirs
|
||||
set(FairMQ_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
|
||||
set(FairMQ_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME_LOWER})
|
||||
set(FairMQ_INSTALL_INCDIR ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME_LOWER})
|
||||
set(FairMQ_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME_LOWER})
|
||||
set(FairMQ_INSTALL_CMAKEMODDIR ${FairMQ_INSTALL_DATADIR}/cmake)
|
||||
set(PROJECT_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
|
||||
set(PROJECT_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME_LOWER})
|
||||
set(PROJECT_INSTALL_INCDIR ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME_LOWER})
|
||||
set(PROJECT_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME_LOWER})
|
||||
set(PROJECT_INSTALL_CMAKEMODDIR ${PROJECT_INSTALL_DATADIR}/cmake)
|
||||
|
||||
# https://cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_LIBDIR}" isSystemDir)
|
||||
if("${isSystemDir}" STREQUAL "-1")
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
# Define export set, only one for now
|
||||
set(FairMQ_EXPORT_SET ${PROJECT_NAME}Targets)
|
||||
set(PROJECT_EXPORT_SET ${PROJECT_NAME}Targets)
|
||||
endmacro()
|
||||
|
||||
function(join VALUES GLUE OUTPUT)
|
||||
string(REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
|
||||
string(REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
|
||||
set(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(pad str width char out)
|
||||
string(LENGTH ${str} length)
|
||||
math(EXPR padding "${width}-${length}")
|
||||
if(padding GREATER 0)
|
||||
foreach(i RANGE ${padding})
|
||||
set(str "${str}${char}")
|
||||
endforeach()
|
||||
endif()
|
||||
set(${out} ${str} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(generate_package_dependencies)
|
||||
join("${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES}" " " DEPS)
|
||||
set(PACKAGE_DEPENDENCIES "\
|
||||
####### Expanded from @PACKAGE_DEPENDENCIES@ by configure_package_config_file() #######
|
||||
|
||||
set(${PROJECT_NAME}_PACKAGE_DEPENDENCIES ${DEPS})
|
||||
|
||||
")
|
||||
foreach(dep IN LISTS PROJECT_INTERFACE_PACKAGE_DEPENDENCIES)
|
||||
join("${PROJECT_INTERFACE_${dep}_COMPONENTS}" " " COMPS)
|
||||
if(COMPS)
|
||||
string(CONCAT PACKAGE_DEPENDENCIES ${PACKAGE_DEPENDENCIES} "\
|
||||
set(${PROJECT_NAME}_${dep}_COMPONENTS ${COMPS})
|
||||
")
|
||||
endif()
|
||||
if(PROJECT_INTERFACE_${dep}_VERSION)
|
||||
string(CONCAT PACKAGE_DEPENDENCIES ${PACKAGE_DEPENDENCIES} "\
|
||||
set(${PROJECT_NAME}_${dep}_VERSION ${PROJECT_INTERFACE_${dep}_VERSION})
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
string(CONCAT PACKAGE_DEPENDENCIES ${PACKAGE_DEPENDENCIES} "\
|
||||
|
||||
#######################################################################################
|
||||
")
|
||||
set(PACKAGE_DEPENDENCIES ${PACKAGE_DEPENDENCIES} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(generate_package_components)
|
||||
join("${PROJECT_PACKAGE_COMPONENTS}" " " COMPS)
|
||||
set(PACKAGE_COMPONENTS "\
|
||||
####### Expanded from @PACKAGE_COMPONENTS@ by configure_package_config_file() #########
|
||||
|
||||
set(${PROJECT_NAME}_PACKAGE_COMPONENTS ${COMPS})
|
||||
|
||||
")
|
||||
foreach(comp IN LISTS PROJECT_PACKAGE_COMPONENTS)
|
||||
string(CONCAT PACKAGE_COMPONENTS ${PACKAGE_COMPONENTS} "\
|
||||
set(${PROJECT_NAME}_${comp}_FOUND TRUE)
|
||||
")
|
||||
endforeach()
|
||||
string(CONCAT PACKAGE_COMPONENTS ${PACKAGE_COMPONENTS} "\
|
||||
|
||||
check_required_components(${PROJECT_NAME})
|
||||
")
|
||||
set(PACKAGE_COMPONENTS ${PACKAGE_COMPONENTS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Configure/Install CMake package
|
||||
macro(install_fairmq_cmake_package)
|
||||
# Install cmake modules
|
||||
install( FILES cmake/FindOFI.cmake
|
||||
DESTINATION ${FairMQ_INSTALL_CMAKEMODDIR}
|
||||
)
|
||||
|
||||
macro(install_cmake_package)
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(PACKAGE_INSTALL_DESTINATION
|
||||
${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
|
||||
)
|
||||
install(EXPORT ${FairMQ_EXPORT_SET}
|
||||
install(EXPORT ${PROJECT_EXPORT_SET}
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
DESTINATION ${PACKAGE_INSTALL_DESTINATION}
|
||||
EXPORT_LINK_INTERFACE_LIBRARIES
|
||||
)
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
generate_package_dependencies() # fills ${PACKAGE_DEPENDENCIES}
|
||||
generate_package_components() # fills ${PACKAGE_COMPONENTS}
|
||||
configure_package_config_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
@@ -170,3 +245,35 @@ macro(install_fairmq_cmake_package)
|
||||
DESTINATION ${PACKAGE_INSTALL_DESTINATION}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
function(find_package2 qualifier pkgname)
|
||||
cmake_parse_arguments(ARGS "" "VERSION" "COMPONENTS" ${ARGN})
|
||||
|
||||
string(TOUPPER ${pkgname} pkgname_upper)
|
||||
set(CMAKE_PREFIX_PATH ${${pkgname_upper}_ROOT} $ENV{${pkgname_upper}_ROOT} ${CMAKE_PREFIX_PATH})
|
||||
if(ARGS_COMPONENTS)
|
||||
find_package(${pkgname} ${ARGS_VERSION} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS})
|
||||
else()
|
||||
find_package(${pkgname} ${ARGS_VERSION} QUIET ${ARGS_UNPARSED_ARGUMENTS})
|
||||
endif()
|
||||
|
||||
set(${pkgname}_VERSION ${${pkgname}_VERSION} PARENT_SCOPE)
|
||||
set(${pkgname}_MAJOR_VERSION ${${pkgname}_MAJOR_VERSION} PARENT_SCOPE)
|
||||
set(${pkgname}_MINOR_VERSION ${${pkgname}_MINOR_VERSION} PARENT_SCOPE)
|
||||
if(qualifier STREQUAL PRIVATE)
|
||||
set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION} PARENT_SCOPE)
|
||||
set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS} PARENT_SCOPE)
|
||||
set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname} PARENT_SCOPE)
|
||||
elseif(qualifier STREQUAL PUBLIC)
|
||||
set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION} PARENT_SCOPE)
|
||||
set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS} PARENT_SCOPE)
|
||||
set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname} PARENT_SCOPE)
|
||||
set(PROJECT_INTERFACE_${pkgname}_VERSION ${ARGS_VERSION} PARENT_SCOPE)
|
||||
set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS} PARENT_SCOPE)
|
||||
set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname} PARENT_SCOPE)
|
||||
elseif(qualifier STREQUAL INTERFACE)
|
||||
set(PROJECT_INTERFACE_${pkgname}_VERSION ${ARGS_VERSION} PARENT_SCOPE)
|
||||
set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS} PARENT_SCOPE)
|
||||
set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
88
cmake/FindDDS.cmake
Normal file
88
cmake/FindDDS.cmake
Normal file
@@ -0,0 +1,88 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
find_path(DDS_INCLUDE_DIR
|
||||
NAMES dds_intercom.h
|
||||
HINTS ${DDS_ROOT} $ENV{DDS_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
find_path(DDS_LIBRARY_DIR
|
||||
NAMES libdds_intercom_lib.dylib libdds_intercom_lib.so
|
||||
HINTS ${DDS_ROOT} $ENV{DDS_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
find_library(DDS_INTERCOM_LIBRARY_SHARED
|
||||
NAMES libdds_intercom_lib.dylib libdds_intercom_lib.so
|
||||
HINTS ${DDS_ROOT} $ENV{DDS_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to libdds_intercom_lib.dylib libdds_intercom_lib.so."
|
||||
)
|
||||
|
||||
find_library(DDS_PROTOCOL_LIBRARY_SHARED
|
||||
NAMES libdds_protocol_lib.dylib libdds_protocol_lib.so
|
||||
HINTS ${DDS_ROOT} $ENV{DDS_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to libdds_protocol_lib.dylib libdds_protocol_lib.so."
|
||||
)
|
||||
|
||||
find_library(DDS_USER_DEFAULTS_LIBRARY_SHARED
|
||||
NAMES libdds-user-defaults.dylib libdds-user-defaults.so
|
||||
HINTS ${DDS_ROOT} $ENV{DDS_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to libdds-user-defaults.dylib libdds-user-defaults.so."
|
||||
)
|
||||
|
||||
find_file(DDS_VERSION_FILE
|
||||
NAMES version
|
||||
HINTS ${DDS_ROOT} $ENV{DDS_ROOT}
|
||||
PATH_SUFFIXES etc
|
||||
)
|
||||
|
||||
if(DDS_VERSION_FILE AND NOT DDS_VERSION)
|
||||
file(READ ${DDS_VERSION_FILE} DDS_VERSION)
|
||||
string(STRIP "${DDS_VERSION}" DDS_VERSION)
|
||||
set(DDS_VERSION ${DDS_VERSION} CACHE string "DDS version.")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(DDS
|
||||
REQUIRED_VARS
|
||||
DDS_INCLUDE_DIR
|
||||
DDS_LIBRARY_DIR
|
||||
DDS_INTERCOM_LIBRARY_SHARED
|
||||
DDS_PROTOCOL_LIBRARY_SHARED
|
||||
DDS_USER_DEFAULTS_LIBRARY_SHARED
|
||||
|
||||
VERSION_VAR DDS_VERSION
|
||||
)
|
||||
|
||||
if(NOT TARGET DDS::dds_intercom_lib AND DDS_FOUND)
|
||||
add_library(DDS::dds_intercom_lib SHARED IMPORTED)
|
||||
set_target_properties(DDS::dds_intercom_lib PROPERTIES
|
||||
IMPORTED_LOCATION ${DDS_INTERCOM_LIBRARY_SHARED}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${DDS_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET DDS::dds_protocol_lib AND DDS_FOUND)
|
||||
add_library(DDS::dds_protocol_lib SHARED IMPORTED)
|
||||
set_target_properties(DDS::dds_protocol_lib PROPERTIES
|
||||
IMPORTED_LOCATION ${DDS_PROTOCOL_LIBRARY_SHARED}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${DDS_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET DDS::dds-user-defaults AND DDS_FOUND)
|
||||
add_library(DDS::dds-user-defaults SHARED IMPORTED)
|
||||
set_target_properties(DDS::dds-user-defaults PROPERTIES
|
||||
IMPORTED_LOCATION ${DDS_USER_DEFAULTS_LIBRARY_SHARED}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${DDS_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
67
cmake/FindFlatBuffers.cmake
Normal file
67
cmake/FindFlatBuffers.cmake
Normal file
@@ -0,0 +1,67 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
find_path(FLATBUFFERS_INCLUDE_DIR
|
||||
NAMES flatbuffers/flatbuffers.h
|
||||
HINTS ${FLATBUFFERS_ROOT} $ENV{FLATBUFFERS_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
find_path(FLATBUFFERS_LIBRARY_DIR
|
||||
NAMES libflatbuffers.a
|
||||
HINTS ${FLATBUFFERS_ROOT} $ENV{FLATBUFFERS_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
find_library(FLATBUFFERS_STATIC_LIBRARY
|
||||
NAMES libflatbuffers.a
|
||||
HINTS ${FLATBUFFERS_ROOT} $ENV{FLATBUFFERS_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
find_path(FLATBUFFERS_BINARY_DIR
|
||||
NAMES flatc
|
||||
HINTS ${FLATBUFFERS_ROOT} $ENV{FLATBUFFERS_ROOT}
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
|
||||
find_program(FLATBUFFERS_BINARY_FLATC
|
||||
NAMES flatc
|
||||
HINTS ${FLATBUFFERS_ROOT} $ENV{FLATBUFFERS_ROOT}
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FlatBuffers
|
||||
REQUIRED_VARS
|
||||
FLATBUFFERS_INCLUDE_DIR
|
||||
FLATBUFFERS_LIBRARY_DIR
|
||||
FLATBUFFERS_BINARY_DIR
|
||||
)
|
||||
|
||||
# idempotently import targets
|
||||
if(NOT TARGET FlatBuffers)
|
||||
if(FLATBUFFERS_FOUND)
|
||||
# import target
|
||||
add_library(FlatBuffers STATIC IMPORTED)
|
||||
set_target_properties(FlatBuffers PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${FLATBUFFERS_INCLUDE_DIR}
|
||||
IMPORTED_LOCATION ${FLATBUFFERS_STATIC_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET FlatBuffers::flatc)
|
||||
if(FLATBUFFERS_FOUND)
|
||||
# import target
|
||||
add_executable(FlatBuffers::flatc IMPORTED)
|
||||
set_target_properties(FlatBuffers::flatc PROPERTIES
|
||||
IMPORTED_LOCATION ${FLATBUFFERS_BINARY_FLATC}
|
||||
)
|
||||
endif()
|
||||
endif()
|
@@ -20,7 +20,7 @@ endif()
|
||||
|
||||
# This should be the default as of CMake 3.1, but it is not set. BUG? Also, it does not work
|
||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1)
|
||||
find_package(PkgConfig)
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
# Find include dir and dependencies from pkgconfig
|
||||
@@ -79,7 +79,7 @@ if(PKG_CONFIG_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(OFI_FOUND)
|
||||
if(NOT TARGET OFI::libfabric AND OFI_FOUND)
|
||||
# Define an imported target
|
||||
add_library(OFI::libfabric SHARED IMPORTED GLOBAL)
|
||||
set_target_properties(OFI::libfabric PROPERTIES
|
||||
|
112
cmake/FindZeroMQ.cmake
Normal file
112
cmake/FindZeroMQ.cmake
Normal file
@@ -0,0 +1,112 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2012-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
#
|
||||
# Authors:
|
||||
#
|
||||
# Mohammad Al-Turany
|
||||
# Dario Berzano
|
||||
# Dennis Klein
|
||||
# Matthias Richter
|
||||
# Alexey Rybalchenko
|
||||
# Florian Uhlig
|
||||
#
|
||||
#
|
||||
# #############################
|
||||
# # Locate the ZeroMQ library #
|
||||
# #############################
|
||||
#
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# find_package(ZeroMQ [version] [QUIET] [REQUIRED])
|
||||
#
|
||||
#
|
||||
# Defines the following variables:
|
||||
#
|
||||
# ZeroMQ_FOUND - Found the ZeroMQ library
|
||||
# ZeroMQ_INCLUDE_DIR (CMake cache) - Include directory
|
||||
# ZeroMQ_LIBRARY_SHARED (CMake cache) - Path to shared libzmq
|
||||
# ZeroMQ_LIBRARY_STATIC (CMake cache) - Path to static libzmq
|
||||
# ZeroMQ_VERSION - full version string
|
||||
# ZeroMQ_VERSION_MAJOR - major version component
|
||||
# ZeroMQ_VERSION_MINOR - minor version component
|
||||
# ZeroMQ_VERSION_PATCH - patch version component
|
||||
#
|
||||
#
|
||||
# Accepts the following variables as hints for installation directories:
|
||||
#
|
||||
# ZEROMQ_ROOT (CMake var, ENV var)
|
||||
#
|
||||
#
|
||||
# If the above variables are not defined, or if ZeroMQ could not be found there,
|
||||
# it will look for it in the system directories. Custom ZeroMQ installations
|
||||
# will always have priority over system ones.
|
||||
#
|
||||
|
||||
if(NOT ZEROMQ_ROOT)
|
||||
set(ZEROMQ_ROOT $ENV{ZEROMQ_ROOT})
|
||||
endif()
|
||||
|
||||
find_path(ZeroMQ_INCLUDE_DIR
|
||||
NAMES zmq.h zmq_utils.h
|
||||
HINTS ${ZEROMQ_ROOT} $ENV{ZEROMQ_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "ZeroMQ include directories"
|
||||
)
|
||||
|
||||
find_library(ZeroMQ_LIBRARY_SHARED
|
||||
NAMES libzmq.dylib libzmq.so
|
||||
HINTS ${ZEROMQ_ROOT} $ENV{ZEROMQ_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to libzmq.dylib or libzmq.so"
|
||||
)
|
||||
|
||||
find_library(ZeroMQ_LIBRARY_STATIC NAMES libzmq.a
|
||||
HINTS ${ZEROMQ_ROOT} $ENV{ZEROMQ_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to libzmq.a"
|
||||
)
|
||||
|
||||
find_file(ZeroMQ_HEADER_FILE "zmq.h"
|
||||
${ZeroMQ_INCLUDE_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if(DEFINED ZeroMQ_HEADER_FILE)
|
||||
file(READ "${ZeroMQ_HEADER_FILE}" _ZeroMQ_HEADER_FILE_CONTENT)
|
||||
string(REGEX MATCH "#define ZMQ_VERSION_MAJOR ([0-9])" _MATCH "${_ZeroMQ_HEADER_FILE_CONTENT}")
|
||||
set(ZeroMQ_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "#define ZMQ_VERSION_MINOR ([0-9])" _MATCH "${_ZeroMQ_HEADER_FILE_CONTENT}")
|
||||
set(ZeroMQ_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "#define ZMQ_VERSION_PATCH ([0-9])" _MATCH "${_ZeroMQ_HEADER_FILE_CONTENT}")
|
||||
set(ZeroMQ_VERSION_PATCH ${CMAKE_MATCH_1})
|
||||
set(ZeroMQ_VERSION "${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}.${ZeroMQ_VERSION_PATCH}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZeroMQ
|
||||
REQUIRED_VARS ZeroMQ_LIBRARY_SHARED ZeroMQ_INCLUDE_DIR ZeroMQ_LIBRARY_STATIC
|
||||
VERSION_VAR ZeroMQ_VERSION
|
||||
)
|
||||
|
||||
if(ZeroMQ_FOUND AND NOT TARGET ZeroMQ)
|
||||
add_library(ZeroMQ SHARED IMPORTED)
|
||||
set_target_properties(ZeroMQ PROPERTIES
|
||||
IMPORTED_LOCATION ${ZeroMQ_LIBRARY_SHARED}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
ZeroMQ_LIBRARIES
|
||||
ZeroMQ_LIBRARY_SHARED
|
||||
ZeroMQ_LIBRARY_STATIC
|
||||
ZeroMQ_HEADER_FILE
|
||||
ZeroMQ_VERSION_MAJOR
|
||||
ZeroMQ_VERSION_MINOR
|
||||
ZeroMQ_VERSION_PATCH
|
||||
)
|
34
cmake/Findnanomsg.cmake
Normal file
34
cmake/Findnanomsg.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
find_path(NANOMSG_INCLUDE_DIR
|
||||
NAMES nanomsg/nn.h
|
||||
HINTS ${NANOMSG_ROOT} $ENV{NANOMSG_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to nanomsg include header files."
|
||||
)
|
||||
|
||||
find_library(NANOMSG_LIBRARY_SHARED
|
||||
NAMES libnanomsg.dylib libnanomsg.so
|
||||
HINTS ${NANOMSG_ROOT} $ENV{NANOMSG_ROOT}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to libnanomsg.dylib libnanomsg.so."
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(nanomsg
|
||||
REQUIRED_VARS NANOMSG_LIBRARY_SHARED NANOMSG_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(NOT TARGET nanomsg AND nanomsg_FOUND)
|
||||
add_library(nanomsg SHARED IMPORTED)
|
||||
set_target_properties(nanomsg PROPERTIES
|
||||
IMPORTED_LOCATION ${NANOMSG_LIBRARY_SHARED}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${NANOMSG_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
139
cmake/GTestHelper.cmake
Normal file
139
cmake/GTestHelper.cmake
Normal file
@@ -0,0 +1,139 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2017-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
# ##########################
|
||||
# # GTest helper functions #
|
||||
# ##########################
|
||||
#
|
||||
# The helper functions allow concise cmake files for GTest based test submodules.
|
||||
# Testsuites register themselves automatically as CTest test.
|
||||
#
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# add_testsuite(<name> SOURCES source1 [source2 ...]
|
||||
# [DEPENDS dep1 [dep2 ...]]
|
||||
# [LINKS linklib1 [linklib2 ...]
|
||||
# [INCLUDES dir1 [dir2 ...]
|
||||
# [TIMEOUT seconds]
|
||||
# [RUN_SERIAL ON/OFF])
|
||||
#
|
||||
# -> created target: testsuite_<name>
|
||||
#
|
||||
# add_testhelper(<name> SOURCES source1 [source2 ...]
|
||||
# [DEPENDS dep1 [dep2 ...]]
|
||||
# [LINKS linklib1 [linklib2 ...]
|
||||
# [INCLUDES dir1 [dir2 ...])
|
||||
#
|
||||
# -> created target: testhelper_<name>
|
||||
#
|
||||
# add_testlib(<name> SOURCES source1 [source2 ...]
|
||||
# [DEPENDS dep1 [dep2 ...]]
|
||||
# [LINKS linklib1 [linklib2 ...]
|
||||
# [INCLUDES dir1 [dir2 ...])
|
||||
#
|
||||
# -> created target: <name>
|
||||
#
|
||||
# The above add_* functions add all created targets to the cmake
|
||||
# variable ALL_TEST_TARGETS which can be used to create an aggregate
|
||||
# target, e.g.:
|
||||
#
|
||||
# add_custom_target(AllTests DEPENDS ${ALL_TEST_TARGETS})
|
||||
#
|
||||
#
|
||||
|
||||
function(add_testsuite suitename)
|
||||
cmake_parse_arguments(testsuite
|
||||
""
|
||||
"TIMEOUT;RUN_SERIAL"
|
||||
"SOURCES;LINKS;DEPENDS;INCLUDES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
list(INSERT testsuite_LINKS 0 GTest::Main GTest::GTest)
|
||||
set(target "testsuite_${suitename}")
|
||||
|
||||
add_executable(${target} ${testsuite_SOURCES})
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set_target_properties("${target}" PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
|
||||
endif()
|
||||
target_link_libraries(${target} ${testsuite_LINKS})
|
||||
if(testsuite_DEPENDS)
|
||||
add_dependencies(${target} ${testsuite_DEPENDS})
|
||||
endif()
|
||||
if(testsuite_INCLUDES)
|
||||
target_include_directories(${target} PUBLIC ${testsuite_INCLUDES})
|
||||
endif()
|
||||
|
||||
add_test(NAME "${suitename}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${target})
|
||||
if(testsuite_TIMEOUT)
|
||||
set_tests_properties("${suitename}" PROPERTIES TIMEOUT ${testsuite_TIMEOUT})
|
||||
endif()
|
||||
if(testsuite_RUN_SERIAL)
|
||||
set_tests_properties("${suitename}" PROPERTIES RUN_SERIAL ${testsuite_RUN_SERIAL})
|
||||
endif()
|
||||
|
||||
list(APPEND ALL_TEST_TARGETS ${target})
|
||||
set(ALL_TEST_TARGETS ${ALL_TEST_TARGETS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(add_testhelper helpername)
|
||||
cmake_parse_arguments(testhelper
|
||||
""
|
||||
""
|
||||
"SOURCES;LINKS;DEPENDS;INCLUDES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
set(target "testhelper_${helpername}")
|
||||
|
||||
add_executable(${target} ${testhelper_SOURCES})
|
||||
if(testhelper_LINKS)
|
||||
target_link_libraries(${target} ${testhelper_LINKS})
|
||||
endif()
|
||||
if(testhelper_DEPENDS)
|
||||
add_dependencies(${target} ${testhelper_DEPENDS})
|
||||
endif()
|
||||
if(testhelper_INCLUDES)
|
||||
target_include_directories(${target} PUBLIC ${testhelper_INCLUDES})
|
||||
endif()
|
||||
|
||||
list(APPEND ALL_TEST_TARGETS ${target})
|
||||
set(ALL_TEST_TARGETS ${ALL_TEST_TARGETS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(add_testlib libname)
|
||||
cmake_parse_arguments(testlib
|
||||
"HIDDEN"
|
||||
"VERSION"
|
||||
"SOURCES;LINKS;DEPENDS;INCLUDES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
set(target "${libname}")
|
||||
|
||||
add_library(${target} SHARED ${testlib_SOURCES})
|
||||
if(testlib_LINKS)
|
||||
target_link_libraries(${target} ${testlib_LINKS})
|
||||
endif()
|
||||
if(testlib_DEPENDS)
|
||||
add_dependencies(${target} ${testlib_DEPENDS})
|
||||
endif()
|
||||
if(testlib_INCLUDES)
|
||||
target_include_directories(${target} PUBLIC ${testlib_INCLUDES})
|
||||
endif()
|
||||
if(testlib_HIDDEN)
|
||||
set_target_properties(${target} PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
if(testlib_VERSION)
|
||||
set_target_properties(${target} PROPERTIES VERSION ${testlib_VERSION})
|
||||
endif()
|
||||
|
||||
list(APPEND ALL_TEST_TARGETS ${target})
|
||||
set(ALL_TEST_TARGETS ${ALL_TEST_TARGETS} PARENT_SCOPE)
|
||||
endfunction()
|
@@ -1,71 +1,43 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2012-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# Copyright (C) 2012-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
#
|
||||
# This is the top-level cmake file for the FairMQ submodule.
|
||||
#
|
||||
# Testing:
|
||||
# Enable the building of tests by enabling the cmake option BUILD_TESTING.
|
||||
#
|
||||
# Linking:
|
||||
# Depend on FairMQ target, if you want to link against libFairMQ.
|
||||
#
|
||||
# Convenience targets defined:
|
||||
# * FairMQFull - build everything in the submodule except tests
|
||||
# * FairMQAll - build everything including tests, if enabled
|
||||
# * FairMQInstall - install everything from the FairMQ submodule
|
||||
# * FairMQTests - build all tests in the submodule
|
||||
#
|
||||
# Installation:
|
||||
# * Header files are installed hierarchically
|
||||
# into ${CMAKE_INSTALL_PREFIX}/include/fairmq
|
||||
# * All targets in FairMQFull are exported to
|
||||
# ${CMAKE_INSTALL_PREFIX}/include/cmake/FairMQ.cmake
|
||||
# with namespace prefix "FairRoot::"
|
||||
#
|
||||
#
|
||||
|
||||
####################
|
||||
# external plugins #
|
||||
####################
|
||||
if (DDS_FOUND)
|
||||
add_subdirectory(plugins/DDS)
|
||||
if(BUILD_DDS_PLUGIN)
|
||||
add_subdirectory(plugins/DDS)
|
||||
endif()
|
||||
|
||||
|
||||
############################
|
||||
# preprocessor definitions #
|
||||
############################
|
||||
if(NANOMSG_FOUND)
|
||||
add_definitions(-DNANOMSG_FOUND)
|
||||
if(MSGPACK_FOUND)
|
||||
add_definitions(-DMSGPACK_FOUND)
|
||||
endif()
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
add_definitions(-DBUILD_NANOMSG_TRANSPORT)
|
||||
endif()
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
add_definitions(-DBUILD_OFI_TRANSPORT)
|
||||
add_definitions(-DBUILD_OFI_TRANSPORT)
|
||||
endif()
|
||||
|
||||
|
||||
##################
|
||||
# subdirectories #
|
||||
##################
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
# add_subdirectory(shmem/prototype)
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
add_subdirectory(ofi)
|
||||
endif()
|
||||
add_subdirectory(shmem/prototype)
|
||||
|
||||
|
||||
##########################
|
||||
# libFairMQ header files #
|
||||
##########################
|
||||
set(FAIRMQ_DEPRECATED_HEADER_FILES
|
||||
)
|
||||
set(FAIRMQ_HEADER_FILES
|
||||
${FAIRMQ_DEPRECATED_HEADER_FILES}
|
||||
DeviceRunner.h
|
||||
EventManager.h
|
||||
FairMQChannel.h
|
||||
@@ -120,7 +92,7 @@ set(FAIRMQ_HEADER_FILES
|
||||
zeromq/FairMQTransportFactoryZMQ.h
|
||||
)
|
||||
|
||||
if(NANOMSG_FOUND)
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
set(FAIRMQ_HEADER_FILES ${FAIRMQ_HEADER_FILES}
|
||||
nanomsg/FairMQMessageNN.h
|
||||
nanomsg/FairMQPollerNN.h
|
||||
@@ -183,7 +155,7 @@ set(FAIRMQ_SOURCE_FILES
|
||||
zeromq/FairMQTransportFactoryZMQ.cxx
|
||||
)
|
||||
|
||||
if(NANOMSG_FOUND)
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
set(FAIRMQ_SOURCE_FILES ${FAIRMQ_SOURCE_FILES}
|
||||
nanomsg/FairMQMessageNN.cxx
|
||||
nanomsg/FairMQPollerNN.cxx
|
||||
@@ -213,47 +185,19 @@ configure_file(${CMAKE_SOURCE_DIR}/fairmq/options/startConfigExample.sh.in
|
||||
${CMAKE_BINARY_DIR}/bin/startConfigExample.sh)
|
||||
|
||||
|
||||
########################
|
||||
# compile protobuffers #
|
||||
########################
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
add_custom_target(mkofibuilddir COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ofi)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ofi/Control.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ofi/Control.pb.cc
|
||||
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} -I=${CMAKE_CURRENT_SOURCE_DIR}/ofi --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/ofi Control.proto
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS mkofibuilddir ${CMAKE_CURRENT_SOURCE_DIR}/ofi/Control.proto
|
||||
)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/ofi/Control.pb.h PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/ofi/Control.pb.cc PROPERTIES GENERATED TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
#################################
|
||||
# define libFairMQ build target #
|
||||
#################################
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
add_library(FairMQ SHARED
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ofi/Control.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ofi/Control.pb.cc
|
||||
${FAIRMQ_SOURCE_FILES}
|
||||
${FAIRMQ_HEADER_FILES} # for IDE integration
|
||||
)
|
||||
else()
|
||||
add_library(FairMQ SHARED
|
||||
${FAIRMQ_SOURCE_FILES}
|
||||
${FAIRMQ_HEADER_FILES} # for IDE integration
|
||||
)
|
||||
endif()
|
||||
add_library(FairMQ SHARED
|
||||
${FAIRMQ_SOURCE_FILES}
|
||||
${FAIRMQ_HEADER_FILES} # for IDE integration
|
||||
)
|
||||
|
||||
#######################
|
||||
# include directories #
|
||||
#######################
|
||||
target_include_directories(FairMQ
|
||||
PUBLIC # consumers inherit public include directories
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/logger>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
|
||||
@@ -264,8 +208,11 @@ target_include_directories(FairMQ
|
||||
##################
|
||||
# link libraries #
|
||||
##################
|
||||
if(BUILD_NANOMSG_TRANSPORT)
|
||||
set(NANOMSG_DEPS nanomsg msgpackc)
|
||||
endif()
|
||||
if(BUILD_OFI_TRANSPORT)
|
||||
set(OFI_DEPS OFI::libfabric protobuf::libprotobuf)
|
||||
set(OFI_DEPS OFI::libfabric protobuf::libprotobuf $<TARGET_OBJECTS:OfiTransport>)
|
||||
endif()
|
||||
target_link_libraries(FairMQ
|
||||
INTERFACE # only consumers link against interface dependencies
|
||||
@@ -281,16 +228,18 @@ target_link_libraries(FairMQ
|
||||
Boost::regex
|
||||
Boost::date_time
|
||||
Boost::signals
|
||||
Logger
|
||||
FairLogger::FairLogger
|
||||
$<$<PLATFORM_ID:Linux>:rt>
|
||||
|
||||
PRIVATE # only libFairMQ links against private dependencies
|
||||
ZeroMQ
|
||||
$<$<BOOL:${NANOMSG_FOUND}>:nanomsg>
|
||||
$<$<AND:$<BOOL:${NANOMSG_FOUND}>,$<BOOL:${MSGPACK_FOUND}>>:Msgpack>
|
||||
${NANOMSG_DEPS}
|
||||
${OFI_DEPS}
|
||||
)
|
||||
|
||||
set_target_properties(FairMQ PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
)
|
||||
|
||||
###############
|
||||
# executables #
|
||||
@@ -323,11 +272,11 @@ target_link_libraries(shmmonitor FairMQ)
|
||||
add_executable(uuidGen run/runUuidGenerator.cxx)
|
||||
target_link_libraries(uuidGen FairMQ)
|
||||
|
||||
####################
|
||||
# aggregate target #
|
||||
####################
|
||||
# all targets except tests
|
||||
set(FAIRMQ_FULL_TARGETS
|
||||
###########
|
||||
# install #
|
||||
###########
|
||||
install(
|
||||
TARGETS # FairMQFull, tests are not installed
|
||||
FairMQ
|
||||
bsampler
|
||||
merger
|
||||
@@ -336,68 +285,18 @@ set(FAIRMQ_FULL_TARGETS
|
||||
sink
|
||||
splitter
|
||||
shmmonitor
|
||||
)
|
||||
add_custom_target(FairMQFull DEPENDS ${FAIRMQ_FULL_TARGETS})
|
||||
# all targets including tests, if enabled
|
||||
if(BUILD_TESTING)
|
||||
set(FAIRMQ_TEST_TARGET FairMQTests)
|
||||
endif()
|
||||
add_custom_target(FairMQAll
|
||||
DEPENDS
|
||||
FairMQFull
|
||||
${FAIRMQ_TEST_TARGET}
|
||||
)
|
||||
uuidGen
|
||||
|
||||
|
||||
###########################
|
||||
# generate cotire targets #
|
||||
###########################
|
||||
#cotire(${FAIRMQ_FULL_TARGETS})
|
||||
# disabled by default for now, because it messes up target properties
|
||||
# still useful for development
|
||||
|
||||
|
||||
###########
|
||||
# install #
|
||||
###########
|
||||
install(
|
||||
TARGETS # FairMQFull, tests are not installed
|
||||
${FAIRMQ_FULL_TARGETS}
|
||||
|
||||
EXPORT FairMQ
|
||||
|
||||
LIBRARY
|
||||
DESTINATION lib
|
||||
COMPONENT fairmq
|
||||
|
||||
RUNTIME
|
||||
DESTINATION bin
|
||||
COMPONENT fairmq
|
||||
EXPORT ${PROJECT_EXPORT_SET}
|
||||
LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
# preserve relative path and prepend fairmq
|
||||
foreach(HEADER ${FAIRMQ_HEADER_FILES})
|
||||
get_filename_component(_path ${HEADER} DIRECTORY)
|
||||
file(TO_CMAKE_PATH include/fairmq/${_path} _destination)
|
||||
file(TO_CMAKE_PATH ${PROJECT_INSTALL_INCDIR}/${_path} _destination)
|
||||
install(FILES ${HEADER}
|
||||
DESTINATION ${_destination}
|
||||
COMPONENT fairmq
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# export FairMQ targets
|
||||
install(
|
||||
EXPORT FairMQ
|
||||
DESTINATION include/cmake
|
||||
NAMESPACE FairRoot::
|
||||
EXPORT_LINK_INTERFACE_LIBRARIES
|
||||
COMPONENT fairmq
|
||||
)
|
||||
|
||||
# use the following target to only install the fairmq component
|
||||
add_custom_target(FairMQInstall
|
||||
DEPENDS FairMQFull
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_COMPONENT=fairmq -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
|
||||
)
|
||||
|
||||
|
||||
|
@@ -1,20 +1,14 @@
|
||||
/********************************************************************************
|
||||
* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* Copyright (C) 2017-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* *
|
||||
* This software is distributed under the terms of the *
|
||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
/**
|
||||
* FairMQLogger.h
|
||||
*
|
||||
* @since 2012-12-04
|
||||
* @author D. Klein, A. Rybalchenko
|
||||
*/
|
||||
|
||||
#ifndef FAIRMQLOGGER_H_
|
||||
#define FAIRMQLOGGER_H_
|
||||
|
||||
#include <Logger.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#endif /* FAIRMQLOGGER_H_ */
|
||||
|
@@ -9,9 +9,9 @@
|
||||
#include <FairMQTransportFactory.h>
|
||||
#include <zeromq/FairMQTransportFactoryZMQ.h>
|
||||
#include <shmem/FairMQTransportFactorySHM.h>
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
#include <nanomsg/FairMQTransportFactoryNN.h>
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
#ifdef BUILD_OFI_TRANSPORT
|
||||
#include <fairmq/ofi/TransportFactory.h>
|
||||
#endif
|
||||
@@ -47,12 +47,12 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con
|
||||
{
|
||||
return make_shared<FairMQTransportFactorySHM>(finalId, config);
|
||||
}
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
else if (type == "nanomsg")
|
||||
{
|
||||
return make_shared<FairMQTransportFactoryNN>(finalId, config);
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
#ifdef BUILD_OFI_TRANSPORT
|
||||
else if (type == "ofi")
|
||||
{
|
||||
@@ -64,9 +64,9 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con
|
||||
LOG(error) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: "
|
||||
<< "\"zeromq\""
|
||||
<< "\"shmem\""
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
<< ", \"nanomsg\""
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
#ifdef BUILD_OFI_TRANSPORT
|
||||
<< ", and \"ofi\""
|
||||
#endif /* BUILD_OFI_TRANSPORT */
|
||||
|
@@ -10,11 +10,10 @@
|
||||
|
||||
#define FAIRMQ_VERSION "@PROJECT_VERSION@"
|
||||
#define FAIRMQ_VERSION_DEC (@PROJECT_VERSION_MAJOR@ * 10000) + (@PROJECT_VERSION_MINOR@ * 100) + @PROJECT_VERSION_PATCH@
|
||||
#define FAIRMQ_VERSION_HEX (@PROJECT_VERSION_MAJOR@ << 16) + (@PROJECT_VERSION_MINOR@ << 8) + @PROJECT_VERSION_PATCH@
|
||||
#define FAIRMQ_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define FAIRMQ_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define FAIRMQ_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define FAIRMQ_GIT_VERSION "@FairMQ_GIT_VERSION@"
|
||||
#define FAIRMQ_GIT_DATE "@FairMQ_GIT_DATE@"
|
||||
#define FAIRMQ_GIT_VERSION "@PROJECT_GIT_VERSION@"
|
||||
#define FAIRMQ_GIT_DATE "@PROJECT_GIT_DATE@"
|
||||
|
||||
#endif // FAIR_MQ_VERSION_H
|
||||
|
12
fairmq/ofi/CMakeLists.txt
Normal file
12
fairmq/ofi/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS Control.proto)
|
||||
|
||||
add_library(OfiTransport OBJECT ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
target_include_directories(OfiTransport PRIVATE $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>)
|
@@ -7,24 +7,18 @@
|
||||
################################################################################
|
||||
|
||||
set(plugin FairMQPlugin_dds)
|
||||
|
||||
add_library(${plugin} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/DDS.cxx ${CMAKE_CURRENT_SOURCE_DIR}/DDS.h)
|
||||
target_link_libraries(${plugin} FairMQ ${DDS_INTERCOM_LIBRARY_SHARED} ${DDS_PROTOCOL_LIBRARY_SHARED} ${DDS_USER_DEFAULTS_LIBRARY_SHARED})
|
||||
target_include_directories(${plugin} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PUBLIC ${DDS_INCLUDE_DIR})
|
||||
target_link_libraries(${plugin} FairMQ DDS::dds_intercom_lib DDS::dds_protocol_lib DDS::dds-user-defaults)
|
||||
target_include_directories(${plugin} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${plugin} PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_executable(fairmq-dds-command-ui ${CMAKE_CURRENT_SOURCE_DIR}/runDDSCommandUI.cxx)
|
||||
target_link_libraries(fairmq-dds-command-ui FairMQ ${DDS_INTERCOM_LIBRARY_SHARED} ${DDS_PROTOCOL_LIBRARY_SHARED} ${DDS_USER_DEFAULTS_LIBRARY_SHARED})
|
||||
target_include_directories(fairmq-dds-command-ui PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PUBLIC ${DDS_INCLUDE_DIR})
|
||||
set(exe fairmq-dds-command-ui)
|
||||
add_executable(${exe} ${CMAKE_CURRENT_SOURCE_DIR}/runDDSCommandUI.cxx)
|
||||
target_link_libraries(${exe} FairMQ DDS::dds_intercom_lib DDS::dds_protocol_lib DDS::dds-user-defaults)
|
||||
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
install(TARGETS ${plugin} fairmq-dds-command-ui
|
||||
EXPORT FairMQ
|
||||
|
||||
LIBRARY
|
||||
DESTINATION lib
|
||||
COMPONENT fairmq
|
||||
|
||||
RUNTIME
|
||||
DESTINATION bin
|
||||
COMPONENT fairmq
|
||||
install(TARGETS ${plugin} ${exe}
|
||||
EXPORT ${PROJECT_EXPORT_SET}
|
||||
LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR}
|
||||
)
|
||||
|
@@ -6,7 +6,6 @@
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
find_package(GTest REQUIRED)
|
||||
include(GTestHelper)
|
||||
|
||||
#############################
|
||||
@@ -32,8 +31,8 @@ add_testhelper(runTestDevice
|
||||
)
|
||||
|
||||
|
||||
set(MQ_CONFIG "${CMAKE_BINARY_DIR}/bin/testsuite_FairMQ.IOPatterns_config.json")
|
||||
set(RUN_TEST_DEVICE "${CMAKE_BINARY_DIR}/bin/testhelper_runTestDevice")
|
||||
set(MQ_CONFIG "${CMAKE_BINARY_DIR}/test/testsuite_FairMQ.IOPatterns_config.json")
|
||||
set(RUN_TEST_DEVICE "${CMAKE_BINARY_DIR}/test/testhelper_runTestDevice")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/config.json.in ${MQ_CONFIG})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/runner.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/protocols/runner.cxx)
|
||||
|
||||
@@ -170,11 +169,3 @@ add_testsuite(FairMQ.StateMachine
|
||||
LINKS FairMQ
|
||||
TIMEOUT 10
|
||||
)
|
||||
|
||||
##############################
|
||||
# Aggregate all test targets #
|
||||
##############################
|
||||
add_custom_target(FairMQTests
|
||||
DEPENDS
|
||||
${ALL_TEST_TARGETS}
|
||||
)
|
@@ -63,11 +63,11 @@ TEST(MessageResize, shmem)
|
||||
RunPushPullWithMsgResize("shmem", "ipc://test_message_resize");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(MessageResize, nanomsg)
|
||||
{
|
||||
RunPushPullWithMsgResize("nanomsg", "ipc://test_message_resize");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
} // namespace
|
@@ -44,7 +44,7 @@ TEST(PluginManager, LoadPluginDynamic)
|
||||
auto device = make_shared<FairMQDevice>();
|
||||
mgr.EmplacePluginServices(&config, device);
|
||||
|
||||
mgr.PrependSearchPath("./lib");
|
||||
mgr.PrependSearchPath("./test");
|
||||
|
||||
ASSERT_NO_THROW(mgr.LoadPlugin("test_dummy"));
|
||||
ASSERT_NO_THROW(mgr.LoadPlugin("test_dummy2"));
|
@@ -56,12 +56,12 @@ TEST(Pair, MP_ShMem___tcp____SingleMsg)
|
||||
EXPECT_EXIT(RunPair("shmem"), ::testing::ExitedWithCode(0), "PAIR test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(Pair, MP_Nanomsg_tcp____SingleMsg)
|
||||
{
|
||||
EXPECT_EXIT(RunPair("nanomsg"), ::testing::ExitedWithCode(0), "PAIR test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
#ifdef BUILD_OFI_TRANSPORT
|
||||
TEST(Pair, MP_Ofi_____tcp____SingleMsg)
|
@@ -55,12 +55,12 @@ TEST(Poller, ZeroMQ_subchannel)
|
||||
EXPECT_EXIT(RunPoller("zeromq", 0), ::testing::ExitedWithCode(0), "POLL test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(Poller, Nanomsg_subchannel)
|
||||
{
|
||||
EXPECT_EXIT(RunPoller("nanomsg", 0), ::testing::ExitedWithCode(0), "POLL test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
TEST(Poller, ShMem_subchannel)
|
||||
{
|
||||
@@ -72,12 +72,12 @@ TEST(Poller, ZeroMQ_channel)
|
||||
EXPECT_EXIT(RunPoller("zeromq", 1), ::testing::ExitedWithCode(0), "POLL test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(Poller, Nanomsg_channel)
|
||||
{
|
||||
EXPECT_EXIT(RunPoller("nanomsg", 1), ::testing::ExitedWithCode(0), "POLL test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
TEST(Poller, ShMem_channel)
|
||||
{
|
@@ -60,11 +60,11 @@ TEST(PubSub, ZeroMQ)
|
||||
EXPECT_EXIT(RunPubSub("zeromq"), ::testing::ExitedWithCode(0), "PUB-SUB test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(PubSub, Nanomsg)
|
||||
{
|
||||
EXPECT_EXIT(RunPubSub("nanomsg"), ::testing::ExitedWithCode(0), "PUB-SUB test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
} // namespace
|
@@ -56,11 +56,11 @@ TEST(PushPull, MP_ShMem___tcp____SingleMsg)
|
||||
EXPECT_EXIT(RunPushPull("shmem"), ::testing::ExitedWithCode(0), "PUSH-PULL test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(PushPull, MP_Nanomsg_tcp____SingleMsg)
|
||||
{
|
||||
EXPECT_EXIT(RunPushPull("nanomsg"), ::testing::ExitedWithCode(0), "PUSH-PULL test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
} // namespace
|
@@ -113,12 +113,12 @@ TEST(PushPull, ST_Shmem___inproc_Multipart)
|
||||
RunSingleThreadedMultipart("shmem", "inproc://test");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(PushPull, ST_Nanomsg_inproc_Multipart)
|
||||
{
|
||||
RunSingleThreadedMultipart("nanomsg", "inproc://test");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
TEST(PushPull, ST_ZeroMQ__ipc____Multipart)
|
||||
{
|
||||
@@ -130,12 +130,12 @@ TEST(PushPull, ST_Shmen___ipc____Multipart)
|
||||
RunSingleThreadedMultipart("shmem", "ipc://test_ST_Shmen___ipc____Multipart");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(PushPull, ST_Nanomsg_ipc____Multipart)
|
||||
{
|
||||
RunSingleThreadedMultipart("nanomsg", "ipc://test_ST_Nanomsg_ipc____Multipart");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
TEST(PushPull, MT_ZeroMQ__inproc_Multipart)
|
||||
{
|
||||
@@ -147,12 +147,12 @@ TEST(PushPull, MT_Shmem___inproc_Multipart)
|
||||
RunMultiThreadedMultipart("shmem", "inproc://test");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(PushPull, MT_Nanomsg_inproc_Multipart)
|
||||
{
|
||||
RunMultiThreadedMultipart("nanomsg", "inproc://test");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
TEST(PushPull, MT_ZeroMQ__ipc____Multipart)
|
||||
{
|
||||
@@ -164,11 +164,11 @@ TEST(PushPull, MT_Shmem___ipc____Multipart)
|
||||
RunMultiThreadedMultipart("shmem", "ipc://test_MT_Shmem___ipc____Multipart");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(PushPull, MT_Nanomsg_ipc____Multipart)
|
||||
{
|
||||
RunMultiThreadedMultipart("nanomsg", "ipc://test_MT_Nanomsg_ipc____Multipart");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
} // namespace
|
@@ -65,11 +65,11 @@ TEST(ReqRep, ShMem)
|
||||
EXPECT_EXIT(RunReqRep("shmem"), ::testing::ExitedWithCode(0), "REQ-REP test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(ReqRep, Nanomsg)
|
||||
{
|
||||
EXPECT_EXIT(RunReqRep("nanomsg"), ::testing::ExitedWithCode(0), "REQ-REP test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
} // namespace
|
@@ -41,11 +41,11 @@ TEST(TransferTimeout, ShMem)
|
||||
EXPECT_EXIT(RunTransferTimeout("shmem"), ::testing::ExitedWithCode(0), "Transfer timeout test successfull");
|
||||
}
|
||||
|
||||
#ifdef NANOMSG_FOUND
|
||||
#ifdef BUILD_NANOMSG_TRANSPORT
|
||||
TEST(TransferTimeout, Nanomsg)
|
||||
{
|
||||
EXPECT_EXIT(RunTransferTimeout("nanomsg"), ::testing::ExitedWithCode(0), "Transfer timeout test successfull");
|
||||
}
|
||||
#endif /* NANOMSG_FOUND */
|
||||
#endif /* BUILD_NANOMSG_TRANSPORT */
|
||||
|
||||
} // namespace
|
Reference in New Issue
Block a user