Menu

BuildWindowsVS2012

vISTe

Build vIST/e from source: Visual Studio 2012 64-Bit

Install Visual Studio 2012

Configure CMake for 64-bit

  • Download CMake http://www.cmake.org/cmake/resources/software.html (the windows binaries).
  • CMake 2.8.10 or higher should be used. They have necessary configuration files for VS2012.
  • Assuming you have CMake installed, add its bin directory to the system PATH so you can run it from the command-line. (Setting the system PATH variable: Start->Computer->System Properties->advanced system settings->environment variables-> USER variables: path-> edit: e.g. C:\Program Files (x86)\CMake 2.8\bin) This is necessary because running the regular GUI version automatically defaults to the 32-bit Visual C++ compiler. You need to be able to run CMake from the 'VS2012 x64 Cross Tools Command Prompt' anymore.Type in the VS2012 x64 Cross Tools Command Prompt window “cmake-gui” to check.

Build Qt for 64-bit

The Qt binaries that can be downloaded from the Qt website are 32-bit by default. This means for 64-bit you have to build Qt yourself from source code. The following steps will explain how.

  • Download Qt source code at http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.zip and unpack it to directory C:\QtLibs and rename the directory 'qt-everywhere-opensource-src-4.8.2' to '4.8.2-x64'.
  • Go to Start > All Programs > Microsoft Visual Studio 2012 > Visual Studio Tools > VS2012 x64 Cross Tools Command Prompt. All build operations will now be done in 64-bit mode.
  • In the DOS window type 'cd C:\QtLibs\4.8.2-x64'.
  • Use command 'configure.exe -debug-and-release' for configuration. (if there are more than one compilers already loaded, it might be necessary for you to use the option -platform win32-msvc2010. If your Qt is 4.8.4 this argument may be win32-msvc2012 ). Answer to questions asked by configuration tool by selecting Open Source and Yes options. Configure.exe will prepare the Qt build for 64-bit platforms, generating both debug and release libraries. This may take a while.
  • When the preparation is finished, type 'nmake' to start the 64-bit build of Qt. This may take a very long time, i.e., several hours. It's best to start this process at the end of the day. When you come back the next day everything should be ready. In case of HashSet.h error like (wtf/HashSet.h(180) : error C2664: 'std::pair<_Ty1,_Ty2>::pair...) use the patch here: https://bugreports.qt-project.org/browse/QTBUG-28335.
  • When the build has finished add the directory C:\QtLibs\4.8.2-x64\bin to the system environment variable PATH and the directory C:\QtLibs\4.8.2-x64 as the QTDIR system variable (create it if it does not exist).

Build VTK for 64-bit

  • Download the latest release of the VTK source code at http://www.vtk.org/VTK/resources/software.html. Unpack it to a directory, e.g., C:\VTK. At the time of writing the latest release is 5.8.0.
  • Create a build directory C:\VTKLibs\5.8.0-x64.
  • Go to Start > All Programs > Microsoft Visual Studio 2012 > Visual Studio Tools > VS2012 x64 Cross Tools Command Prompt.
  • In the command line, go to C:\VTKLibs\5.8.0-x64 and run 'cmake-gui -G "Visual Studio 11 Win64"'. It will automatically open cmake, add the right folders where the source is (C:/VTK/) and where you want to build the binaries (e.g., C:/VTKLibs/5.8.0-x64/). Press configure, the VTK project settings will appear. Set the VTK_USE_QT, VTK_USE_QTCHARTS and BUILD_SHARED_LIBS options to TRUE. Set the CMAKE_BUILD_TYPE to Release or Debug. And press 'Configure' again.
    If items are still red, press Configure again until no red items remain and all variables displayed and set by you. Then press 'Generate' to generate (or update) the Visual C++ project. If PATH environment variable has nott been previously set giving qmake path is necessary.
  • Open the VTK.sln file which has just been produced by cmake-gui.
    -Then press F7 to build the source. (Debug or/and Release).
  • You will get an error on "make_pair <type,type>(var1,var2)" constructions that are not allowed anymore in VS2012. You should replace them by "make_pair(var1,var2)" in (vtkMapArrayValue)
  • You will also get an error in file vtkAdjacencyMatrixToEdgeTable.cxx. In order solve it you need to add "#include <functional >".
  • If your VTK is 5.10 and compile mod is Debug there is an error at vtkqtchart files about vtkMath::IsNan. Please try release mode because VTKQtCharts is deprecated at 5.10 and will be removed in 6.0.
  • Everything should build fine from there.
  • When the build has finished add the directory C:\VTKLibs\5.8.0-x64\bin\Debug (or Release) to the system PATH. When you are running vIST/e you should make sure that the right directory(Debug/Release) is being referred to. This is necessary for finding dlls at runtime. Do not install VTK to the system because VTK_DIR is going to be set in cmake-gui settings of vIST/e. If you want to test vIST/e both in release and debug mode, compile VTK in both modes successively, it will create Debug and Release automaticly under C:\VTKLibs\5.8.0-x64\bin as described above. You can also add both paths to the system PATH environment variable.

Checkout vIST/e source code

The main source code tree of vIST/e is publicly accessible. For specific branches you need a valid username and password combination. Contact the developers at Eindhoven University of Technology if you need this (viste.tue at gmail.com).

  • (Optional) Install the Tortoise SVN client from http://tortoisesvn.net/downloads.html. You need this tool to access the SVN repository where the vIST/e source code is hosted. Installing Tortoise SVN will add SVN-specific menu items to every right-click operation you perform in Windows Explorer.

  • Go to a folder where you wish to check out the vIST/e project, e.g., C:\vISTe\subversion.

  • Right-click in this folder, and select SVN Checkout....
  • In the URL of Repository text field, type https://svn.berlios.de/svnroot/repos/viste-tool/trunk.
  • In the Checkout Directory text field a C:\vISTe\subversion\viste is suggested. You can use this one or remove the 'viste' part to put everything directly in the 'subversion' directory.
  • Press Ok to check out.

Configure and build vIST/e

  • We will assume the vIST/e source code is located in C:\vISTe\subversion.
  • Start CMake from the 64-bit command line as explained for the Qt and VTK builds.
  • Create a directory for the vIST/e binaries, e.g., C:\vISTe\builds\1.0.0_x64 (or some other folder you prefer). Do not use the same binary folder as your source folder because this will become confusing when you commit your changes to SVN (if you have permission to do that of course). Even so, it is always a good idea to keep source code and binaries separated. Please be sure that your build directory has no "-" character in it, because build directory name will be used in a preprocessor directive created during the cmake run.
    -Open VS2012 x64 Cross Tools Command Prompt. Type in “cmake-gui "Visual Studio 11 Win64" ”. In the cmake-gui window add the location of the source code, which is C:\vISTe\subversion. Add the location where the binaries should be build: C:\vISTe\builds\1.0.0_x64.
  • Click configure until no more red colored items are visible. vIST/e by default enables all plugins except those that require special libaries. For example, the IllustrativeClusters plugin requires GLEW and is disabled. Also, the FiberTrackingCUDA plugin requires CUDA and is also disabled. Be sure you carefully set the CMAKE_BUILD_TYPE variable.
  • cmake-gui application will show a VTK_DIR variable; C:\VTKLibs\5.8.0-x64\ is the correct path. (During the linking ${VTK_DIR}\bin\Release or Debug will be searched because Cmake makes the necessary adjustments. If you configured and compiled vISTe in Release(Debug) the corresponding VTK dll files must be in the corresponding VTK directory. If you want to test vIST/e in both Debug and Release modes and you have compiled VTK in both modes be sure that system PATH environment variable includes both ${VTK_DIR}\bin\Release and ${VTK_DIR}\bin\Debug. But strangely I found that the ${VTK_DIR}\bin\Debug directory path should be given before?)
  • When no more red colored items are visible, press Generate to generate the 64-bit Visual Studio solution.
  • Open the solution file Project.sln and make sure the configuration is set to the platform 'x64' and compile mode displayed in combo box in the middle of the main window is the same with what you selected while compiling VTK and while the cmake-gui configuration of vIST/e. Then press F7 to build all project modules. You may get some errors because it is missing the linking library to 'opengl32.lib'. You need to add the library to the "RightClick>Properties MenuItem>Configuration Properties>Linker>Input>Additional dependencies' field of plugin projects GPUGlyphPlugin, RayCastPlugin, FiberVisualisationPlugin in Solution Explorer window. Adding opengl32.lib to each of their configurations should remove the linking issues. Note that 3 plugins can be selected together before the Right-Click, rather than selecting projects one by one and setting their link dependencies.
  • If building ends without any error the dlls can be found in ..\YourBuildDirectory\tool\bin\Release (or Debug).
  • To launch vIST/e from Visual Studio, right-click the vIST/e project and select Set as Startup Project. Then press F5 to start vIST/e if you compiled in Debug mode else use Ctrl-F5.
    • In case of "QWidget: Must Construct a QApplication before a QPaintDevice" error at the startup, empty build directory then rerun cmake-gui with the correct build mode then use the same build mode in VS2012 for compiling. While doing this, make sure that if you try viste in release mode, your path has ${VTK_DIR}\bin\Release before the ${VTK_DIR}\bin\Debug.
      -Similarly If viste is prepared in Release mode and compiled and run in debug mode "'vISTe.exe' (Win32): Loaded 'C:\Windows\System32\guard64.dll'. Cannot find or open the PDB file." error may occur. Close and rerun Visual Studio. If this does not work solution is the same as above, run cmake-gui again and compile and run viste in that mode.
  • At first startup, vIST/e may produce some messages, e.g., about a missing settings.xml (which it will create), but also about certain files being invalid Qt plugins. This is caused by the fact that the build directory where vISTe.exe is located also contains non-DLL files which the plugin loader tries to load. This fails of course and vIST/e shows an error. The best thing to do is to hold down the 'Enter' button to quickly run through all error messages until the tool itself starts. The next you start vIST/e this will not happen anymore.

  • It might be the shaders are not found. Move the shaders directory where vISTe.exe is located

  • If the main window does not appear with the icon on its left corner, one of the projects of the solution viste has a resource vISTe-128x128.res, its "File Type" should be set to RES file.

Related

Wiki: BuildFromSource