c:\vtk #
c:\vtk\src # 'code base' folder
c:\vtk\build # 'out of source' build folder
c:\vtk\install # 'install folder' where the 'installed' files will reside
If using the git method,
cd c:\vtk\srcgit clone https://gitlab.kitware.com/vtk/vtk.git.
This could take a while depending on your internet connection speedIf using the zip method, unzip the source code into c:\vtk\src
c:\vtk\src for Where is the source code:c:\vtk\build for Where to build the binaries:Configure and select Visual Studio 2015 as the required generatorCMAKE_INSTALL_PREFIX = c:\vtk\installBUILD_SHARED_LIBS tickedBUILD_DOCUMENTATION untickedBUILD_TESTING untickedCMAKE_CXX_MP_FLAG ticked. This will use all the CPU cores (on multicore/multiprocessor systems) to speed up the buildConfigure correcting any errors until all the RED entries become WHITEGeneratec:\vtk\build\vtk.sln
ALL_BUILD.vcxproj
INSTALL.vcxproj
vtkCompileTools.vcxproj
VTKData.vcxproj
ZERO_CHECK.vcxproj
Developer Command Prompt For Visual Studio 2015cd c:\vtk\buildmsbuild /p:Configuration=Debug ALL_BUILD.vcxprojmsbuild /p:Configuration=Debug INSTALL.vcxprojmsbuild /p:Configuration=Release ALL_BUILD.vcxprojmsbuild /p:Configuration=Release INSTALL.vcxprojVTK.sln with Visual Studio 2015 and build the INSTALL.vcxprojc:\vtk\install should now have some new folders
bin # contains the dll fileslib # contains the lib filescmakeshareinclude # contains the header filesc:\vtk\include\vtk-<version>c:\vtk\lib.lib filesc:\vtk\vtk.vsprops<?xml version="1.0" encoding="UTF-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VTK_ROOT_DIR>$(MSBuildThisFileDirectory)</VTK_ROOT_DIR>
<VTK_BIN_DIR>$(VTK_ROOT_DIR)\bin</VTK_BIN_DIR>
<VTK_INC_DIR>$(VTK_ROOT_DIR)\include\vtk-7.0</VTK_INC_DIR>
<VTK_LIB_DIR>$(VTK_ROOT_DIR)\lib</VTK_LIB_DIR>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOn>CopyVTKBinariesList;$(BuildDependsOn);</BuildDependsOn>
</PropertyGroup>
<Target Name="CopyVTKBinariesList">
<ItemGroup>
<VtkBinaries Include="$(VTK_BIN_DIR)\*.dll" />
</ItemGroup>
<Copy SourceFiles="@(VtkBinaries)"
DestinationFiles="@(VtkBinaries->'$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(VTK_INC_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(VTK_LIB_DIR);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>vtkalglib-7.0.lib;vtkChartsCore-7.0.lib;vtkCommonColor-7.0.lib;vtkCommonComputationalGeometry-7.0.lib;vtkCommonCore-7.0.lib;vtkCommonDataModel-7.0.lib;vtkCommonExecutionModel-7.0.lib;vtkCommonMath-7.0.lib;vtkCommonMisc-7.0.lib;vtkCommonSystem-7.0.lib;vtkCommonTransforms-7.0.lib;vtkDICOMParser-7.0.lib;vtkDomainsChemistry-7.0.lib;vtkDomainsChemistryOpenGL2-7.0.lib;vtkexoIIc-7.0.lib;vtkexpat-7.0.lib;vtkFiltersAMR-7.0.lib;vtkFiltersCore-7.0.lib;vtkFiltersExtraction-7.0.lib;vtkFiltersFlowPaths-7.0.lib;vtkFiltersGeneral-7.0.lib;vtkFiltersGeneric-7.0.lib;vtkFiltersGeometry-7.0.lib;vtkFiltersHybrid-7.0.lib;vtkFiltersHyperTree-7.0.lib;vtkFiltersImaging-7.0.lib;vtkFiltersModeling-7.0.lib;vtkFiltersParallel-7.0.lib;vtkFiltersParallelImaging-7.0.lib;vtkFiltersProgrammable-7.0.lib;vtkFiltersSelection-7.0.lib;vtkFiltersSMP-7.0.lib;vtkFiltersSources-7.0.lib;vtkFiltersStatistics-7.0.lib;vtkFiltersTexture-7.0.lib;vtkFiltersVerdict-7.0.lib;vtkfreetype-7.0.lib;vtkGeovisCore-7.0.lib;vtkglew-7.0.lib;vtkhdf5-7.0.lib;vtkhdf5_hl-7.0.lib;vtkImagingColor-7.0.lib;vtkImagingCore-7.0.lib;vtkImagingFourier-7.0.lib;vtkImagingGeneral-7.0.lib;vtkImagingHybrid-7.0.lib;vtkImagingMath-7.0.lib;vtkImagingMorphological-7.0.lib;vtkImagingSources-7.0.lib;vtkImagingStatistics-7.0.lib;vtkImagingStencil-7.0.lib;vtkInfovisCore-7.0.lib;vtkInfovisLayout-7.0.lib;vtkInteractionImage-7.0.lib;vtkInteractionStyle-7.0.lib;vtkInteractionWidgets-7.0.lib;vtkIOAMR-7.0.lib;vtkIOCore-7.0.lib;vtkIOEnSight-7.0.lib;vtkIOExodus-7.0.lib;vtkIOExport-7.0.lib;vtkIOGeometry-7.0.lib;vtkIOImage-7.0.lib;vtkIOImport-7.0.lib;vtkIOInfovis-7.0.lib;vtkIOLegacy-7.0.lib;vtkIOLSDyna-7.0.lib;vtkIOMINC-7.0.lib;vtkIOMovie-7.0.lib;vtkIONetCDF-7.0.lib;vtkIOParallel-7.0.lib;vtkIOParallelXML-7.0.lib;vtkIOPLY-7.0.lib;vtkIOSQL-7.0.lib;vtkIOVideo-7.0.lib;vtkIOXML-7.0.lib;vtkIOXMLParser-7.0.lib;vtkjpeg-7.0.lib;vtkjsoncpp-7.0.lib;vtklibxml2-7.0.lib;vtkmetaio-7.0.lib;vtkNetCDF-7.0.lib;vtkNetCDF_cxx-7.0.lib;vtkoggtheora-7.0.lib;vtkParallelCore-7.0.lib;vtkpng-7.0.lib;vtkproj4-7.0.lib;vtkRenderingAnnotation-7.0.lib;vtkRenderingContext2D-7.0.lib;vtkRenderingContextOpenGL2-7.0.lib;vtkRenderingCore-7.0.lib;vtkRenderingFreeType-7.0.lib;vtkRenderingImage-7.0.lib;vtkRenderingLabel-7.0.lib;vtkRenderingLOD-7.0.lib;vtkRenderingOpenGL2-7.0.lib;vtkRenderingVolume-7.0.lib;vtkRenderingVolumeOpenGL2-7.0.lib;vtksqlite-7.0.lib;vtksys-7.0.lib;vtktiff-7.0.lib;vtkverdict-7.0.lib;vtkViewsContext2D-7.0.lib;vtkViewsCore-7.0.lib;vtkViewsGeovis-7.0.lib;vtkViewsInfovis-7.0.lib;vtkzlib-7.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
The above vsprops file copies all the available dlls in the c:\vtk\bin folder.
An alternative way to make sure the DLLs can be located is to use alter the PATH environment variable for the debugging session and put the VTK binaries path as the first directory to be searched when loading dependencies. The below fragment can be instead of the CopyVTKBinariesList task to do this.
<PropertyGroup> <LocalDebuggerEnvironment>PATH=$(VTK_BIN_DIR);%PATH%;$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment> </PropertyGroup>
For final deployment you might want to use a tool like Dependency Walker to track down which dlls and their dependencies are used and only bundle only those for redistribution.
To use the props file in a Visual C++ project you can either use the Property Manager tool within Visual Studio (Menu: View => Property Manager) or edit the vcxproj using a text editor and add this following line <Import Project="C:\vtk\vtk.vsprops" /> below the other project imports.
c:\vtk\build folder but the downside is you cannot debug into vtkc:\vtk folder if you dont want to VTK anymoreMacOSX and Unix:
mkdir <path_to_build_directoryccmake <path_to_VTK_directory -G "UNIX Makefiles" \ -DVTK_USE_QVTK:BOOL=ON \ -DVTK_USE_CARBON:BOOL=ON \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DVTK_USE_GUISUPPORT:BOOL=ON
or use the GUI to do so with ccmake <path_to_VTK_directorymake -j(you don't have to use -j but compilation is really long.make install