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

Understanding the option wheel.install-dir

Open TonyXiang8787 opened this issue 5 months ago • 1 comments
trafficstars

Hi,

We have a C++/Python project and we are considering using scikit-build for its Python build backend. By default, scikit-build installs the cmake targets into the root of site-packages, which is usually not what we want. In all the official examples, it specifies DESTINATION in the cmake install targets to let cmake to install the files into some folders in the site-packages.

But we cannot do this intrusive approach because the CMakeLists.txt is supposed to be used by regular C/C++ user. We can try to add some if statement in the cmake to conditionally set DESTINATION in the cmake install targets. But then I see the option wheel.install-dir. If I understand correctly, I can set the following into pyproject.toml.

wheel.install-dir = "MY_PACKAGE_NAME/my_module_name"

The scikit-build will install all the targets in site-packages/MY_PACKAGE_NAME/my_module_name. In this way I can keep all the CMakeLists.txt unchanged as a regular C/C++ project. Is that the correct understanding?

TonyXiang8787 avatar Jun 03 '25 12:06 TonyXiang8787

Yes, that's the design that I usually recommend for such projects. wheel.install-dir is basically the CMAKE_INSTALL_PREFIX starting from site-packages folder. Good luck with the design

LecrisUT avatar Jun 03 '25 12:06 LecrisUT