From ff4bedf88f393a637a0682cf4279f0210baf0650 Mon Sep 17 00:00:00 2001
From: Frederik Hennig <frederik.hennig@fau.de>
Date: Thu, 16 Jan 2025 16:17:46 +0100
Subject: [PATCH] Rename requirements file. Disable private venv by default.
 Update user manual.

---
 cmake/PrepareSFG.cmake                            | 6 +++---
 cmake/{venv-reqs.txt => codegen-requirements.txt} | 0
 user_manual/CMakeSetup/CMakeSetup.md              | 2 +-
 user_manual/reference/PythonEnvironment.md        | 9 +++++----
 4 files changed, 9 insertions(+), 8 deletions(-)
 rename cmake/{venv-reqs.txt => codegen-requirements.txt} (100%)

diff --git a/cmake/PrepareSFG.cmake b/cmake/PrepareSFG.cmake
index e17d70b..c755106 100644
--- a/cmake/PrepareSFG.cmake
+++ b/cmake/PrepareSFG.cmake
@@ -1,7 +1,7 @@
 #   Maybe set up private virtual environment
 
 set( 
-    WALBERLA_CODEGEN_PRIVATE_VENV ON
+    WALBERLA_CODEGEN_PRIVATE_VENV OFF
     CACHE BOOL 
     "Create a private virtual Python environment inside the build tree for code generation" 
 )
@@ -25,7 +25,7 @@ if( WALBERLA_CODEGEN_PRIVATE_VENV )
         message( STATUS "Installing required Python packages..." )
 
         execute_process(
-            COMMAND ${_venv_python_exe} -m pip install -r ${sfg_walberla_SOURCE_DIR}/cmake/venv-reqs.txt
+            COMMAND ${_venv_python_exe} -m pip install -r ${sfg_walberla_SOURCE_DIR}/cmake/codegen-requirements.txt
             OUTPUT_QUIET
         )
 
@@ -94,7 +94,7 @@ Run `pip install` in the code generation environment with the given arguments.
 #]]
 function(walberla_codegen_venv_install)
     if(NOT WALBERLA_CODEGEN_PRIVATE_VENV)
-        message( FATAL_ERROR "The private virtual environment for code generation is disabled" )
+        return()
     endif()
 
     if(NOT _sfg_private_venv_done)
diff --git a/cmake/venv-reqs.txt b/cmake/codegen-requirements.txt
similarity index 100%
rename from cmake/venv-reqs.txt
rename to cmake/codegen-requirements.txt
diff --git a/user_manual/CMakeSetup/CMakeSetup.md b/user_manual/CMakeSetup/CMakeSetup.md
index 003caad..d4ce0d3 100644
--- a/user_manual/CMakeSetup/CMakeSetup.md
+++ b/user_manual/CMakeSetup/CMakeSetup.md
@@ -43,7 +43,7 @@ Now, you can run `cmake` to configure your build system:
 
 ```bash
 mkdir build
-cmake -S . -B build -DPython_EXECUTABLE=`pwd`/.venv/bin/python
+cmake -S . -B build -DWALBERLA_CODEGEN_PRIVATE_VENV=ON
 ```
 
 If, near the end of the long configuration log, you see two messages like this:
diff --git a/user_manual/reference/PythonEnvironment.md b/user_manual/reference/PythonEnvironment.md
index 614cf1f..298d83a 100644
--- a/user_manual/reference/PythonEnvironment.md
+++ b/user_manual/reference/PythonEnvironment.md
@@ -3,9 +3,10 @@
 On this page, you can find information on managing, customizing, and extending the Python environment
 used by the waLBerla code generation system.
 
-## Using the Default Virtual Environment
+## Using the Private Virtual Environment
 
-By default, `sfg-walberla` creates a new Python virtual environment within the CMake build tree,
+If the CMake cache variable `WALBERLA_CODEGEN_PRIVATE_VENV` is enabled,
+`sfg-walberla` creates a new Python virtual environment within the CMake build tree,
 and there installs all packages required for code generation.
 
 ### Install Additional Packages
@@ -29,10 +30,10 @@ To have even more control over your Python environment, you can configure sfg-wa
 forego creating a private virtual environment, and instead use the Python interpreter
 supplied from the outside.
 
-To explicitly specify a Python interpreter, you need to set the `WALBERLA_CODEGEN_USE_PRIVATE_VENV` cache
+To explicitly specify a Python interpreter, you need to set the `WALBERLA_CODEGEN_PRIVATE_VENV` cache
 variable to `FALSE`, and set `Python_EXECUTABLE` to point at your Python binary.
 For instance, at configuration time:
 
 ```bash
-cmake -S . -B build -DWALBERLA_CODEGEN_USE_PRIVATE_VENV=FALSE -DPython_EXECUTABLE=<path-to-python>
+cmake -S . -B build -DWALBERLA_CODEGEN_PRIVATE_VENV=FALSE -DPython_EXECUTABLE=<path-to-python>
 ```
-- 
GitLab