scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

Windows: DLL copied to the wrong directory

Open Tillsten opened this issue 1 year ago • 3 comments
trafficstars

Hi,

i am trying the get a nanobind binding to the Blend2D libarary running. However, the scikit-build does not place the dll correctly. Instead of the libary directory next to the pyd it gets placed into site-packages/bin for some reasone. Any hint?

cmake_minimum_required(VERSION 3.15)

project(${SKBUILD_PROJECT_NAME}
        VERSION ${SKBUILD_PROJECT_VERSION}
        LANGUAGES C CXX)

find_package(Python 3.8
  REQUIRED COMPONENTS Interpreter Development.Module
  OPTIONAL_COMPONENTS Development.SABIModule)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/blend2d)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/nanobind)

find_package(nanobind CONFIG REQUIRED)

nanobind_add_module(
  # Name of the extension
  blend2dpy_ext

  # Target the stable ABI for Python 3.12+, which reduces
  # the number of binary wheels that must be built. This
  # does nothing on older Python versions
  STABLE_ABI

  # Build libnanobind statically and merge it into the
  # extension (which itself remains a shared library)
  #
  # If your project builds multiple extensions, you can
  # replace this flag by NB_SHARED to conserve space by
  # reusing a shared libnanobind across libraries
  NB_STATIC


  # Source code goes here
  src/blend2dpy_ext.cpp
)

target_include_directories(blend2dpy_ext PRIVATE "${BLEND2D_DIR}/src")
target_link_libraries(blend2dpy_ext PRIVATE blend2d::blend2d)

install(TARGETS blend2dpy_ext DESTINATION ${SKBUILD_PROJECT_NAME})

Tillsten avatar Aug 31 '24 15:08 Tillsten

Could you re-run it with verbose options? Maybe even debug logging:

pip install . -v --config-settings=cmake.verbose=true --config-settings=logging.level=DEBUG

LecrisUT avatar Sep 02 '24 14:09 LecrisUT

I expect this is an issue with add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/blend2d) having an install command that's incorrectly specified. It's probably fixable without modifying the code there (though I'd guess that would be better). I'll try to look soon, ping me if needed.

henryiii avatar Sep 03 '24 06:09 henryiii

Do you have a repo where I can try a few things?

henryiii avatar Sep 03 '24 15:09 henryiii