From 46d6915b6f781b15c461359f3155ab6708fc59eb Mon Sep 17 00:00:00 2001 From: Christoph Alt <christoph.alt@fau.de> Date: Fri, 14 Feb 2025 12:07:20 +0100 Subject: [PATCH] Added a bit of documentation and deactivate CODEGEN_PRIVATE_VENV if python_interpreter is set --- src/pystencilssfg/cmake/FindPystencilsSfg.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pystencilssfg/cmake/FindPystencilsSfg.cmake b/src/pystencilssfg/cmake/FindPystencilsSfg.cmake index f76fe66..8790c9d 100644 --- a/src/pystencilssfg/cmake/FindPystencilsSfg.cmake +++ b/src/pystencilssfg/cmake/FindPystencilsSfg.cmake @@ -3,6 +3,9 @@ Find-Module for pystencils-sfg. # Setting the Python interpreter +If the cache CODEGEN_PRIVATE_VENV is true, it will try to create to a own python venv and install the requirements from `CODEGEN_VENV_REQUIREMENTS`. +If this file does not exists it will download pystencilssfg and pystencils from `PystencilsSfg_URL` and `Pystencils_URL` + If the cache entry PystencilsSfg_PYTHON_INTERPRETER is set, e.g. via the commandline (`-DPystencilsSfg_PYTHON_INTERPRETER=<...>`), its value be taken as the Python interpreter used to find and run pystencils-sfg. @@ -14,11 +17,15 @@ If none of these is set, a Python interpreter will be selected using the `FindPy #]] -set( - CODEGEN_PRIVATE_VENV ON +set(CODEGEN_PRIVATE_VENV ON CACHE BOOL "Create a private virtual Python environment inside the build tree for code generation" ) +if (DEFINED CACHE{PystencilsSfg_PYTHON_INTERPRETER}) + set( CODEGEN_PRIVATE_VENV OFF) +elseif(DEFINED PystencilsSfg_PYTHON_PATH) + set( CODEGEN_PRIVATE_VENV OFF) +endif() if(NOT DEFINED CACHE{PystencilsSfg_PYTHON_INTERPRETER}) # The Python interpreter cache variable is not set externally, so... -- GitLab