Skip to content

Commit

Permalink
Merge pull request #530 from lukemartinlogan/master
Browse files Browse the repository at this point in the history
Fix cmakes
  • Loading branch information
lukemartinlogan authored Jun 5, 2023
2 parents 25fed35 + 7348ce7 commit 7cd0fe7
Show file tree
Hide file tree
Showing 33 changed files with 277 additions and 203 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ jobs:
run: ci/build_hermes.sh
#
# - name: Test
# run: cd build && ctest -VV -R test_hermes_posix_basic_small
# run: bash ci/test_hermes.sh
#
- name: Install
run: pushd build && make install && popd

# Enable tmate debugging of manually-triggered workflows if the input option was provided
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
Expand All @@ -90,18 +87,10 @@ jobs:
# run: pushd ci/cluster && ./multi_node_ci_test.sh

# - name: Generate coverage file
# run: |
# COVERAGE_DIR=${GITHUB_WORKSPACE}/coverage
# mkdir -p ${COVERAGE_DIR}
# pushd ${GITHUB_WORKSPACE}/build
# lcov -c -d . -o "${COVERAGE_DIR}/tmp.info"
# lcov --remove "${COVERAGE_DIR}/tmp.info" \
# "/usr/include/*" \
# "${HOME}/${LOCAL}/*" \
# "*/stb_ds.h" \
# -o ${COVERAGE_DIR}/lcov.info
# run: bash ci/coverage.sh

# - name: Coveralls
# uses: coverallsapp/github-action@master
# with:
# path-to-lcov: coverage/lcov.info
# github-token: ${{ secrets.GITHUB_TOKEN }}
96 changes: 96 additions & 0 deletions CMake/HermesConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Find hermes header and library.
#

# This module defines the following uncached variables:
# Hermes_FOUND, if false, do not try to use hermes.
# Hermes_INCLUDE_DIRS, where to find hermes.h.
# Hermes_LIBRARIES, the libraries to link against to use the hermes library
# Hermes_LIBRARY_DIRS, the directory where the hermes library is found.

#-----------------------------------------------------------------------------
# Version Strings
#-----------------------------------------------------------------------------
set(HERMES_VERSION_STRING @HERMES_PACKAGE_VERSION@)
set(HERMES_VERSION_MAJOR @HERMES_VERSION_MAJOR@)
set(HERMES_VERSION_MINOR @HERMES_VERSION_MINOR@)
set(HERMES_VERSION_PATCH @HERMES_VERSION_PATCH@)

#-----------------------------------------------------------------------------
# C++ Version
#-----------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)

#-----------------------------------------------------------------------------
# Find hermes.h
#-----------------------------------------------------------------------------
find_path(Hermes_INCLUDE_DIR hermes.h)
if (NOT Hermes_INCLUDE_DIR)
set(Hermes_FOUND OFF)
message(SEND_ERROR "FindHermes: Could not find hermes.h")
else()
#-----------------------------------------------------------------------------
# Find hermes install dir and hermes.so
#-----------------------------------------------------------------------------
get_filename_component(Hermes_DIR ${Hermes_INCLUDE_DIR} PATH)
find_library(
Hermes_LIBRARY
NAMES hermes
)

#-----------------------------------------------------------------------------
# Mark hermes as found
#-----------------------------------------------------------------------------
if( Hermes_LIBRARY )
set(Hermes_LIBRARY_DIR "")
get_filename_component(Hermes_LIBRARY_DIRS ${Hermes_LIBRARY} PATH)
# Set uncached variables as per standard.
set(Hermes_FOUND ON)
set(Hermes_INCLUDE_DIRS ${Hermes_INCLUDE_DIR})
set(Hermes_LIBRARIES ${Hermes_LIBRARY})
endif(Hermes_LIBRARY)

#-----------------------------------------------------------------------------
# Find all packages needed by hermes
#-----------------------------------------------------------------------------
# thallium
if(@HERMES_RPC_THALLIUM@)
find_package(thallium CONFIG REQUIRED)
if(thallium_FOUND)
message(STATUS "found thallium at ${thallium_DIR}")
endif()
endif()

#YAML-CPP
find_package(yaml-cpp REQUIRED)
if(yaml-cpp_FOUND)
message(STATUS "found yaml-cpp at ${yaml-cpp_DIR}")
endif()

#Cereal
find_package(cereal REQUIRED)
if(cereal)
message(STATUS "found cereal")
endif()

#if(HERMES_COMMUNICATION_MPI)
find_package(MPI REQUIRED COMPONENTS C CXX)
message(STATUS "found mpi.h at ${MPI_CXX_INCLUDE_DIRS}")
#endif()

# librt
if(NOT APPLE)
find_library(LIBRT rt)
if(NOT LIBRT)
message(FATAL_ERROR "librt is required for POSIX shared memory")
endif()
endif()

#-----------------------------------------------------------------------------
# Set all packages needed by hermes
#-----------------------------------------------------------------------------

# Set the Hermes library dependencies
set(Hermes_LIBRARIES yaml-cpp thallium
MPI::MPI_CXX stdc++fs dl cereal::cereal
hermes_shm_data_structures hermes)
endif()
13 changes: 0 additions & 13 deletions CMake/hermes-config-version.cmake.in

This file was deleted.

28 changes: 0 additions & 28 deletions CMake/hermes-config.cmake.build.in

This file was deleted.

28 changes: 0 additions & 28 deletions CMake/hermes-config.cmake.install.in

This file was deleted.

69 changes: 10 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ endif()
# Build options
#------------------------------------------------------------------------------
option(BUILD_SHARED_LIBS "Build with shared libraries." ON)
option(HERMES_INTERCEPT_IO "Use GOTCHA as IO interception tool" OFF)
option(HERMES_COMMUNICATION_MPI "Use MPI as the communication layer." ON)
option(HERMES_ENABLE_DOXYGEN "Enable hermes documentation." OFF)
option(HERMES_BUILD_BUFFER_POOL_VISUALIZER "Build the BufferPool visualizer" OFF)
Expand Down Expand Up @@ -214,8 +213,7 @@ if(BUILD_SHARED_LIBS)
set(HERMES_BUILD_SHARED_LIBS 1)
set(HERMES_LIBTYPE SHARED)
else()
set(HERMES_BUILD_SHARED_LIBS 0)
set(HERMES_LIBTYPE STATIC)
message(FATAL_ERROR "Must build hermes with shared libs")
endif()

# TODO(chogan): Expose this once we have more than one communication layer
Expand Down Expand Up @@ -329,22 +327,6 @@ if(cereal)
message(STATUS "found cereal")
endif()

# GOTCHA
if(HERMES_INTERCEPT_IO)
find_package(gotcha REQUIRED)
if(gotcha_FOUND)
set(HERMES_HAVE_GOTCHA 1)
include_directories(${gotcha_INCLUDE_DIRS})
set(HERMES_EXT_INCLUDE_DEPENDENCIES ${gotcha_INCLUDE_DIRS}
${HERMES_EXT_INCLUDE_DEPENDENCIES}
)
set(HERMES_EXT_LIB_DEPENDENCIES gotcha ${HERMES_EXT_LIB_DEPENDENCIES})
option(HERMES_BUILD_POSIX_IO "Build POSIX I/O Module" ON)
option(HERMES_BUILD_MPI_IO "Build MPI I/O Module" ON)
option(HERMES_BUILD_STDIO "Build standard I/O Module" ON)
endif()
endif()

#if(HERMES_COMMUNICATION_MPI)
find_package(MPI REQUIRED COMPONENTS C CXX)
message(STATUS "found mpi.h at ${MPI_CXX_INCLUDE_DIRS}")
Expand All @@ -358,14 +340,6 @@ if(NOT APPLE)
endif()
endif()

# sdl2
if(HERMES_BUILD_BUFFER_POOL_VISUALIZER)
find_package(SDL2 CONFIG REQUIRED)
if(SDL2_FOUND)
message(STATUS "found SDL2 at ${SDL2_DIR}")
endif()
endif()

# HDF5
if(HERMES_ENABLE_VFD)
set(HERMES_REQUIRED_HDF5_VERSION 1.14.0)
Expand Down Expand Up @@ -501,29 +475,6 @@ if(HERMES_BUILD_BENCHMARKS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmarks)
endif()

#-----------------------------------------------------------------------------
# Configure the config.cmake file for the build directory
#-----------------------------------------------------------------------------
configure_file(
${HERMES_SOURCE_DIR}/CMake/hermes-config.cmake.build.in
${HERMES_BINARY_DIR}/hermes-config.cmake @ONLY
)

#-----------------------------------------------------------------------------
# Configure the config.cmake file for the install directory
#-----------------------------------------------------------------------------
configure_file(
${HERMES_SOURCE_DIR}/CMake/hermes-config.cmake.install.in
${HERMES_BINARY_DIR}/CMakeFiles/hermes-config.cmake @ONLY
)

install(
FILES
${HERMES_BINARY_DIR}/CMakeFiles/hermes-config.cmake
DESTINATION
${HERMES_INSTALL_DATA_DIR}/cmake/hermes
)

install(
FILES
test/data/hermes_server.yaml
Expand All @@ -533,21 +484,21 @@ install(
hermes_sample.yaml
)

add_custom_target(lint
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/ci/lint.sh ${CMAKE_CURRENT_SOURCE_DIR}
)

#-----------------------------------------------------------------------------
# Configure the hermes-config-version .cmake file for the install directory
# Install HermesConfig.cmake
#-----------------------------------------------------------------------------
configure_file(
${HERMES_SOURCE_DIR}/CMake/hermes-config-version.cmake.in
${HERMES_BINARY_DIR}/CMakeFiles/hermes-config-version.cmake @ONLY
${HERMES_SOURCE_DIR}/CMake/HermesConfig.cmake
${HERMES_BINARY_DIR}/CMakeFiles/HermesConfig.cmake @ONLY
)

install(
FILES
${HERMES_BINARY_DIR}/CMakeFiles/hermes-config-version.cmake
${HERMES_BINARY_DIR}/CMakeFiles/HermesConfig.cmake
DESTINATION
${HERMES_INSTALL_DATA_DIR}/cmake/hermes
)

add_custom_target(lint
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/ci/lint.sh ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_INSTALL_PREFIX}/cmake
)
19 changes: 18 additions & 1 deletion adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,21 @@ if(HERMES_ENABLE_KVSTORE)
endif()
if(HERMES_BUILD_ADAPTER_TESTS)
add_subdirectory(test)
endif()
endif()

#-----------------------------------------------------------------------------
# Specify project header files to be installed
#-----------------------------------------------------------------------------
file(GLOB_RECURSE HERMES_HEADERS "*.h")

#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
install(
FILES
${HERMES_HEADERS}
DESTINATION
${HERMES_INSTALL_INCLUDE_DIR}/adapter
COMPONENT
headers
)
2 changes: 1 addition & 1 deletion adapter/mpiio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR})

# Create the MPIIO I/O client
add_library(hermes_mpiio_io_client mpiio_io_client.cc)
add_library(hermes_mpiio_io_client SHARED mpiio_io_client.cc)
add_dependencies(hermes_mpiio_io_client
hermes hermes_fs_base)
target_link_libraries(hermes_mpiio_io_client
Expand Down
2 changes: 1 addition & 1 deletion adapter/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR})

# Creates the POSIX I/O client
add_library(hermes_posix_io_client posix_io_client.cc)
add_library(hermes_posix_io_client SHARED posix_io_client.cc)
add_dependencies(hermes_posix_io_client
hermes hermes_fs_base)
target_link_libraries(hermes_posix_io_client
Expand Down
2 changes: 1 addition & 1 deletion adapter/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR})

# Creates the STDIO I/O client
add_library(hermes_stdio_io_client stdio_io_client.cc)
add_library(hermes_stdio_io_client SHARED stdio_io_client.cc)
add_dependencies(hermes_stdio_io_client
hermes hermes_fs_base)
target_link_libraries(hermes_stdio_io_client
Expand Down
2 changes: 1 addition & 1 deletion adapter/vfd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(HDF5_HERMES_VFD_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/H5FDhermes.h
${CMAKE_CURRENT_SOURCE_DIR}/H5FDhermes.cc)

add_library(hdf5_hermes_vfd ${HDF5_HERMES_VFD_SRCS})
add_library(hdf5_hermes_vfd SHARED ${HDF5_HERMES_VFD_SRCS})
target_include_directories(hdf5_hermes_vfd
SYSTEM PUBLIC ${HDF5_HERMES_VFD_EXT_INCLUDE_DEPENDENCIES}
)
Expand Down
1 change: 1 addition & 0 deletions ci/build_hermes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ cmake \
-DHERMES_DEBUG_LOCK=OFF \
..
make -j8
make install

popd
10 changes: 10 additions & 0 deletions ci/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
COVERAGE_DIR="${GITHUB_WORKSPACE}/coverage"
mkdir -p "${COVERAGE_DIR}"
cd "${GITHUB_WORKSPACE}/build"
lcov -c -d . -o "${COVERAGE_DIR}/tmp.info"
lcov --remove "${COVERAGE_DIR}/tmp.info" \
"/usr/*" \
"*/spack/*" \
-o "${COVERAGE_DIR}/lcov.info"
genhtml "${COVERAGE_DIR}/lcov.info" --output-directory coverage_report
Loading

0 comments on commit 7cd0fe7

Please sign in to comment.