Verified Commit 80b60005 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Refactor targets for metadata_backend

Also:
- Remove FindRocksDB.cmake, FindLZ4.cmake, FindJeMalloc.cmake.
Rationale: RocksDB already installs a RocksDBConfig.cmake that creates
all of these targets when calling find_package(RocksDB).
parent 6dd98c2c
Loading
Loading
Loading
Loading
+24 −19
Original line number Diff line number Diff line

################################################################################
# Copyright 2018-2022, Barcelona Supercomputing Center (BSC), Spain            #
# Copyright 2015-2022, Johannes Gutenberg Universitaet Mainz, Germany          #
@@ -25,29 +26,33 @@
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################
find_path(
  AIO_INCLUDE_DIR
  NAMES aio.h
  PATH_SUFFIXES include
)

# - Find Lz4
# Find the lz4 compression library and includes
#
# LZ4_FOUND - True if lz4 found.
# LZ4_LIBRARIES - List of libraries when using lz4.
# LZ4_INCLUDE_DIR - where to find lz4.h, etc.
find_library(AIO_LIBRARY NAMES rt)

find_path(LZ4_INCLUDE_DIR
    NAMES lz4.h
)
mark_as_advanced(AIO_INCLUDE_DIR AIO_LIBRARY)

find_library(LZ4_LIBRARY
    NAMES lz4
find_package_handle_standard_args(
  AIO
  FOUND_VAR AIO_FOUND
  REQUIRED_VARS AIO_INCLUDE_DIR AIO_LIBRARY
)

set(LZ4_LIBRARIES ${LZ4_LIBRARY} )
set(LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR)
if(AIO_FOUND AND NOT TARGET AIO::AIO)
  add_library(AIO::AIO UNKNOWN IMPORTED)
  if(AIO_INCLUDE_DIR)
    set_target_properties(
      AIO::AIO PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${AIO_INCLUDE_DIR}"
    )
  endif()

mark_as_advanced(
    LZ4_LIBRARY
    LZ4_INCLUDE_DIR
  set_target_properties(
    AIO::AIO PROPERTIES IMPORTED_LOCATION "${AIO_LIBRARY}"
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  )
endif()

CMake/FindJeMalloc.cmake

deleted100644 → 0
+0 −70
Original line number Diff line number Diff line
################################################################################
# Copyright 2018-2022, Barcelona Supercomputing Center (BSC), Spain            #
# Copyright 2015-2022, Johannes Gutenberg Universitaet Mainz, Germany          #
#                                                                              #
# This software was partially supported by the                                 #
# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).    #
#                                                                              #
# This software was partially supported by the                                 #
# ADA-FS project under the SPPEXA project funded by the DFG.                   #
#                                                                              #
# This file is part of GekkoFS.                                                #
#                                                                              #
# GekkoFS is free software: you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by         #
# the Free Software Foundation, either version 3 of the License, or            #
# (at your option) any later version.                                          #
#                                                                              #
# GekkoFS is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
# GNU General Public License for more details.                                 #
#                                                                              #
# You should have received a copy of the GNU General Public License            #
# along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.            #
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

# - Try to find jemalloc headers and libraries.
#
# Usage of this module as follows:
#
#     find_package(JeMalloc)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
#  JEMALLOC_ROOT_DIR Set this variable to the root installation of
#                    jemalloc if the module has problems finding
#                    the proper installation path.
#
# Variables defined by this module:
#
#  JEMALLOC_FOUND             System has jemalloc libs/headers
#  JEMALLOC_LIBRARIES         The jemalloc library/libraries
#  JEMALLOC_INCLUDE_DIR       The location of jemalloc headers

find_library(JEMALLOC_LIBRARY
    NAMES jemalloc
    HINTS ${JEMALLOC_ROOT_DIR}/lib
    )

find_path(JEMALLOC_INCLUDE_DIR
    NAMES jemalloc/jemalloc.h
    HINTS ${JEMALLOC_ROOT_DIR}/include
    )

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
    JEMALLOC_LIBRARY
    JEMALLOC_INCLUDE_DIR
    )

mark_as_advanced(
    JEMALLOC_LIBRARY
    JEMALLOC_INCLUDE_DIR
)

set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
 No newline at end of file
+50 −18
Original line number Diff line number Diff line
@@ -25,27 +25,59 @@
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################
find_path(PARALLAX_INCLUDE_DIR

list(APPEND _parallax_components "log")

find_path(
  PARALLAX_INCLUDE_DIR
  NAMES parallax.h
  PATH_SUFFIXES include
)

find_library(PARALLAX_LIBRARY
        NAMES parallax
find_library(PARALLAX_LIBRARY NAMES parallax)

find_library(PARALLAX_LOG_LIBRARY NAMES log)

mark_as_advanced(PARALLAX_LIBRARY PARALLAX_INCLUDE_DIR PARALLAX_LOG_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  Parallax
  FOUND_VAR Parallax_FOUND
  REQUIRED_VARS PARALLAX_LIBRARY PARALLAX_LOG_LIBRARY PARALLAX_INCLUDE_DIR
)

find_library(PARALLAX_LOG_LIBRARY
	NAMES log
if(Parallax_FOUND)
  set(Parallax_INCLUDE_DIRS ${PARALLAX_INCLUDE_DIR})
  set(Parallax_LIBRARIES ${PARALLAX_LIBRARY} ${PARALLAX_LOG_LIBRARY})

  if(NOT TARGET Parallax::parallax)
    add_library(Parallax::parallax UNKNOWN IMPORTED)
  endif()

  set_target_properties(
    Parallax::parallax
    PROPERTIES IMPORTED_LOCATION "${PARALLAX_LIBRARY}"
               INTERFACE_INCLUDE_DIRECTORIES "${PARALLAX_INCLUDE_DIR}"
               IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
  )

set(PARALLAX_INCLUDE_DIRS ${PARALLAX_INCLUDE_DIR})
set(PARALLAX_LIBRARIES ${PARALLAX_LIBRARY})
set(PARALLAX_LIBRARIES ${PARALLAX_LOG_LIBRARY})
  foreach(_component ${_parallax_components})
    if(NOT TARGET Parallax::${_component})
      add_library(Parallax::${_component} UNKNOWN IMPORTED)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Parallax DEFAULT_MSG PARALLAX_LIBRARY PARALLAX_LOG_LIBRARY PARALLAX_INCLUDE_DIR)
      if(Parallax_INCLUDE_DIRS)
        set_target_properties(
          Parallax::${_component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                             "${PARALLAX_INCLUDE_DIR}"
        )

mark_as_advanced(
        PARALLAX_LIBRARY
	PARALLAX_INCLUDE_DIR
	PARALLAX_LOG_LIBRARY
        set_target_properties(
          Parallax::${_component}
          PROPERTIES IMPORTED_LOCATION "${PARALLAX_LOG_LIBRARY}"
                     IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
        )
      endif()
    endif()
  endforeach()
endif()

CMake/FindRocksDB.cmake

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
################################################################################
# Copyright 2018-2022, Barcelona Supercomputing Center (BSC), Spain            #
# Copyright 2015-2022, Johannes Gutenberg Universitaet Mainz, Germany          #
#                                                                              #
# This software was partially supported by the                                 #
# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).    #
#                                                                              #
# This software was partially supported by the                                 #
# ADA-FS project under the SPPEXA project funded by the DFG.                   #
#                                                                              #
# This file is part of GekkoFS.                                                #
#                                                                              #
# GekkoFS is free software: you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by         #
# the Free Software Foundation, either version 3 of the License, or            #
# (at your option) any later version.                                          #
#                                                                              #
# GekkoFS is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
# GNU General Public License for more details.                                 #
#                                                                              #
# You should have received a copy of the GNU General Public License            #
# along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.            #
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

# Try to find RocksDB headers and library.
#
# Usage of this module as follows:
#
#     find_package(RocksDB)
#
# Variables defined by this module:
#
#  ROCKSDB_FOUND               System has RocksDB library/headers.
#  ROCKSDB_LIBRARIES           The RocksDB library.
#  ROCKSDB_INCLUDE_DIRS        The location of RocksDB headers.

find_library(ROCKSDB_LIBRARY
    NAMES rocksdb
)

find_path(ROCKSDB_INCLUDE_DIR
    NAMES rocksdb/db.h
)

set(ROCKSDB_LIBRARIES ${ROCKSDB_LIBRARY})
set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RocksDB DEFAULT_MSG
    ROCKSDB_LIBRARY
    ROCKSDB_INCLUDE_DIR
)

mark_as_advanced(
    ROCKSDB_LIBRARY
    ROCKSDB_INCLUDE_DIR
)
 No newline at end of file
+17 −10
Original line number Diff line number Diff line
@@ -156,6 +156,22 @@ if (GKFS_ENABLE_AGIOS)
    find_package(AGIOS REQUIRED)
endif()

### Metadata backends
if(GKFS_ENABLE_ROCKSDB)
    add_compile_definitions(GKFS_ENABLE_ROCKSDB)
    find_package(RocksDB 6.26.1 REQUIRED)
endif()

if(GKFS_ENABLE_PARALLAX)
    add_compile_definitions(GKFS_ENABLE_PARALLAX)
    # The current version of Parallax has a direct dependency on libyaml and librt.
    # Make sure that we find them and add them as link dependencies..
    find_package(yaml REQUIRED)
    find_package(AIO REQUIRED)
    find_package(Parallax REQUIRED)
    target_link_libraries(Parallax::parallax INTERFACE yaml AIO::AIO)
endif()

### Prometheus-cpp: required for the collection of GekkoFS stats
### (these expose the prometheus-cpp::pull, prometheus-cpp::push,
### prometheus-cpp::core, and curl imported targets
@@ -282,15 +298,6 @@ message(STATUS "[gekkofs] Prometheus Output: ${GKFS_ENABLE_PROMETHEUS}")

configure_file(include/common/cmake_configure.hpp.in include/common/cmake_configure.hpp)



# add_library(CLI11 INTERFACE)
# # we cannot use target_include_directories with CMake < 3.11
# set_target_properties(CLI11
#     PROPERTIES
#     INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/external"
#     )

if (ENABLE_CLIENT_LOG)
    option(HERMES_LOGGING "" ON)
    option(HERMES_LOGGING_FMT_USE_BUNDLED "" OFF)
Loading