Build VTK with TBB

Hello,

can anyone guide me how to build VTK with VTK_SMP_IMPLEMENTATION_TYPE = TBB on Windows?

I downloaded TBB from https://github.com/intel/tbb/releases.
tbb-2020.1-win.zip

Unfortunately, I don’t know which folders have to be set since there are various possibilities (e.g. tbb/bin/intel64/vc14 or tbb/bin/intel64/vc14 etc.).

I tried to set all “INCLUDE_DIR” to “tbb\include” all “LIBRARY” DIRs to “tbb\lib\intel64\vc14” but I received some TBB related build errors.

Moreover there is a QGLWidget related error which also occurs when building without TBB.

Thank you for your help.

Most applications nowadays depend on a number of third-party libraries, which are downloaded/built automatically using CMake External Project infrastructure.

In your project, you would dowbload TBB and pass its path to VTK. See an example here: https://github.com/Slicer/Slicer/blob/master/SuperBuild/External_VTK.cmake

FYI, you can build with OpenMP easilly as it is integrated in visual studio.

If you need to configure TBB manually, you can do that by:
VTK_SMP_IMPLEMENTATION_TYPE: VTK
TBB_INCLUDE_DIR: Path to the folder which contains tbb/tbb.h
TBB_LIBRARY_DEBUG: (Path)/tbb_debug.lib
TBB_LIBRARY_RELEASE: (Path)/tbb.lib

Also, make sure to always use forward slashes with cmake paths.

1 Like

I have built VTK with TBB on macOS, linux, and iOS. Still need to get around to Android. (We don’t use windows sorry)

Here’s my configure command:

export TBB_ROOT=$PATH_TO_TBB//tbb_2019-linux/

cmake  \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=$PWD/install \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_TESTING=OFF \
    -DVTK_SMP_IMPLEMENTATION_TYPE=TBB \
  ../vtk

You might have to configure the FindTBB.cmake to not use the CMAKE_FIND_ROOT_PATH like I did for iOS: https://gitlab.kitware.com/vtk/vtk/merge_requests/4862/diffs#9cc788f89f8295fd16deed0c681d2837096b4b47_282_283

Hope this helps!

1 Like