Skip to content

Commit

Permalink
Merge pull request #601 from lukemartinlogan/hermes-1.1
Browse files Browse the repository at this point in the history
Made it HermesConfig.cmake and change LABSTOR -> HERMES in CMake
  • Loading branch information
lukemartinlogan authored Sep 29, 2023
2 parents 76a4bb3 + e5ce5f4 commit 32f84a6
Show file tree
Hide file tree
Showing 30 changed files with 371 additions and 370 deletions.
65 changes: 33 additions & 32 deletions CMake/LabstorConfig.cmake → CMake/HermesConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Find labstor header and library.
# Find Hermes header and library.
#

# This module defines the following uncached variables:
# Labstor_FOUND, if false, do not try to use labstor.
# Labstor_INCLUDE_DIRS, where to find labstor.h.
# Labstor_LIBRARIES, the libraries to link against to use the labstor library
# Labstor_LIBRARY_DIRS, the directory where the labstor library is found.
# 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.

find_path(
Labstor_INCLUDE_DIR
labstor/labstor_types.h
Hermes_INCLUDE_DIR
Hermes/Hermes_types.h
)

if( Labstor_INCLUDE_DIR )
get_filename_component(Labstor_DIR ${Labstor_INCLUDE_DIR} PATH)
if( Hermes_INCLUDE_DIR )
get_filename_component(Hermes_DIR ${Hermes_INCLUDE_DIR} PATH)

#-----------------------------------------------------------------------------
# Find all packages needed by labstor
# Find all packages needed by Hermes
#-----------------------------------------------------------------------------
find_library(
Labstor_LIBRARY
NAMES labstor_client labstor_runtime
Hermes_LIBRARY
NAMES Hermes_client Hermes_runtime
)

# HermesShm
Expand Down Expand Up @@ -56,29 +56,30 @@ if( Labstor_INCLUDE_DIR )
#-----------------------------------------------------------------------------
# Mark hermes as found and set all needed packages
#-----------------------------------------------------------------------------
if( Labstor_LIBRARY )
set(Labstor_LIBRARY_DIR "")
get_filename_component(Labstor_LIBRARY_DIRS ${Labstor_LIBRARY} PATH)
if( Hermes_LIBRARY )
set(Hermes_LIBRARY_DIR "")
get_filename_component(Hermes_LIBRARY_DIRS ${Hermes_LIBRARY} PATH)
# Set uncached variables as per standard.
set(Labstor_FOUND ON)
set(Labstor_INCLUDE_DIRS ${Labstor_INCLUDE_DIR})
set(Labstor_LIBRARIES
set(Hermes_FOUND ON)
set(Hermes_INCLUDE_DIRS ${Hermes_INCLUDE_DIR})
set(Hermes_LIBRARIES
${HermesShm_LIBRARIES}
yaml-cpp
cereal::cereal
-ldl -lrt -lc -pthread ${Labstor_LIBRARY})
endif(Labstor_LIBRARY)
-ldl -lrt -lc -pthread ${Hermes_LIBRARY})
set(Hermes_CLIENT_LIBRARIES ${Hermes_LIBRARIES})
endif(Hermes_LIBRARY)

else(Labstor_INCLUDE_DIR)
message(STATUS "FindLabstor: Could not find labstor.h")
endif(Labstor_INCLUDE_DIR)
else(Hermes_INCLUDE_DIR)
message(STATUS "FindHermes: Could not find Hermes.h")
endif(Hermes_INCLUDE_DIR)

if(Labstor_FOUND)
if(NOT Labstor_FIND_QUIETLY)
message(STATUS "FindLabstor: Found both labstor.h and liblabstor_client.so")
endif(NOT Labstor_FIND_QUIETLY)
else(Labstor_FOUND)
if(Labstor_FIND_REQUIRED)
message(STATUS "FindLabstor: Could not find labstor.h and/or liblabstor_client.so")
endif(Labstor_FIND_REQUIRED)
endif(Labstor_FOUND)
if(Hermes_FOUND)
if(NOT Hermes_FIND_QUIETLY)
message(STATUS "FindHermes: Found both Hermes.h and libHermes_client.so")
endif(NOT Hermes_FIND_QUIETLY)
else(Hermes_FOUND)
if(Hermes_FIND_REQUIRED)
message(STATUS "FindHermes: Could not find Hermes.h and/or libHermes_client.so")
endif(Hermes_FIND_REQUIRED)
endif(Hermes_FOUND)
42 changes: 21 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ project(hermes)
option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON)
option(BUILD_MPI_TESTS "Build tests which depend on MPI" ON)
option(BUILD_OpenMP_TESTS "Build tests which depend on OpenMP" ON)
option(LABSTOR_ENABLE_COVERAGE "Check how well tests cover code" OFF)
option(LABSTOR_ENABLE_DOXYGEN "Check how well the code is documented" OFF)
option(HERMES_ENABLE_COVERAGE "Check how well tests cover code" OFF)
option(HERMES_ENABLE_DOXYGEN "Check how well the code is documented" OFF)

option(HERMES_ENABLE_POSIX_ADAPTER "Build the Hermes POSIX adapter." ON)
option(HERMES_ENABLE_STDIO_ADAPTER "Build the Hermes stdio adapter." ON)
Expand Down Expand Up @@ -38,8 +38,8 @@ add_compile_options(-march=native -fomit-frame-pointer)
# Targets built within this project are exported at Install time for use
# by other projects.
#-----------------------------------------------------------------------------
if(NOT LABSTOR_EXPORTED_TARGETS)
set(LABSTOR_EXPORTED_TARGETS "labstor-targets")
if(NOT HERMES_EXPORTED_TARGETS)
set(HERMES_EXPORTED_TARGETS "labstor-targets")
endif()

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -115,21 +115,21 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
#------------------------------------------------------------------------------
# Setup install and output Directories
#------------------------------------------------------------------------------
if(NOT LABSTOR_INSTALL_BIN_DIR)
set(LABSTOR_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
if(NOT HERMES_INSTALL_BIN_DIR)
set(HERMES_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
endif()
if(NOT LABSTOR_INSTALL_LIB_DIR)
set(LABSTOR_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
if(NOT HERMES_INSTALL_LIB_DIR)
set(HERMES_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
if(NOT LABSTOR_INSTALL_INCLUDE_DIR)
set(LABSTOR_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
if(NOT HERMES_INSTALL_INCLUDE_DIR)
set(HERMES_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
endif()
if(NOT LABSTOR_INSTALL_DATA_DIR)
set(LABSTOR_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share)
if(NOT HERMES_INSTALL_DATA_DIR)
set(HERMES_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share)
endif()

#-----------------------------------------------------------------------------
# Build Labstor Main Packages
# Build Hermes Main Packages
#-----------------------------------------------------------------------------
# Main includes
include_directories(${HermesShm_INCLUDE_DIRS})
Expand Down Expand Up @@ -157,18 +157,18 @@ include_directories(${CMAKE_SOURCE_DIR}/tasks/hermes_adapters/include)
# Test includes
include_directories(${CMAKE_SOURCE_DIR}/test/unit)

set(Labstor_CLIENT_LIBRARIES
set(Hermes_CLIENT_LIBRARIES
${HermesShm_LIBRARIES}
yaml-cpp
cereal::cereal
-ldl -lrt -lc -pthread labstor_client)
set(Labstor_CLIENT_DEPS
set(Hermes_CLIENT_DEPS
labstor_client)
set(Labstor_RUNTIME_LIBRARIES
${Labstor_CLIENT_LIBRARIES}
set(Hermes_RUNTIME_LIBRARIES
${Hermes_CLIENT_LIBRARIES}
labstor_runtime
${Boost_LIBRARIES})
set(Labstor_RUNTIME_DEPS
set(Hermes_RUNTIME_DEPS
labstor_client labstor_runtime)

set(TEST_MAIN ${CMAKE_SOURCE_DIR}/test/unit)
Expand Down Expand Up @@ -197,13 +197,13 @@ add_subdirectory(test)
install(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX})

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/LabstorConfig.cmake
${PROJECT_BINARY_DIR}/CMakeFiles/LabstorConfig.cmake @ONLY
${CMAKE_CURRENT_SOURCE_DIR}/CMake/HermesConfig.cmake
${PROJECT_BINARY_DIR}/CMakeFiles/HermesConfig.cmake @ONLY
)

install(
FILES
${PROJECT_BINARY_DIR}/CMakeFiles/LabstorConfig.cmake
${PROJECT_BINARY_DIR}/CMakeFiles/HermesConfig.cmake
DESTINATION
${CMAKE_INSTALL_PREFIX}/cmake
)
24 changes: 12 additions & 12 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(labstor)
project(hermes)

set(CMAKE_CXX_STANDARD 17)

Expand All @@ -12,9 +12,9 @@ add_executable(test_performance_exec
test_init.cc
test_latency.cc)
add_dependencies(test_performance_exec
${Labstor_RUNTIME_DEPS} hermes)
${Hermes_RUNTIME_DEPS} hermes)
target_link_libraries(test_performance_exec
${Labstor_RUNTIME_LIBRARIES} hermes Catch2::Catch2
${Hermes_RUNTIME_LIBRARIES} hermes Catch2::Catch2
MPI::MPI_CXX)

#add_executable(test_performance_exec
Expand All @@ -24,17 +24,17 @@ target_link_libraries(test_performance_exec
# test_zmq.cc
#)
#add_dependencies(test_performance_exec
# ${Labstor_CLIENT_DEPS} hermes)
# ${Hermes_CLIENT_DEPS} hermes)
#target_link_libraries(test_performance_exec
# ${Labstor_CLIENT_LIBRARIES} hermes Catch2::Catch2
# ${Hermes_CLIENT_LIBRARIES} hermes Catch2::Catch2
# MPI::MPI_CXX ${ZMQ_LIBRARIES})

add_executable(hermes_api_bench
hermes_api_bench.cc)
add_dependencies(hermes_api_bench
${Labstor_CLIENT_DEPS} hermes)
${Hermes_CLIENT_DEPS} hermes)
target_link_libraries(hermes_api_bench
${Labstor_CLIENT_LIBRARIES} hermes
${Hermes_CLIENT_LIBRARIES} hermes
Catch2::Catch2 MPI::MPI_CXX)

#------------------------------------------------------------------------------
Expand All @@ -52,15 +52,15 @@ install(TARGETS
test_performance_exec
hermes_api_bench
EXPORT
${LABSTOR_EXPORTED_TARGETS}
LIBRARY DESTINATION ${LABSTOR_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${LABSTOR_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${LABSTOR_INSTALL_BIN_DIR})
${HERMES_EXPORTED_TARGETS}
LIBRARY DESTINATION ${HERMES_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${HERMES_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${HERMES_INSTALL_BIN_DIR})

#-----------------------------------------------------------------------------
# Coverage
#-----------------------------------------------------------------------------
if(LABSTOR_ENABLE_COVERAGE)
if(HERMES_ENABLE_COVERAGE)
set_coverage_flags(test_performance_exec)
set_coverage_flags(test_hermes_api)
endif()
4 changes: 2 additions & 2 deletions ci/install_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ cmake \
-DCMAKE_INSTALL_RPATH=${INSTALL_PREFIX}/lib \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_SHARED_LIBS=ON \
-DLABSTOR_ENABLE_DOXYGEN=ON \
-DLABSTOR_ENABLE_COVERAGE=ON \
-DHERMES_ENABLE_DOXYGEN=ON \
-DHERMES_ENABLE_COVERAGE=ON \
..
make dox >& out.txt
# cat out.txt | grep warning | grep -v "ignoring unsupported tag"
Expand Down
4 changes: 2 additions & 2 deletions ci/install_hshm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ cd build
spack load --only dependencies hermes_shm
cmake ../ \
-DCMAKE_BUILD_TYPE=Debug \
-DLABSTOR_ENABLE_COVERAGE=ON \
-DLABSTOR_ENABLE_DOXYGEN=ON \
-DHERMES_ENABLE_COVERAGE=ON \
-DHERMES_ENABLE_DOXYGEN=ON \
-DBUILD_HSHM_BENCHMARKS=ON \
-DBUILD_HSHM_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=${HOME}/install
Expand Down
42 changes: 21 additions & 21 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ target_link_libraries(labstor_client
add_library(labstor_runtime
worker.cc
labstor_runtime.cc)
add_dependencies(labstor_runtime ${Labstor_CLIENT_DEPS})
target_link_libraries(labstor_runtime thallium ${Labstor_CLIENT_LIBRARIES})
add_dependencies(labstor_runtime ${Hermes_CLIENT_DEPS})
target_link_libraries(labstor_runtime thallium ${Hermes_CLIENT_LIBRARIES})

#------------------------------------------------------------------------------
# Build Labstor Runtime Start Function
#------------------------------------------------------------------------------
add_executable(labstor_start_runtime
labstor_start_runtime.cc)
add_dependencies(labstor_start_runtime ${Labstor_RUNTIME_DEPS})
target_link_libraries(labstor_start_runtime ${Labstor_RUNTIME_LIBRARIES})
add_dependencies(labstor_start_runtime ${Hermes_RUNTIME_DEPS})
target_link_libraries(labstor_start_runtime ${Hermes_RUNTIME_LIBRARIES})

#------------------------------------------------------------------------------
# Build LabStor Runtime Stop Function
#------------------------------------------------------------------------------
add_executable(labstor_stop_runtime labstor_stop_runtime.cc)
add_dependencies(labstor_stop_runtime ${Labstor_CLIENT_DEPS})
target_link_libraries(labstor_stop_runtime ${Labstor_CLIENT_LIBRARIES})
add_dependencies(labstor_stop_runtime ${Hermes_CLIENT_DEPS})
target_link_libraries(labstor_stop_runtime ${Hermes_CLIENT_LIBRARIES})

#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
install(
FILES
${LABSTOR_HEADERS}
${HERMES_HEADERS}
DESTINATION
${LABSTOR_INSTALL_INCLUDE_DIR}
${HERMES_INSTALL_INCLUDE_DIR}
COMPONENT
headers
)
Expand All @@ -63,46 +63,46 @@ install(
labstor_start_runtime
labstor_stop_runtime
EXPORT
${LABSTOR_EXPORTED_TARGETS}
LIBRARY DESTINATION ${LABSTOR_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${LABSTOR_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${LABSTOR_INSTALL_BIN_DIR}
${HERMES_EXPORTED_TARGETS}
LIBRARY DESTINATION ${HERMES_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${HERMES_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${HERMES_INSTALL_BIN_DIR}
)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
install(
EXPORT
${LABSTOR_EXPORTED_TARGETS}
${HERMES_EXPORTED_TARGETS}
DESTINATION
${LABSTOR_INSTALL_DATA_DIR}/cmake/hermes
${HERMES_INSTALL_DATA_DIR}/cmake/hermes
FILE
${LABSTOR_EXPORTED_TARGETS}.cmake
${HERMES_EXPORTED_TARGETS}.cmake
)

#-----------------------------------------------------------------------------
# Export all exported targets to the build tree for use by parent project
#-----------------------------------------------------------------------------
set(LABSTOR_EXPORTED_LIBS
set(HERMES_EXPORTED_LIBS
labstor_client
labstor_runtime
labstor_start_runtime
labstor_stop_runtime
${LABSTOR_EXPORTED_LIBS})
if(NOT LABSTOR_EXTERNALLY_CONFIGURED)
${HERMES_EXPORTED_LIBS})
if(NOT HERMES_EXTERNALLY_CONFIGURED)
EXPORT (
TARGETS
${LABSTOR_EXPORTED_LIBS}
${HERMES_EXPORTED_LIBS}
FILE
${LABSTOR_EXPORTED_TARGETS}.cmake
${HERMES_EXPORTED_TARGETS}.cmake
)
endif()

#------------------------------------------------------------------------------
# Coverage
#------------------------------------------------------------------------------
if(LABSTOR_ENABLE_COVERAGE)
if(HERMES_ENABLE_COVERAGE)
set_coverage_flags(labstor_client)
set_coverage_flags(labstor_runtime)
set_coverage_flags(labstor_start_runtime)
Expand Down
Loading

0 comments on commit 32f84a6

Please sign in to comment.