Skip to content

Commit

Permalink
Close #321.
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoklee committed May 26, 2022
1 parent 93710de commit 26ad8e0
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 79 deletions.
40 changes: 40 additions & 0 deletions CMake/FindGLPK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Find GLPK header and library.
#

# This module defines the following uncached variables:
# GLPK_FOUND, if false, do not try to use GLPK.
# GLPK_INCLUDE_DIRS, where to find glpk.h.
# GLPK_LIBRARIES, the libraries to link against to use the GLPK library
# GLPK_LIBRARY_DIRS, the directory where the GLPK library is found.

find_path(
GLPK_INCLUDE_DIR
glpk.h
)

if( GLPK_INCLUDE_DIR )
find_library(
GLPK_LIBRARY
NAMES glpk
)
if( GLPK_LIBRARY )
set(GLPK_LIBRARY_DIR "")
get_filename_component(GLPK_LIBRARY_DIRS ${GLPK_LIBRARY} PATH)
# Set uncached variables as per standard.
set(GLPK_FOUND ON)
set(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
set(GLPK_LIBRARIES ${GLPK_LIBRARY})
endif(GLPK_LIBRARY)
else(GLPK_INCLUDE_DIR)
message(STATUS "FindGLPK: Could not find glpk.h")
endif(GLPK_INCLUDE_DIR)

if(GLPK_FOUND)
if(NOT GLPK_FIND_QUIETLY)
message(STATUS "FindGLPK: Found both glpk.h and libglpk.a")
endif(NOT GLPK_FIND_QUIETLY)
else(GLPK_FOUND)
if(GLPK_FIND_REQUIRED)
message(STATUS "FindGLPK: Could not find glpk.h and/or libglpk.a")
endif(GLPK_FIND_REQUIRED)
endif(GLPK_FOUND)
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,22 @@ if(HERMES_RPC_THALLIUM)
endif()
endif()

# GLOG
find_package(glog REQUIRED)
if(glog_FOUND)
message(STATUS "found GLOG at ${glog_DIR}")
endif()
find_path(GLOG_INCLUDE_DIRS NAME glog PATH_SUFFIXES include/)
include_directories(${GLOG_INCLUDE_DIRS})

# GFLAGS
find_package(gflags REQUIRED)
if(gflags_FOUND)
message(STATUS "found GFLAGS at ${gflags_DIR}")
endif()
find_path(GFLAG_INCLUDE_DIRS NAME gflags PATH_SUFFIXES include/)
include_directories(${GFLAG_INCLUDE_DIRS})

# GOTCHA
if(HERMES_INTERCEPT_IO)
find_package(gotcha REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion adapter/mpiio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(MPIIO_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
add_library(hermes_mpiio SHARED ${MPIIO_ADAPTER_PRIVATE_HEADER} ${MPIIO_ADAPTER_PUBLIC_HEADER} ${MPIIO_ADAPTER_SRC})
target_include_directories(hermes_mpiio PRIVATE ${HERMES_ADAPTER_DIR})
add_dependencies(hermes_mpiio hermes)
target_link_libraries(hermes_mpiio hermes MPI::MPI_CXX stdc++fs)
target_link_libraries(hermes_mpiio hermes MPI::MPI_CXX glog::glog stdc++fs)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
Expand Down
2 changes: 1 addition & 1 deletion adapter/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(POSIX_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
add_library(hermes_posix SHARED ${POSIX_ADAPTER_PRIVATE_HEADER} ${POSIX_ADAPTER_PUBLIC_HEADER} ${POSIX_ADAPTER_SRC})
target_include_directories(hermes_posix PRIVATE ${HERMES_ADAPTER_DIR})
add_dependencies(hermes_posix hermes)
target_link_libraries(hermes_posix hermes MPI::MPI_CXX stdc++fs)
target_link_libraries(hermes_posix hermes MPI::MPI_CXX glog::glog stdc++fs)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
Expand Down
2 changes: 1 addition & 1 deletion adapter/pubsub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(PUBSUB_ADAPTER_SRC pubsub.cc metadata_manager.cc)
add_library(hermes_pubsub SHARED ${PUBSUB_ADAPTER_PRIVATE_HEADER} ${PUBSUB_ADAPTER_PUBLIC_HEADER} ${PUBSUB_ADAPTER_SRC})
target_include_directories(hermes_pubsub PRIVATE ${HERMES_ADAPTER_DIR})
add_dependencies(hermes_pubsub hermes)
target_link_libraries(hermes_pubsub hermes MPI::MPI_CXX)
target_link_libraries(hermes_pubsub hermes MPI::MPI_CXX glog::glog)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
Expand Down
2 changes: 1 addition & 1 deletion adapter/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(STDIO_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
add_library(hermes_stdio SHARED ${STDIO_ADAPTER_PRIVATE_HEADER} ${STDIO_ADAPTER_PUBLIC_HEADER} ${STDIO_ADAPTER_SRC})
target_include_directories(hermes_stdio PRIVATE ${HERMES_ADAPTER_DIR})
add_dependencies(hermes_stdio hermes)
target_link_libraries(hermes_stdio hermes MPI::MPI_CXX stdc++fs)
target_link_libraries(hermes_stdio hermes MPI::MPI_CXX glog::glog stdc++fs)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
Expand Down
2 changes: 1 addition & 1 deletion adapter/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(HERMES_ADAPTER_TEST_DIR ${HERMES_ADAPTER_DIR}/test)

find_package(Catch2 REQUIRED)
add_executable(hermes_daemon hermes_daemon.cc)
target_link_libraries(hermes_daemon -ldl -lc MPI::MPI_CXX)
target_link_libraries(hermes_daemon -ldl -lc MPI::MPI_CXX glog::glog)
target_link_libraries(hermes_daemon hermes)
add_dependencies(hermes_daemon hermes)

Expand Down
1 change: 1 addition & 0 deletions adapter/test/vfd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target_include_directories(hermes_vfd_test
target_link_libraries(hermes_vfd_test
hermes
MPI::MPI_CXX
glog::glog
stdc++fs
${HDF5_HERMES_VFD_EXT_LIB_DEPENDENCIES}
${HDF5_HERMES_VFD_EXT_PKG_DEPENDENCIES}
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(BENCHMARKS mdm_bench dpe_bench vpic_bench)
foreach(benchmark ${BENCHMARKS})
add_executable(${benchmark} ${benchmark}.cc)
target_link_libraries(${benchmark} hermes MPI::MPI_CXX
$<$<BOOL:${HERMES_RPC_THALLIUM}>:thallium>)
$<$<BOOL:${HERMES_RPC_THALLIUM}>:thallium> glog::glog)
target_compile_definitions(${benchmark}
PRIVATE $<$<BOOL:${HERMES_RPC_THALLIUM}>:HERMES_RPC_THALLIUM>)
endforeach()
8 changes: 4 additions & 4 deletions ci/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ MOCHI_REPO_DIR=${INSTALL_DIR}/mochi-spack-packages
THALLIUM_VERSION=0.10.0
GOTCHA_VERSION=develop
CATCH2_VERSION=2.13.3
ORTOOLS_VERSION=7.7
SPACK_VERSION=0.17.2
HDF5_VERSION=1_13_0

Expand Down Expand Up @@ -59,11 +58,12 @@ spack repo add ./ci/hermes

THALLIUM_SPEC="mochi-thallium@${THALLIUM_VERSION} ^mercury~boostsys"
CATCH2_SPEC="catch2@${CATCH2_VERSION}"
ORTOOLS_SPEC="gortools@${ORTOOLS_VERSION}"
GLPK_SPEC="glpk"
GLOG_SPEC="glog"

spack install ${THALLIUM_SPEC} ${CATCH2_SPEC} ${ORTOOLS_SPEC}
spack install ${THALLIUM_SPEC} ${CATCH2_SPEC} ${GLPK_SPEC} ${GLOG_SPEC}
SPACK_STAGING_DIR=~/spack_staging
mkdir -p ${SPACK_STAGING_DIR}
spack view --verbose symlink ${SPACK_STAGING_DIR} ${THALLIUM_SPEC} ${CATCH2_SPEC} ${ORTOOLS_SPEC}
spack view --verbose symlink ${SPACK_STAGING_DIR} ${THALLIUM_SPEC} ${CATCH2_SPEC} ${GLPK_SPEC} ${GLOG_SPEC}

cp -LRnv ${SPACK_STAGING_DIR}/* ${INSTALL_DIR}
22 changes: 11 additions & 11 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ configure_file(hermes_version.h.in hermes_version.h)
#------------------------------------------------------------------------------
# External dependencies
#------------------------------------------------------------------------------
# google ortools
find_package(ortools REQUIRED)
if(ORTOOLS_FOUND)
include_directories(${ORTOOLS_INCLUDE_DIRS})
message(STATUS "Found ortools")
set(HERMES_EXT_INCLUDE_DEPENDENCIES ${ORTOOLS_INCLUDE_DIRS}
${HERMES_EXT_INCLUDE_DEPENDENCIES}
)
# GNU Linear Programming Kit
find_package(GLPK REQUIRED)
if(GLPK_FOUND)
include_directories(${GLPK_INCLUDE_DIRS})
message(STATUS "Found GLPK")
# set(HERMES_EXT_INCLUDE_DEPENDENCIES ${GLPK_INCLUDE_DIRS}
# ${HERMES_EXT_INCLUDE_DEPENDENCIES}
# )
set(HERMES_EXT_LIB_DEPENDENCIES
${ORTOOLS_LIBRARIES} ${HERMES_EXT_LIB_DEPENDENCIES})
${GLPK_LIBRARIES} ${HERMES_EXT_LIB_DEPENDENCIES})
else()
message(STATUS "ortools not found")
message(STATUS "GLPK not found")
endif()

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -50,7 +50,7 @@ target_include_directories(hermes
)

target_link_libraries(hermes
PUBLIC ${ORTOOLS_LIBRARIES}
PUBLIC ${GLPK_LIBRARIES}
PUBLIC thallium
PUBLIC "$<$<BOOL:${HERMES_INTERCEPT_IO}>:${GOTCHA_MODULE_LIBS}>"
PRIVATE $<$<BOOL:${HERMES_COMMUNICATION_MPI}>:MPI::MPI_CXX>
Expand Down
Loading

0 comments on commit 26ad8e0

Please sign in to comment.