Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GNUInstallDirs to fix installation problems on mac #957

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ if (PARTHENON_ENABLE_ASCENT)
find_package(Ascent REQUIRED NO_DEFAULT_PATH)
endif()

# Installation configuration
include(GNUInstallDirs)
set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/parthenon")

add_subdirectory(src)
add_subdirectory(example)
add_subdirectory(benchmarks)
Expand Down
10 changes: 10 additions & 0 deletions cmake/parthenonConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
# the public, perform publicly and display publicly, and to permit others to do so.
#=========================================================================================

if(NOT PARTHENON_CMAKE)
cmake_path(SET PARTHENON_CMAKE_BASE_DIR NORMALIZE "${CMAKE_CURRENT_LIST_DIR}/..")
message(STATUS "Appending parthenon cmake module directory: " ${PARTHENON_CMAKE_BASE_DIR})
list(APPEND CMAKE_MODULE_PATH ${PARTHENON_CMAKE_BASE_DIR})
set(PARTHENON_CMAKE TRUE)
endif()


# Favor using the kokkos package that was built with parthenon, if one has not been specified
if (@PARTHENON_IMPORT_KOKKOS@)
find_package(Kokkos 3 REQUIRED PATHS @Kokkos_DIR@ NO_DEFAULT_PATH)
Expand All @@ -37,4 +45,6 @@ if(@OpenMP_FOUND@)
find_package(OpenMP REQUIRED COMPONENTS CXX)
endif()

find_package(Filesystem REQUIRED COMPONENTS Experimental Final)

include("${CMAKE_CURRENT_LIST_DIR}/parthenonTargets.cmake")
14 changes: 6 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,24 +328,22 @@ lint_target(parthenon)
target_include_directories(parthenon PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/parthenon>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

install(TARGETS parthenon EXPORT parthenonTargets
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parthenon"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(TARGETS parthenon EXPORT parthenonTargets)

# Maintain directory structure in installed include files
install(DIRECTORY . DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parthenon" FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY ./ TYPE INCLUDE FILES_MATCHING PATTERN "*.hpp")

# Install generated config header file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generated/config.hpp
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parthenon")
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

install(FILES ${PROJECT_BINARY_DIR}/cmake/parthenonConfig.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/parthenon")

install(FILES ${PROJECT_SOURCE_DIR}/cmake/FindFilesystem.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")

install(EXPORT parthenonTargets
FILE parthenonTargets.cmake
NAMESPACE Parthenon::
Expand Down
Loading