Skip to content

Commit

Permalink
install *.cmake files under install_lib directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Jan 19, 2024
1 parent 3d8c5a8 commit 3a39e67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake")
# Options
option(BUILD_EXAMPLES "Build kokkos-fft examples" ON)
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable fft on both host and device" OFF)
option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on external one" OFF)
option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on external one" OFF)

if (NOT KokkosFFT_INTERNAL_Kokkos)
find_package(Kokkos REQUIRED)
Expand All @@ -26,8 +26,10 @@ endif()

# Set directories used for install
include(GNUInstallDirs)
set(LIBDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
set(INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${LIBDIR})
set(KokkosFFT_EXPORT_TARGET "KokkosFFT-Targets")

add_subdirectory(common)
add_subdirectory(fft)
Expand All @@ -40,13 +42,13 @@ include(CMakePackageConfigHelpers)

install(
TARGETS common fft
EXPORT KokkosFFT-targets
EXPORT ${KokkosFFT_EXPORT_TARGET}
)

install(
EXPORT KokkosFFT-targets
EXPORT ${KokkosFFT_EXPORT_TARGET}
NAMESPACE KokkosFFT::
DESTINATION ${INSTALL_INCLUDEDIR}
DESTINATION ${INSTALL_LIBDIR}
)

install(
Expand All @@ -56,12 +58,12 @@ install(

install(
FILES ${CMAKE_SOURCE_DIR}/cmake/FindFFTW.cmake
DESTINATION ${INSTALL_INCLUDEDIR}
DESTINATION ${INSTALL_LIBDIR}
)

configure_package_config_file(cmake/KokkosFFTConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfig.cmake
INSTALL_DESTINATION ${INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
INSTALL_DESTINATION ${INSTALL_LIBDIR}
)

write_basic_package_version_file(
Expand All @@ -73,5 +75,5 @@ write_basic_package_version_file(
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfigVersion.cmake
DESTINATION ${INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
DESTINATION ${INSTALL_LIBDIR}
)
4 changes: 2 additions & 2 deletions cmake/KokkosFFTConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# Set and Check must go first else macro might be redefined by find_dependency ...
set_and_check(KokkosFFT_TARGET_FILE
"${PACKAGE_PREFIX_DIR}/include/KokkosFFT-targets.cmake")
"${PACKAGE_PREFIX_DIR}/@LIBDIR@/@KokkosFFT_EXPORT_TARGET@.cmake")

include(CMakeFindDependencyMacro)
list(INSERT CMAKE_MODULE_PATH 0 "${PACKAGE_PREFIX_DIR}/include")
list(INSERT CMAKE_MODULE_PATH 0 "${PACKAGE_PREFIX_DIR}/@LIBDIR@")
find_dependency(Kokkos)

if(@Kokkos_ENABLE_CUDA@)
Expand Down

0 comments on commit 3a39e67

Please sign in to comment.