diff --git a/cmake/PrepareSFG.cmake b/cmake/PrepareSFG.cmake index e17d70bf9a3aab94dd44b3c307a2f0091fc5330e..c7551063b2ed0bb5938a6c2f69dd6b22da8216ae 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 003caad5711019cd0dc3a55a6f45a5667c750a2c..d4ce0d39f2169d40ef26152849f08aeb96a7db70 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 614cf1fb3610fbb5e1d7e0ac58631f29e4a0a494..298d83a05835c0ff193257fbf00e0d38405b83ec 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> ```