-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore(cmake): add CMake presets #5655
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
Conversation
29949c4
to
84b306f
Compare
fbeece2
to
ffbedc2
Compare
7b79a41
to
90d366f
Compare
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
90d366f
to
e7cf14f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds CMakePresets to simplify running pybind11's test suite and improve IDE support. The changes include:
- Adding CMakePresets.json and updating pyproject.toml to ignore it.
- Introducing new CMake logic in CMakeLists.txt to autodetect and create a virtual environment.
- Updating the CI workflow in .github/workflows/ci.yml to use the new presets.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
pyproject.toml | Updated ignore list to exclude CMakePresets.json |
CMakePresets.json | New file defining configuration, build, and workflow presets |
CMakeLists.txt | Added logic for autoconfiguring a virtual environment and installing dependencies |
.github/workflows/ci.yml | CI workflow updated to leverage the new CMake presets |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great.
Description
This adds CMakePresets, which simplify running CMake for pybind11's own test suite, and improves support for IDEs like VSCode.
Two presets are present:
cmake --workflow default
will build and run tests basically the way we like to do itcmake --workflow venv
will use a.venv
directory, creating it withuv
if not already presentI've also added autodiscovery of a
.venv
directory by default if it's present and nothing specific was requested.This requires CMake 3.25+ to run with the presets.
I need to work on two more things, as followups:
Suggested changelog entry: