Skip to content
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

CMake: prefer Python virtual environment if present #202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elgiano
Copy link

@elgiano elgiano commented Sep 14, 2024

When auto-detecting python for building docs, prefer a version from a virtual environment if present.
I come to this problem when building flucoma-sc. As I don't want to install flucoma-docs dependencies system-wise, I create a virtual environment in my build folder, and pip install just there. With this PR, the build system detects the virtual env automatically.

@tremblap
Copy link
Member

tremblap commented Oct 9, 2024

I don't know what @weefuzzy think of this, but personally I use virtual environments by declaring:

set(Python_EXECUTABLE "/Users/pa/flucoma-env/bin/python" CACHE PATH "")

when I cmake the sc repo and boom, it works.

@weefuzzy
Copy link
Member

weefuzzy commented Oct 9, 2024

I don't see a compelling reason to bake this preference into the cmake code. Things like Python3_FIND_VIRTUALENV are meant as hints passed by users.

To make it less annoying to set every time you could make a CMakeUserPresets.json and declare a preset that sets this variable for you (along with any other repeatedly needed settings). (At some point we're going to move to using presets widely, and quite a lot of cruft can come out of the cmake code (I hope)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants