1) preparation
Install required packages using Cygwin's setup.exe.
In my opinion, the following packages (and their depending packages) are needed:
"unzip" "cmake" "gcc-g++" "make" "patch" "libjasper-devel" "libjpeg-devel" "libpng-devel" "libtiff-devel" "libhdf5-devel" "libbz2-devel" "zlib-devel"
2) apply patch
Get VTK-8.1.0.tar.gz,
and apply my patch for Cygwin.
for example:
$ cd /tmp/ $ tar xvzf VTK-8.1.0.tar.gz $ gunzip VTK-8.1.0-cygwin-patch-20171225.txt.gz $ cd VTK-8.1.0/ $ patch -p1 < ../VTK-8.1.0-cygwin-patch-20171225.txt
3) build and install
To build VTK, you must set VTK_IGNORE_CMAKE_CXX11_CHECKS flag in cmake, and also set an option "-std=gnu++14" to g++ compiler.
If you do not set them, cmake tries to set "-std=c++11" in g++, which causes error in the building stage.
for example:
$ mkdir /tmp/vtk_build/ $ cd /tmp/vtk_build/If you want to use Win32 OpenGL, disable VTK_USE_X and indicate OpenGL libraries as following:
$ cmake -D CMAKE_BUILD_TYPE:STRING=RELEASE \ -D VTK_IGNORE_CMAKE_CXX11_CHECKS:BOOL=ON \ -D CMAKE_CXX_FLAGS:STRING="-std=gnu++14" \ -D BUILD_SHARED_LIBS:BOOL=OFF \ -D VTK_USE_X:BOOL=OFF \ -D OPENGL_INCLUDE_DIR:PATH=/usr/include/w32api/ \ -D OPENGL_gl_LIBRARY:PATH=/usr/lib/w32api/libopengl32.a \ -D OPENGL_glu_LIBRARY:PATH=/usr/lib/w32api/libglu32.a \ -D VTK_USE_SYSTEM_HDF5:BOOL=ON \ -D VTK_USE_SYSTEM_JPEG:BOOL=ON \ -D VTK_USE_SYSTEM_PNG:BOOL=ON \ -D VTK_USE_SYSTEM_TIFF:BOOL=ON \ -D VTK_USE_SYSTEM_ZLIB:BOOL=ON \ -D CMAKE_INSTALL_PREFIX:PATH=/usr/local/vtk-8.1.0/ \ /tmp/VTK-8.1.0/ $ make -j ${NUMBER_OF_PROCESSORS} installor you can use X11 OpenGL by enabling VTK_USE_X as following:
$ cmake -D CMAKE_BUILD_TYPE:STRING=RELEASE \ -D CMAKE_CXX_FLAGS:STRING="-std=gnu++14" \ -D VTK_IGNORE_CMAKE_CXX11_CHECKS:BOOL=ON \ -D BUILD_SHARED_LIBS:BOOL=OFF \ -D VTK_USE_X:BOOL=ON \ -D VTK_USE_SYSTEM_HDF5:BOOL=ON \ -D VTK_USE_SYSTEM_JPEG:BOOL=ON \ -D VTK_USE_SYSTEM_PNG:BOOL=ON \ -D VTK_USE_SYSTEM_TIFF:BOOL=ON \ -D VTK_USE_SYSTEM_ZLIB:BOOL=ON \ -D CMAKE_INSTALL_PREFIX:PATH=/usr/local/vtk-8.1.0/ \ /tmp/VTK-8.1.0/ $ make -j ${NUMBER_OF_PROCESSORS} install