I have a few C++ extensions for a python library.
Previously, this library was shipped using setup.py
and one could recompile via
python setup.py build_ext --inplace
if only the C++ files changed.
Since I had to change the build system to manage more complex dependencies, I switched over to pyproject.toml + scicit-build-core + CMake
.
Unfortunately I cannot find any way of how to recompile the changed files in this new setup.
At the moment I have to always call pip install .
which goes through the whole python dependency management and compiles everything.
TLDR: What is the equivalent of make
in this setup?
pip install --no-deps .
gets rid of the python dependencies part, but it still recompiles all cpp files, even if they were not changed.
Option 1:
Create a build directory:
mkdir -p build && cd build
Configure CMake once:
cmake .. -DCMAKE_BUILD_TYPE=Debug
Build incrementally:
cmake --build . --config Debug -j$(nproc)
Install locally (without reinstalling via pip):
cmake --install . --prefix ../install
Option 2:
1. Install the CLI tool:
pip install scikit-build-core[pyproject]
2. Run an in-place build:
python -m scikit_build_core.build --wheel --no-isolation