Skip to content

Commit

Permalink
Fix windows installation path
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
  • Loading branch information
LecrisUT committed Feb 6, 2024
1 parent 63a7a4b commit 9f08561
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
7 changes: 5 additions & 2 deletions fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ if (SPGLIB_INSTALL)
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_MODULEDIR}>")
install(TARGETS Spglib_fortran
EXPORT SpglibTargets-fortran
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Runtime NAMELINK_COMPONENT Spglib_Development
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Runtime
NAMELINK_COMPONENT Spglib_Development
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Development
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Spglib_Development)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Spglib_Development
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Spglib_Runtime
)
export_components(COMPONENT fortran LIB_TYPE ${SPGLIB_LIB_TYPE})

# Maybe it is handled automatically
Expand Down
25 changes: 11 additions & 14 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@ if (NOT Python_INSTALL_DIR)
endif ()
endif ()
if (SPGLIB_INSTALL)
if (WIN32)
# Windows needs RUNTIME as well to install the .dll file to
install(TARGETS Spglib_symspg
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
RUNTIME DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
else ()
# TODO: Cmake forces to install PUBLIC_HEADER when defined
# https://gitlab.kitware.com/cmake/cmake/-/issues/24326
install(TARGETS Spglib_symspg
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
endif ()
# TODO: Cmake forces to install PUBLIC_HEADER when defined
# https://gitlab.kitware.com/cmake/cmake/-/issues/24326
install(TARGETS Spglib_symspg
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
NAMELINK_COMPONENT Spglib_Development
ARCHIVE DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Development
PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Development
RUNTIME DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
)
install(TARGETS Spglib_python
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
)

if (NOT SKBUILD)
install(DIRECTORY spglib/ DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
Expand Down
17 changes: 5 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,13 @@ endif ()

# Install
if (NOT SKBUILD AND SPGLIB_INSTALL)
# Normal installation target to system. When using scikit-build check python subdirectory
if (WIN32)
# TODO: Probably wrong, please fix
# Normal installation target to system. When using scikit-build this is installed again in python path
install(TARGETS Spglib_symspg
EXPORT SpglibTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Runtime NAMELINK_COMPONENT Spglib_Development
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Runtime
NAMELINK_COMPONENT Spglib_Development
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Development
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Spglib_Development
RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR} COMPONENT Spglib_Runtime)
else ()
install(TARGETS Spglib_symspg
EXPORT SpglibTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Runtime NAMELINK_COMPONENT Spglib_Development
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Spglib_Development
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Spglib_Development)
endif ()
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Spglib_Runtime
)
endif ()

0 comments on commit 9f08561

Please sign in to comment.