-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[bug] CMakePresets
relative paths break out of build CMake usage
#16644
Comments
Hi @nyibbang Thanks for your report. It seems there would be some inconsistency in this point:
This is defining a different build folder than the one that the If you type
It will work. This is assumed as a pre-condition for
This will work. That means, that the |
Well, this is unfortunate. My use case is this one: I have a C++ project that uses pybind11 to create a Python module, and I want to build that project as a wheel. I use CMake + Conan to build this project. I have 2 workflows for the build system:
Now if that preconditions exists for Would there be a way to disable the |
I am not sure I understand the reasons why this won't work for this use case. If you can please clarify why the |
The reason it wouldn't work is that I use However my Conan build folders are shared through multiple versions of Python. My dependencies do not depend on Python, so I do not need to rebuild them (I can build them once for the platform and that's it). I suppose I could have I think I need to find a way to build and install dependencies in the cache but ignore anything that gets generated in my build folder ( |
Yes, I might still be missing something, but in general there are 2 distinct flows here, and the flow of extracting artifacts from Conan packages to use them in other technology such as .deb debian packages or creating a Windows installer is by first having the Conan packages there, then doing something like Because when doing those wheels it is not only necessary the current binaries, but also if the transitive dependencies have shared libraries, it is necessary to "collect" them, extract them from the Conan cache and put them inside the wheel (in user folder). This is typically done with This way the problem of the package creation, local development, etc is decoupled from the "deployment" flow. Maybe for this case, you might need to do some changes, but something like this could make sense:
I don't know if this makes sense for your use case, just some ideas from the usage we see by other users. |
My goal was to stay as much as possible close to the Python workflow. This step in my case is handled by Python Once dependencies were built with Conan, I could build my wheel just by running And because that workflow was really close to a more simple wheel project, I could use other tools such as I would prefer staying in that workflow if possible, so I'll try to find a way to work out with this change in Conan. I'll probably just ignore the presets and directly target the toolchain file. |
The Conan option `cibuildwheel` disables the generation of a `CMakeUserPresets.json` file due to relative paths that make it incompatible with multiple build config folders (see conan-io/conan#16644). It also lets `build_folder_vars` to its default value. This patch also lets scikit-build-core install CMake and Ninja (instead of installing them in the `before_all` script.
Describe the bug
Since Conan 2.3.0 and merge of the #16015 feature pull request, the
CMakePresets.json
file uses relative paths to the CMake toolchain file.I'm not sure what the reasoning for this change was, but it introduced a regression when using CMake with presets and an out of build configuration (with -S -B arguments), and CMake now fails to find the toolchain file.
How to reproduce it
Here is a small example of a project that reproduces this issue with conan 2.3.0
conanfile.txt
CMakeLists.txt
build.sh
Result
When we execute the
build.sh
script, we get the following CMake error:The text was updated successfully, but these errors were encountered: