diff --git a/CMakeLists.txt b/CMakeLists.txt index 28579be9..d448ee32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,14 +59,36 @@ endif() if(BUILD_NANOMSG_TRANSPORT) find_package2(PRIVATE nanomsg REQUIRED) set(PROJECT_nanomsg_VERSION 1.1.3) # Once upstream releases 1.1.5, we should bump again and use version check - find_package2(PRIVATE msgpack VERSION 3.1.0 REQUIRED) endif() if(BUILD_OFI_TRANSPORT) - find_package2(PRIVATE OFI VERSION 1.6.0 REQUIRED COMPONENTS fi_sockets fi_verbs) - find_package2(PRIVATE Protobuf VERSION 3.4.0 REQUIRED) + find_package2(PRIVATE asiofi VERSION 0.0.0 REQUIRED) + find_package2(PRIVATE OFI VERSION ${asiofi_OFI_VERSION} COMPONENTS ${asiofi_OFI_COMPONENTS} REQUIRED) endif() +if(BUILD_NANOMSG_TRANSPORT OR BUILD_OFI_TRANSPORT) + find_package2(PRIVATE msgpack VERSION 3.1.0 REQUIRED) +endif() + +if(BUILD_FAIRMQ) + set(_components container program_options thread system filesystem regex date_time signals) + if(asiofi_FOUND) + if(${asiofi_Boost_VERSION} VERSION_GREATER 1.64) + set(_version ${asiofi_Boost_VERSION}) + endif() + list(APPEND _components ${asiofi_Boost_COMPONENTS}) + list(REMOVE_DUPLICATES _components) + else() + set(_version 1.64) + endif() + find_package2(PUBLIC Boost VERSION ${_version} REQUIRED + COMPONENTS ${_components} + ) + find_package2(PUBLIC FairLogger VERSION 1.2.0 REQUIRED) + find_package2(PRIVATE ZeroMQ VERSION 4.1.5 REQUIRED) +endif() + + if(BUILD_DDS_PLUGIN) find_package2(PRIVATE DDS VERSION 2.2 REQUIRED) endif() @@ -226,6 +248,8 @@ if(PROJECT_PACKAGE_DEPENDENCIES) elseif(${dep} STREQUAL msgpack) get_target_property(msgpack_include msgpackc-cxx INTERFACE_INCLUDE_DIRECTORIES) get_filename_component(prefix ${msgpack_include}/.. ABSOLUTE) + elseif(${dep} STREQUAL asiofi) + set(prefix ${asiofi_ROOT}) elseif(${dep} STREQUAL OFI) get_filename_component(prefix ${${dep}_INCLUDE_DIRS}/.. ABSOLUTE) elseif(${dep} STREQUAL nanomsg) diff --git a/README.md b/README.md index b7bde7ad..3bda5d4c 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,7 @@ a simulation, reconstruction and analysis framework. * PUBLIC: [**Boost**](https://www.boost.org/), [**FairLogger**](https://github.com/FairRootGroup/FairLogger) * BUILD: [CMake](https://cmake.org/), [GTest](https://github.com/google/googletest), [Doxygen](http://www.doxygen.org/) * PRIVATE: [ZeroMQ](http://zeromq.org/), [Msgpack](https://msgpack.org/index.html), [nanomsg](http://nanomsg.org/), -[OFI](https://ofiwg.github.io/libfabric/), [Protobuf](https://developers.google.com/protocol-buffers/), [DDS](http://dds.gsi.de), -[PMIx](https://pmix.org/) +[asiofi](https://github.com/FairRootGroup/asiofi), [DDS](http://dds.gsi.de), [PMIx](https://pmix.org/) Supported platforms: Linux and MacOS. diff --git a/cmake/FairMQLib.cmake b/cmake/FairMQLib.cmake index 3446cbe2..c4f15fc0 100644 --- a/cmake/FairMQLib.cmake +++ b/cmake/FairMQLib.cmake @@ -261,6 +261,8 @@ endfunction() # Configure/Install CMake package macro(install_cmake_package) + list(SORT PROJECT_PACKAGE_DEPENDENCIES) + list(SORT PROJECT_INTERFACE_PACKAGE_DEPENDENCIES) include(CMakePackageConfigHelpers) set(PACKAGE_INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_GIT_VERSION} diff --git a/cmake/FindOFI.cmake b/cmake/FindOFI.cmake deleted file mode 100644 index 3f0b9074..00000000 --- a/cmake/FindOFI.cmake +++ /dev/null @@ -1,89 +0,0 @@ -################################################################################ -# 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" # -################################################################################ - -# According to the docs the modification of the PKG_CONFIG_PATH environment should -# not be necessary, but it does not work otherwise. -if(OFI_ROOT) - list(APPEND CMAKE_PREFIX_PATH "${OFI_ROOT}/lib/pkgconfig") - set(ENV{PKG_CONFIG_PATH} "${OFI_ROOT}/lib/pkgconfig:" $ENV{PKG_CONFIG_PATH}) -endif() - -if(ENV{OFI_ROOT}) - list(APPEND CMAKE_PREFIX_PATH "$ENV{OFI_ROOT}/lib/pkgconfig") - set(ENV{PKG_CONFIG_PATH} "$ENV{OFI_ROOT}/lib/pkgconfig:" $ENV{PKG_CONFIG_PATH}) -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 QUIET) - -if(PKG_CONFIG_FOUND) - # Find include dir and dependencies from pkgconfig - pkg_check_modules(_OFI libfabric QUIET) - - # Retrieve version from pkgconfig - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} libfabric --modversion - OUTPUT_VARIABLE OFI_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - # The IMPORTED_TARGET option of the pkg_check_modules() function is useless, - # so let's build it ourselves - find_library(OFI_LIBFABRIC - NAMES libfabric.so libfabric.dylib - HINTS ${OFI_ROOT} $ENV{OFI_ROOT} - PATH_SUFFIXES lib - ) - - # Just take the include dirs found by the PkgConfig module - set(OFI_INCLUDE_DIRS ${_OFI_INCLUDE_DIRS}) - - # Find fi_info command to be able to check required features of the OFI installation - find_program(OFI_INFO_EXECUTABLE - NAMES fi_info - HINTS ${OFI_ROOT} $ENV{OFI_ROOT} - PATH_SUFFIXES bin - ) - - # Detect ofi providers, they can be required via the COMPONENTS argument of find_package - if(OFI_INFO_EXECUTABLE) - execute_process( - COMMAND ${OFI_INFO_EXECUTABLE} -l - OUTPUT_VARIABLE output - ) - string(REPLACE "\n" ";" lines ${output}) - foreach(line IN LISTS lines) - string(REGEX - MATCH "^([a-zA-Z0-9_]+):" - found "${line}" - ) - if(found) - string(TOLOWER "${CMAKE_MATCH_1}" provider) - set(OFI_fi_${provider}_FOUND TRUE) - endif() - endforeach() - endif() - - # Check search result, check version constraints and print status - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(OFI - REQUIRED_VARS OFI_LIBFABRIC OFI_INCLUDE_DIRS OFI_INFO_EXECUTABLE - VERSION_VAR OFI_VERSION - HANDLE_COMPONENTS - ) -endif() - -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 - IMPORTED_LOCATION ${OFI_LIBFABRIC} - INTERFACE_INCLUDE_DIRECTORIES ${OFI_INCLUDE_DIRS} - ) -endif() diff --git a/fairmq/CMakeLists.txt b/fairmq/CMakeLists.txt index e3edf08d..f8aac600 100644 --- a/fairmq/CMakeLists.txt +++ b/fairmq/CMakeLists.txt @@ -227,7 +227,7 @@ if(BUILD_NANOMSG_TRANSPORT) set(NANOMSG_DEPS nanomsg msgpackc-cxx) endif() if(BUILD_OFI_TRANSPORT) - set(OFI_DEPS OFI::libfabric protobuf::libprotobuf $) + set(OFI_DEPS asiofi::asiofi msgpackc) endif() set(optional_deps ${NANOMSG_DEPS} ${OFI_DEPS}) if(optional_deps)