jjcasmar
jjcasmar

Reputation: 1675

Create python packages with C++ bindings with CMake and Conan

I have a C++ project with some Python bindings created using pybind11. The C++ code has some external dependencies which I fetch using Conan, and I use the conan generated CMake presets to build the project.

If I run cmake -S . --preset conan-clang-18-release I can configure my project succesfully.

Now I am trying to build my project using scikit-build. pyproject.toml contains

[tool.scikit-build]
build.verbose = true
logging.level = "DEBUG"
cmake.args = ["--preset=conan-clang-18-release"]

However, when I run

uvx --from build pyproject-build --install=uv

I get the following error

2024-12-25 19:48:40,340 - scikit_build_core - INFO - RUN: /home/dev/.local/bin/cmake -E capabilities
2024-12-25 19:48:40,431 - scikit_build_core - INFO - CMake version: 3.31.2
*** scikit-build-core 0.10.7 using CMake 3.31.2 (wheel)
2024-12-25 19:48:40,433 - scikit_build_core - INFO - Build directory: /tmp/tmpscn13yji/build
*** Configuring CMake...
2024-12-25 19:48:40,533 - scikit_build_core - INFO - RUN: /tmp/build-env-ttx3shkf/bin/ninja --version
2024-12-25 19:48:40,534 - scikit_build_core - INFO - Ninja version: 1.11.1
2024-12-25 19:48:40,535 - scikit_build_core - INFO - RUN: /home/dev/.local/bin/cmake -S. -B/tmp/tmpscn13yji/build -DCMAKE_BUILD_TYPE:STRING=Release -C/tmp/tmpscn13yji/build/CMakeInit.txt -DCMAKE_INSTALL_PREFIX=/tmp/tmpscn13yji/wheel/platlib -DCMAKE_MAKE_PROGRAM=/tmp/build-env-ttx3shkf/bin/ninja --preset=conan-clang-18-release
CMake Error: No such preset in /tmp/build-via-sdist-rdnwvs88/mandos-0.0.0: "conan-clang-18-release"

*** CMake configuration failed

ERROR Backend subprocess exited when trying to invoke build_wheel

How should I build the python package with the C++ bindings?

Upvotes: 0

Views: 37

Answers (0)

Related Questions