Skip to content

Commit

Permalink
use correct provided paths for installation
Browse files Browse the repository at this point in the history
install windows and HIP helpers only on demand
  • Loading branch information
upsj committed Mar 1, 2021
1 parent cab4358 commit 94a4bb3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
8 changes: 6 additions & 2 deletions cmake/GinkgoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ set(GINKGO_OPENMP_LIBRARIES @OpenMP_CXX_LIBRARIES@)
set(GINKGO_OPENMP_FLAGS "@OpenMP_CXX_FLAGS@")

# Provide useful HIP helper functions
include(${CMAKE_CURRENT_LIST_DIR}/hip_helpers.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/windows_helpers.cmake)
if(GINKGO_BUILD_HIP)
include(${CMAKE_CURRENT_LIST_DIR}/hip_helpers.cmake)
endif()
if (WIN32 OR CYGWIN)
include(${CMAKE_CURRENT_LIST_DIR}/windows_helpers.cmake)
endif()

# NOTE: we do not export benchmarks, examples, tests or devel tools
# so `third_party` libraries are currently unneeded.
Expand Down
45 changes: 27 additions & 18 deletions cmake/install_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ include(CMakePackageConfigHelpers)
include(GNUInstallDirs)


set(GINKGO_INSTALL_INCLUDE_DIR "include")
set(GINKGO_INSTALL_LIBRARY_DIR "lib")
set(GINKGO_INSTALL_PKGCONFIG_DIR "lib/pkgconfig")
set(GINKGO_INSTALL_CONFIG_DIR "lib/cmake/Ginkgo")
set(GINKGO_INSTALL_MODULE_DIR "lib/cmake/Ginkgo/Modules")
set(GINKGO_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(GINKGO_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}")
set(GINKGO_INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
set(GINKGO_INSTALL_CONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Ginkgo")
set(GINKGO_INSTALL_MODULE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Ginkgo/Modules")

function(ginkgo_install_library name subdir)

if (WIN32 OR CYGWIN)
# dll is considered as runtime
install(TARGETS "${name}"
EXPORT Ginkgo
LIBRARY DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
RUNTIME DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
LIBRARY DESTINATION "${GINKGO_INSTALL_LIBRARY_DIR}"
ARCHIVE DESTINATION "${GINKGO_INSTALL_LIBRARY_DIR}"
RUNTIME DESTINATION "${GINKGO_INSTALL_LIBRARY_DIR}"
)
else ()
# install .so and .a files
install(TARGETS "${name}"
EXPORT Ginkgo
LIBRARY DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
LIBRARY DESTINATION "${GINKGO_INSTALL_LIBRARY_DIR}"
ARCHIVE DESTINATION "${GINKGO_INSTALL_LIBRARY_DIR}"
)
endif ()
endfunction()
Expand All @@ -37,9 +37,8 @@ function(ginkgo_install)
DESTINATION "${GINKGO_INSTALL_INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.hpp"
)
install(DIRECTORY "${Ginkgo_BINARY_DIR}/include/"
DESTINATION "${GINKGO_INSTALL_INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.hpp"
install(FILES "${Ginkgo_BINARY_DIR}/include/ginkgo/config.hpp"
DESTINATION "${GINKGO_INSTALL_INCLUDE_DIR}/ginkgo"
)
if (GINKGO_HAVE_PAPI_SDE)
install(FILES "${Ginkgo_SOURCE_DIR}/third_party/papi_sde/papi_sde_interface.h"
Expand All @@ -60,7 +59,7 @@ function(ginkgo_install)
write_basic_package_version_file(
"${Ginkgo_BINARY_DIR}/GinkgoConfigVersion.cmake"
VERSION "${PROJECT_VERSION}"
COMPATIBILITY AnyNewerVersion
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
"${Ginkgo_SOURCE_DIR}/cmake/GinkgoConfig.cmake.in"
Expand All @@ -75,11 +74,21 @@ function(ginkgo_install)
install(FILES
"${Ginkgo_BINARY_DIR}/GinkgoConfig.cmake"
"${Ginkgo_BINARY_DIR}/GinkgoConfigVersion.cmake"
"${Ginkgo_SOURCE_DIR}/cmake/hip_helpers.cmake"
"${Ginkgo_SOURCE_DIR}/cmake/windows_helpers.cmake"
DESTINATION "${GINKGO_INSTALL_CONFIG_DIR}"
)
install(EXPORT Ginkgo
if (WIN32 OR CYGWIN)
install(FILES
"${Ginkgo_SOURCE_DIR}/cmake/windows_helpers.cmake"
DESTINATION "${GINKGO_INSTALL_CONFIG_DIR}"
)
endif()
if (GINKGO_BUILD_HIP)
install(FILES
"${Ginkgo_SOURCE_DIR}/cmake/hip_helpers.cmake"
DESTINATION "${GINKGO_INSTALL_CONFIG_DIR}"
)
endif()
install(EXPORT Ginkgo
NAMESPACE Ginkgo::
FILE GinkgoTargets.cmake
DESTINATION "${GINKGO_INSTALL_CONFIG_DIR}")
Expand Down

0 comments on commit 94a4bb3

Please sign in to comment.