Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ if (WITH_HDF5)
find_package(HDF5 NAMES hdf5 COMPONENTS C static NO_DEFAULT_PATH PATHS ${AMS_HDF5_DIR} ${AMS_HDF5_DIR}/share/cmake)
list(APPEND AMS_APP_LIBRARIES ${HDF5_C_STATIC_LIBRARY})
message(STATUS "HDF5 Static Library : ${HDF5_C_STATIC_LIBRARY}")
set(AMS_HDF5_LIB_TYPE "static")
else()
find_package(HDF5 NAMES hdf5 COMPONENTS C shared NO_DEFAULT_PATH PATHS ${AMS_HDF5_DIR} ${AMS_HDF5_DIR}/share/cmake)
list(APPEND AMS_APP_LIBRARIES ${HDF5_C_SHARED_LIBRARY})
message(STATUS "HDF5 Shared Library : ${HDF5_C_SHARED_LIBRARY}")
set(AMS_HDF5_LIB_TYPE "shared")
endif()
list(APPEND AMS_APP_INCLUDES ${HDF5_INCLUDE_DIR})
list(APPEND AMS_APP_DEFINES "-D__ENABLE_HDF5__")
Expand All @@ -159,10 +161,13 @@ if (WITH_RMQ)
list(APPEND AMS_APP_INCLUDES ${amqpcpp_INCLUDE_DIR})

find_package(OpenSSL REQUIRED)
set(AMS_OPENSSL_FOUND_ROOT "")
if (OPENSSL_FOUND)
list(APPEND AMS_APP_INCLUDES ${OPENSSL_INCLUDE_DIR})
list(APPEND AMS_APP_LIBRARIES "${OPENSSL_LIBRARIES}")
list(APPEND AMS_APP_LIBRARIES ssl)
get_filename_component(AMS_OPENSSL_FOUND_ROOT "${OPENSSL_SSL_LIBRARY}" DIRECTORY)
get_filename_component(AMS_OPENSSL_FOUND_ROOT "${AMS_OPENSSL_FOUND_ROOT}" DIRECTORY)
message(STATUS "OpenSSL includes found: " ${OPENSSL_INCLUDE_DIR})
message(STATUS "OpenSSL libraries found: " ${OPENSSL_LIBRARIES})
else()
Expand All @@ -176,16 +181,6 @@ if (WITH_RMQ)
endif() # WITH_RMQ

# ------------------------------------------------------------------------------
if(NOT DEFINED UMPIRE_DIR)
message(FATAL_ERROR "Missing required 'UMPIRE_DIR' variable pointing to an installed Umpire ${UMPIRE_DIR}")
endif()

find_package(UMPIRE REQUIRED
NO_DEFAULT_PATH
PATHS ${UMPIRE_DIR}/share/umpire/cmake ${UMPIRE_DIR}/lib/cmake/umpire)
list(APPEND AMS_APP_LIBRARIES umpire)
list(APPEND AMS_APP_INCLUDES ${UMPIRE_INCLUDE_DIR})

find_package(nlohmann_json REQUIRED)
list(APPEND AMS_APP_LIBRARIES nlohmann_json::nlohmann_json)

Expand Down
79 changes: 79 additions & 0 deletions cmake/AMSConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/AMSTargets.cmake")

# Expose configuration options with AMS_ prefix
set(AMS_WITH_MPI @WITH_MPI@)
set(AMS_WITH_CUDA @WITH_CUDA@)
set(AMS_WITH_CALIPER @WITH_CALIPER@)
set(AMS_WITH_HDF5 @WITH_HDF5@)
set(AMS_WITH_RMQ @WITH_RMQ@)
include(CMakeFindDependencyMacro)

find_dependency(nlohmann_json REQUIRED)
if (NOT TARGET Torch)
set(AMS_TORCH_DIR @Torch_DIR@)
if (NOT Torch_DIR)
set(Torch_DIR ${AMS_TORCH_DIR})
endif()
find_dependency(Torch REQUIRED HINTS ${Torch_DIR})
endif()

#Add usage hints for downstream projects
if(AMS_WITH_MPI)
if (NOT TARGET MPI)
find_dependency(MPI REQUIRED)
endif()
endif()

if(AMS_WITH_CUDA)
if (NOT TARGET CUDA::cudart)
find_dependency(CUDAToolkit REQUIRED)
endif()
endif()

if (AMS_WITH_HDF5)
set(AMS_HDF5_DIR @AMS_HDF5_DIR@)
set(AMS_HDF5_LIB_TYPE @AMS_HDF5_LIB_TYPE@)
if (NOT TARGET hdf5-shared OR NOT TARGET hdf5-static)
if (NOT HDF5_DIR)
set(HDF5_DIR ${AMS_HDF5_DIR})
endif()

if (${AMS_HDF5_LIB_TYPE} STREQUAL "static")
find_dependency(HDF5 COMPONENTS C static HINTS @AMS_HDF5_DIR@ @AMS_HDF5_DIR@/share/cmake)
else()
find_dependency(HDF5 COMPONENTS C shared HINTS @AMS_HDF5_DIR@ @AMS_HDF5_DIR@/share/cmake)
endif()
endif()
endif()

if (AMS_WITH_CALIPER)
if (NOT TARGET caliper)
set(CALIPER_AMS_DIR @caliper_DIR@)
# check if we specify another caliper directory
if (NOT caliper_DIR)
set(caliper_DIR ${CALIPER_AMS_DIR})
endif()
find_dependency(caliper HINTS ${caliper_DIR})
endif()
endif()

if (AMS_WITH_RMQ)
set(AMS_RMQ_DIR @amqpcpp_DIR@)
if (NOT amqpcpp_DIR)
set(amqpcpp_DIR ${AMS_RMQ_DIR})
endif()
set(AMS_OPENSSL_FOUND_ROOT @AMS_OPENSSL_FOUND_ROOT@)
if (NOT OPENSSL_ROOT_DIR)
set(OPENSSL_ROOT_DIR ${AMS_OPENSSL_FOUND_ROOT})
endif()
find_dependency(amqpcpp REQUIRED HINTS ${amqpcpp_DIR})
# find dependency does not correctly discover OpenSSL, not sure why.
find_dependency(OpenSSL)
if (NOT OPENSSL_FOUND)
find_dependency(OpenSSL HINTS ${AMS_OPENSSL_FOUND_ROOT})
endif()
endif()

check_required_components("@PROJECT_NAME@")
Loading
Loading