Skip to content

Commit

Permalink
fix: Windows installation path (#426)
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 7, 2024
1 parent 13f714d commit a648e41
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 28 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ GitHub release pages and in the git history.

## \[Unreleased\]

### Fixes

- [\[#426\]] - Fix Windows installation path

### CI

- [\[#422\]] - Update to ci-build-wheel v2.16
Expand Down Expand Up @@ -2120,3 +2124,4 @@ in bravais.c.

[setuptools-scm]: https://setuptools-scm.readthedocs.io/en/latest/extending/#available-implementations
[\[#422\]]: https://github.com/spglib/spglib/pull/422
[\[#426\]]: https://github.com/spglib/spglib/pull/426
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 a648e41

Please sign in to comment.