chore(cmake): add CMake presets#5655
Merged
Merged
Conversation
29949c4 to
84b306f
Compare
fbeece2 to
ffbedc2
Compare
henryiii
commented
May 13, 2025
7b79a41 to
90d366f
Compare
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
90d366f to
e7cf14f
Compare
Contributor
There was a problem hiding this comment.
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 <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 defaultwill build and run tests basically the way we like to do itcmake --workflow venvwill use a.venvdirectory, creating it withuvif not already presentI've also added autodiscovery of a
.venvdirectory 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: