[vtkusers] Building only subset of VTK with modules

Kai Wolf kai.wolf at gmail.com
Sat Apr 16 06:21:49 EDT 2016


Hi all,

for a current project I only need a subset of VTK modules. Since there is no binary installer for Windows using VTK C++ (it seems installer for Python bindings are the only ones available) I need to build VTK from source. Furthermore as I’m using CI (appveyor and travis) I need to build VTK everytime I’m pushing to my repo, therefore I’d like to keep the build times to a minimum.

These are the headers I’m using in my project:

  <QVTKWidget.h>
  <vtkActor.h>
  <vtkDataArray.h>
  <vtkFloatArray.h>
  <vtkMarchingCubes.h>
  <vtkPointData.h>
  <vtkPolyData.h>
  <vtkPolyDataMapper.h>
  <vtkPolyDataNormals.h>
  <vtkRenderWindow.h>
  <vtkRenderer.h>
  <vtkSmartPointer.h>
  <vtkStructuredPoints.h>
  <vtkType.h>
  <vtkUnsignedCharArray.h>
  <vtkVersion.h>

I already tried to determine all needed modules with the script: Utilities/Maintenance/WhatModulesVTK.py, but still get some linker errors when compiling my project. It seems that QVTKWidget doesn’t get included correctly, but I might be wrong here. WhatModulesVTK gives me:

  All modules referenced in the files:
  find_package(VTK COMPONENTS
    vtkCommonCore
    vtkCommonDataModel
    vtkFiltersCore
    vtkRenderingCore
    vtkRenderingOpenGL
  )

which is already not quite right, as I use VTK 7.0.0 and there is no vtkRenderingOpenGL, but only vtkRenderingOpenGL2. My CMakeLists.txt for my project currenty looks like:

…
find_package(OpenCV REQUIRED core imgproc calib3d highgui)
find_package(Boost COMPONENTS filesystem system REQUIRED)
find_package(VTK 7.0 COMPONENTS vtkCommonCore vtkCommonDataModel vtkFiltersCore
    vtkRenderingCore vtkRenderingOpenGL2 REQUIRED)
find_package(Qt5Widgets REQUIRED QUIET)
…

Using VTK as a dependency, I’m building it beforehand like this:

$ git clone https://github.com/Kitware/VTK
$ cd VTK && git checkout tags/v7.0.0
$ mkdir build && cd build
$ cmake -DVTK_QT_VERSION:STRING=5
  -DQT_QMAKE_EXECUTABLE:PATH=c:/Qt/5.6/msvc2015_64/bin/qmake.exe
  -DVTK_Group_Qt:BOOL=ON
  # Here should be all needed modules, e.g. -DModule_vtkXXXXX:BOOL=ON
  -DBUILD_SHARED_LIBS:BOOL=ON ..
$ cmake --build .

Is this approach correct in general? What module am I missing in order.

Any help is appreciated.


--
Kai Wolf

http://kai-wolf.me/
kai.wolf at gmail.com



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160416/62a36fd1/attachment.sig>


More information about the vtkusers mailing list