Skip to content

Building TiGL from Source

Jan Kleinert edited this page Jan 9, 2024 · 18 revisions

The minimum requirements to build TiGL are TiXI and OpenCascade Technology (OCCT). Qt5 is needed if you want to build the tiglviewer.

All build dependencies of TiGL are available as conda packages. Most dependencies are supplied in a decicated channel at https://anaconda.org/dlr-sc/. Specifically, this channel contains a recommended variant of opencascade, which includes a patch for G2-continuous Coons patches. The recipes for the conda packages in the dlr-sc channel can be found at https://github.com/DLR-SC/tigl-conda.

We recommend installing TiGL's dependencies via conda in a seperate environment. You can find our recommended environment file for the latest development version at https://github.com/DLR-SC/tigl/tree/master/environment.yml. To create this environment locally, enter the following command from the conda command prompt:

conda env create -f environment.yml

This command will install a new environment called tigl-bld with all dependencies pre-installed. Next activate the environment:

conda activate tigl-bld

Now tigl can be configured and build using cmake:

mkdir build
cd build
cmake ..
cmake --build .

This will configure TiGL with default options. An example of a customized cmake configuration could look like this:

cmake .. -GNinja \
         -DCMAKE_BUILD_TYPE=Release \
         -DCMAKE_INSTALL_PREFIX=install \
         -DOCE_STATIC_LIBS=ON \
         -DTIGL_BUILD_TESTS=ON \
         -DTIGL_ENABLE_COVERAGE=ON \
         -DTIGL_CONCAT_GENERATED_FILES=ON \
         -DTIGL_BINDINGS_PYTHON_INTERNAL=ON \
         -DTIGL_BINDINGS_MATLAB=ON \
         -DTIGL_BINDINGS_JAVA=ON \
         -DTIGL_NIGHTLY=ON

You can also take inspiration from here to see how TiGL releases are build in our continuous integration pipeline.

Python interface

TiGL provides

  • a Python wrapper for its C API (as defined in tigl.h), generated with a custom code generator
  • internal Python bindings for large parts of the C++ source code, generated via swig

If python is installed, the python wrapper (C-API) will be automatically built at the compile phase. The resulting file tiglwrapper.py is located under build/lib/. The python wrapper can be found in installDir/share/tigl/python/. To install the TiGL python wrapper, please copy this file in your python/Lib/site-packages/ folder.

To build the internal python bindings using swig, make sure to configure CMake with TIGL_BINDINGS_PYTHON_INTERNAL=ON. You can

  • copy the generated files to your python/Lib/site-packages folder, or
  • set the PATH, LD_LIBRARY_PATH, PYTHON_PATH variables, or
  • you can modify the conda recipe at https://github.com/DLR-SC/tigl-conda/tree/master/tigl3 and build a python wheel using conda build. Please refer to the conda-build documentation.