This document describes how to install TFEL/MFront on Windows plateform using the MSYS2 environment.

Installing and updating MSYS2

Installing MSYS2

MSYS2 is a collection of GNU utilities, in particular make which is used by MFront. It also provides a convenient shell which is far more easier to use than the DOS terminal provided by the cmd command.

Updating MSYS2

Open an MSYS2 MSYS terminal and run:

$ pacman -Syu

Close the terminal after completion.

Installing essential setup requirements

Open a MSYS2 MINGW64 terminal and run:

$ pacman -S mingw-w64-x86_64-toolchain \
            mingw-w64-x86_64-cmake \
            mingw-w64-x86_64-eigen3 \
            mingw-w64-x86_64-pybind11 \
            mingw-w64-x86_64-python \
            mingw-w64-x86_64-python-numpy \
            mingw-w64-x86_64-python-matplotlib \
            mingw-w64-x86_64-python-setuptools \
            git

These packages supply the compiler, cmake, numerical libraries, and Python bindings that TFEL depends on.

Cloning the TFEL repository

Go to a directory where you want to download the TFEL sources and run:

$ git clone https://github.com/thelfer/tfel.git
$ cd tfel
$ mkdir -p build
$ cd build

Then run:

$ cmake .. -G "MinGW Makefiles" \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/mingw64 \
        -DPYTHON_EXECUTABLE=/mingw64/bin/python \
        -Denable-python=ON \
        -Denable-python-bindings=ON
        

Compiling and installing TFEL

Compile the project using:

$ mingw32-make -jYY

Note: YY corresponds to the number of parallel jobs (for example, a CPU with 12 threads → -j12).

Then install it with:

$ mingw32-make install

Verifying the installation

To check whether MFront has been successfully installed, run:

$ which mfront

If the installation succeeded, this command should return the path to the mfront executable. Alternatively, TFEL can also be installed using the official package by running:

$ pacman -S mingw-w64-x86_64-tfel

However, this installation method does not provide the Cast3M and Python interfaces.

Setting up the environment

Create a file named env.sh and add the following lines:

$ export TFELHOME=/mingw64
$ export PATH=/mingw64/bin:$PATH
$ export LD_LIBRARY_PATH=/mingw64/lib:$LD_LIBRARY_PATH
$ export PYTHONPATH=/mingw64/bin/python3.XX/site-packages
$ export MAKE=mingw32-make.exe

Note: XX corresponds to the Python version installed in MSYS2.

Loading the environment

Before using TFEL/MFront, load the environment with:

$ source env.sh

Usage

Once done, MFront can be used as “usual” (like in Posix environments) in MSYS2.