-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support setting install-dir
to wheel_dir
instead of derivatives of wheel_dir/platlib
#901
Comments
Or, perhaps better yet, make the whatever generates # custom_build_backend.py
from scikit_build_core.build import *
import scikit_build_core as _skbcore
def my_install_dir() -> Path:
...
_skbcore.install_dir = my_install_dir
def build_wheel(...):
... |
Yes, it is, though it's an experimental feature (due to the syntax). Set: [tool.scikit-build]
experimental = true
wheel.install-dir = "/data" This is However, I don't think it's correct to construct If you wanted to install into the true root (not platlib or data), that might not be possible, but that's very much a wheel-specific structure and it's fine to require some setup in CMake for that.
You can use
Scikit-build-core expects you to use CMake if CMake can be used. The plugins (setuptools and hatching, or making your own) also are customizable in Python. We eventually will likely have some sort of hook system as well, but the goal is to make sure it does things that are truly hard or impossible to do from the CMake side and static configuration. Footnotes
|
What happens, out of curiosity, if you set |
Is it possible to break the project in the main C++ project and a python bindings project? Then you could cmake configure/build/install the main project into |
Ah I did not know that. Will try that out.
Yep, the C++ cmake files already handle this. They have essentially if(SYSTEM_USES_LIB64)
set(lib_install_dir lib64)
else()
set(lib_install_dir lib)
endif()
install(TARGETS my_lib DESTINATION ${lib_install_dir})
True, but I'd rather not. The way our cmake lists are set up is that any language bindings (e.g. python) sit on top of the C++ build. The C++ cmake lists are correctly constructed to install into C++ directories. We have many language bindings, so the language bindings cmakelists are where the special casing for each language should happen.
Yes, because SKBC passes
That is exactly how it is structured. The workflow is approximately as follows: # Build the C++ libraries, using CppLibCmakeLists.txt
$ cmake -S . -B cpp_build
$ cmake --build cpp_build
...
# Build and install the python bindings using PythonLibCMakeLists.txt
$ CMAKE_ARGS="-Dcpp_build_ROOT=./cpp_build" pip install . # calls into SKBC The problem here is that SKBC will install both the python project and C++ project
I would rather not split these for several reasons:
|
I am a bit confused on the workflow then. If you are purely concerned about installing within the
My suggestion there was about supporting esoteric packaging environments like conda and spack, but for plain |
I need the C++ libs to be installed to
...we use the wheel we build with
We do that as well, which is the cause of the problem. In any case, I have come up with a solution. I wish it weren't so hacky but needs must I guess... # pyproject.toml
[tool.scikit-build]
experimental = true
[tool.scikit-build.wheel]
install-dir = "/data" # CppLibCmakeLists.txt
install(TARGETS my_cpp_lib DESTINATION ${lib_or_lib64})
install(FILES my_cpp_headers DESTINATION include) # PythonLibCMakeLists.txt
install(TARGETS my_cython_libs DESTINATION "../platlib/${my_package_name}) |
I believe a more permanent solution would be (and this is only a humble suggestion :)) if SKBC did not use the wheel dir structure of lib/ # maps to $prefix/lib
include/ # maps to $prefix/include
bin/ # maps to $prefix/bin
py_prefix/
| - platlib/ # maps to site-packages (${SKBUILD_PLATLIB_DIR})
| - lib/ # maps to Python include dir (${SKBUILD_HEADERS_DIR})
| - bin/ # maps to Python bin dir (${SKBUILD_SCRIPTS_DIR}) The result of this is that:
|
But if it is for conda packaging than it should work by default. Just separate the project into subprojects and use Also, please use |
I think it should be the opposite. When packaging for PyPI, you can make Can you share the link for the main package and the conda package, and the log you got where you got the C++ package installed? I also used |
Not following everything, but a few quick comments:
No! You can't do this. The value of And that's just the most common reason for a variation here, but I believe your Python install can completely customize where these directories are. You should not assume a fixed structure. Specifically, you cannot make assumptions about the relative paths between $SKBUILD_BIN_DIR, $SKBUILD_PLATLIB_DIR, etc. That's why we strongly encourage placing everything inside I believe you can set the GNUInstallDirs variables to the SKBUILD paths in your Python wrapper. |
I am migrating a project over from
scikit-build
(SKB) toscikit-build-core
(SKBC). Our project is set up into 2 parts:In SKB, this worked. SKB would call
cmake --install
, and the C++ cmake files would first populatethen the Python cmakelists would install and populate
my_python_module/
as well, resulting in a "install" dir consisting ofThe important point:
This is currently not possible in SKBC
However, SKBC does not allow this, because installs everything under platlib:
which means all of those directories now end up under
site-packages
. And you can't fudge this by usingwheel.install-dir = ".."
because thats not allowed.I cannot use
SKBUILD_DATA_DIR
orSKBUILD_INCLUDE_DIR
etc in the C++ cmake files. They must be written completely scikit-build agnostic, as they must be usable without scikit-build driving the compilation.The text was updated successfully, but these errors were encountered: