Skip to content

CMake design: How to make vanilla CMake installs play nice with python packaging #856

Description

@LecrisUT

I have started to work on spglib/spglib#520, where I redesign the build process to be more compatible with audit-wheel and make things simpler overall. The problems that I am trying to tackle there:

  • Limit python binding installation to only pip install environment (too fragile to allow standalone cmake --install without populating .dist-info metadata)
  • Switch to using INSTALL_RPATH on the python bindings file pointing to $ORIGIN/${CMAKE_INSTALL_LIBDIR}
  • Install all files in a folder structure compliant with GNUInstallDirs (except for the python bindings which point to .), with the install prefix pointing to the python package
  • Make the configuration as close to a vanilla CMake project as possible

That design works relatively well but I am hitting 2 issues:

  • For windows environments, there is no INSTALL_RPATH equivalent, and usually it relies on all the .dll files being in the same folder, but this conflicts with GNUInstallDirs where it would put them in bin, but on the other hand, we need the python bindings to be under the path dictated by import ....
    Is there a way to reconcile these? I was thinking maybe putting the python bindings under the GNUInstallDirs structure as well, but that is not predictable since it would be ${CMAKE_INSTALL_LIBDIR} on unix, but ${CMAKE_INSTALL_BINDIR} on windows
  • macos repair-wheel commands are failing with rather cryptic issue:
      + delocate-wheel --require-archs arm64 -w /private/var/folders/m_/cksx93ys47x4621g0zbw_m4m0000gn/T/cibw-run-88asjxr1/cp311-macosx_arm64/repaired_wheel -v /private/var/folders/m_/cksx93ys47x4621g0zbw_m4m0000gn/T/cibw-run-88asjxr1/cp311-macosx_arm64/built_wheel/spglib-2.5.1.dev19+ged0599c-cp311-cp311-macosx_11_0_arm64.whl
    ERROR:delocate.libsana:
    @rpath/libsymspg.2.dylib not found:
      Needed by: /private/var/folders/m_/cksx93ys47x4621g0zbw_m4m0000gn/T/tmpzdzcou3j/wheel/spglib/_spglib.cpython-311-darwin.so
      Search path:
        $ORIGIN/lib
    ERROR:delocate.libsana:
    @rpath/libsymspg.2.dylib not found:
      Needed by: /private/var/folders/m_/cksx93ys47x4621g0zbw_m4m0000gn/T/tmpzdzcou3j/wheel/spglib/_spglib.cpython-311-darwin.so
      Search path:
        $ORIGIN/lib
    ERROR:delocate.libsana:@rpath/libsymspg.2.dylib not found
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions