Difference between revisions of "Compiling libFluid"

From Kraken Wiki
Jump to: navigation, search
(Prerequisite)
Line 4: Line 4:
  
 
==== Prerequisite ====
 
==== Prerequisite ====
* Python bindings require the developer libraries of whichever version of Python you are using
+
* Python bindings require the '''developer libraries''' of whichever version of Python you are using
 
** E.g. <tt>sudo apt install python3.8-dev</tt>
 
** E.g. <tt>sudo apt install python3.8-dev</tt>
 
* Python bindings require '''pybind11''':
 
* Python bindings require '''pybind11''':
Line 15: Line 15:
 
You will also need to add the path of the pybind11 module to your ''environment'' e.g. by adding an export command to the '''postactivate''' file of your kraken virtual environment (see: [[Python_environment#Setting_up_environment_variables|Setting up environment variables]]):
 
You will also need to add the path of the pybind11 module to your ''environment'' e.g. by adding an export command to the '''postactivate''' file of your kraken virtual environment (see: [[Python_environment#Setting_up_environment_variables|Setting up environment variables]]):
  
  export pybind11_DIR=/home/<username>/Envs/kraken/lib/python3.<version>/site-packages/pybind11  
+
  export pybind11_DIR=/home/<username>/Envs/kraken/lib/python3.<version>/site-packages/pybind11
  
 
==== Compiling ====
 
==== Compiling ====

Revision as of 11:23, 3 February 2024

libFluid is a library of water properties, which provides steam table data for Kraken.

libFluid is used in Kraken by compiling its Python bindings and adding those to the Python path.

Prerequisite

  • Python bindings require the developer libraries of whichever version of Python you are using
    • E.g. sudo apt install python3.8-dev
  • Python bindings require pybind11:

You can install pybind11 to your kraken virtual environment with

workon kraken
python -m pip install pybind11

You will also need to add the path of the pybind11 module to your environment e.g. by adding an export command to the postactivate file of your kraken virtual environment (see: Setting up environment variables):

export pybind11_DIR=/home/<username>/Envs/kraken/lib/python3.<version>/site-packages/pybind11

Compiling

  • If CMake on your computer is older than version 3.15, you can try changing version number in cmake_minimum_required(VERSION 3.15). find_package(Python) requires CMake version 3.12 or newer.
  • Switch on the building of the Python bindings in the CMakeLists.txt
option(LIBFLUID_PYTHON "Build the Python interface library" ON)
  • Configure and build:
mkdir build
cd build
cmake ..
make

If this process leads to CMake partially finding the wrong Python version, you can add the following lines inside if(LIBFLUID_PYTHON) for e.g. Python 3.8

find_package(PythonInterp 3.8 REQUIRED)
find_package(PythonLibs 3.8 REQUIRED)

Final setup

In order to use libFluid with KrakenTools add the libFluid/build/bindings/Python folder to your Python path (see Adding folders to the Python path).