Skip to content

[cmake] Enable Python bindings for TFEL

Lars Bilke requested to merge bilke/ogs:tfel-python into master

Python bindings for TFEL are enabled if OGS_USE_PYTHON=ON and the dependency libboost_python[py version] is available. On our envinf machines you have to specify to use Python 3.10 as the boost package is compiled with it.

On TFEL building (during first CMake run) instructions on PYTHONPATH setup are printed, e.g.:

-- TFEL build with Python bindings. To use them:
   export PYTHONPATH=/home/bilke/code/ogs/build/release/_ext/TFEL/lib/python3.10/site-packages:$PYTHONPATH

Then you can use it in Python, full example (valid on envinf[x]) e.g.:

cd ogs
rm -r ../build/release-all
➜ cmake --preset release-all -DPython_EXECUTABLE=/usr/bin/python3.10
export PYTHONPATH=/home/bilke/code/ogs/build/release/_ext/TFEL/lib/python3.10/site-packages:$PYTHONPATH
➜ python3.10              
Python 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mtest
>>>

cc: @FZill, @felikskiszkurno

  1. Feature description was added to the changelog
Edited by Lars Bilke

Merge request reports