Skip to content
Karsten Tausche edited this page Nov 28, 2017 · 8 revisions

Build Setup

First install the required dependencies:

Windows

Debian/Ubuntu

  • To install the dependencies of GeohazardVis and VTK run: sudo apt-get install build-essential cmake-qt-gui libfontconfig1-dev libgl1-mesa-dev libglu1-mesa-dev libqt5svg5-dev libqt5x11extras5-dev libxt-dev zlib1g-dev libpng-dev
  • You may skip the following libraries, if you do not use VTK with fontconfig (see below): libfontconfig1-dev, zlib1g-dev, libpng-dev

Environment Setup

On Windows, you will need to setup some environment variables so that CMake is able to find Qt when setting up GeohazardVis, and to find their dll's at runtime. It's better to do this beforehand, to make sure that CMake and Visual Studio will use this environment.

  • PATH -- append the Qt install subfolder that contains qmake.exe. This defaults to something like C:\Qt\5.9.2\msvc2017_64\bin. Replace the folder names to match your Qt and compiler version.

Compile VTK

  • git clone https://gitlab.kitware.com/vtk/vtk.git
  • create a CMake build folder for VTK (could be ./build subfolder of the source tree or somewhere else)
  • Open a command line inside the VTK build folder
  • Now we setup a VTK build with modules needed for the project:
    • Windows with Visual Studio 2015 or 2017: cmake -C [your_geohazardvis_source_dir]\setup_build\VTK_CMake_init_MSVC2015.txt -G "Visual Studio 15 2017 Win64" [path_to_your_VTK_source_dir] (or with -G "Visual Studio 14 2015 Win64")
    • Linux: cmake -C [path_to_your_geohazardvis_source_dir]/setup_build/VTK_CMake_init_Linux.txt [path_to_your_VTK_source_dir]
      • If you have problems linking zlib or libpng, DISABLE the following advanced options in the VTK CMake configuration: Module_vtkRenderingFreeTypeFontConfig, VTK_USE_SYSTEM_PNG, VTK_USE_SYSTEM_ZLIB. The reason is that fontconfig links to the system zlib and png, which might not be compatible with the PNG version that VTK expects.
      • Note that if you disable fontconfig in VTK, text rendering in visualizations will be limited to ASCII characters. If you really require unicode support, you might compile fontconfig yourself, together with zlib and png versions that are supported by VTK.
    • If you use a different compiler of environment, you might try the VTK_CMake_init_generic.txt initialization file or manually configure your VTK build.
  • Make sure to use the same CMake build type in VTK and Geohazardvis:
    • Available build types are: Debug (default), Release, RelWithDebInfo, MinSizeRel
    • In Visual Studio, you can compile VTK (and Geohazardvis) with all build types in one CMake build setup: In the IDE, select a build type in the toolbar dropdown list and compile the whole solution.
    • For Linux/Makefile project, you have to specify the build type in CMake: start the CMake GUI (cmake-gui on the command line); enter your VTK build folder in the second input line; in the configuration list, search for CMAKE_BUILD_TYPE and change it's value to the type you want to use.
  • Now compile VTK in its build folder:
    • On Windows, open the VTK.sln file for Visual Studio. To ensure that Visual Studio uses the correct environment setup, it is best to open the VTK.sln file from the command window, e.g., type build\VTK.sln. Now just compile the whole solution!
    • On Linux, just run make. Optionally, add a the parameter like -j 10 for parallel builds (here with up to 10 processes)
  • No installation required! GeohazardVis can use VTK directly from its build directory.

Geohazardvis Setup

  • Open a shell/command window, switch to the folder where you want to place the project sources, and run the following:
    • git clone https://github.com/kateyy/geohazardvis
    • cd geohazardvis
    • git submodule update --init
  • Create build subfolder, run CMake GUI, specify source and binary folder, run configure
  • In the CMake GUI, verify that VTK_DIR points to the correct VTK build directory.
  • Also, verify that all Qt5*_DIR variables point to the same (correct) Qt installation.
  • Click configure again, and generate.

Build and Packaging on Linux

  • Switch to the build folder and run the following commands:
    • make -j10 libzeug, make -j10 gtest, make -j10, and optionally make test
  • You may now run the application without installation. Therefore, switch to the source folder and run:
    • ./build/GeohazardVis [or ./build/GeohazardVis_d, for debug builds]
  • For installation, adjust CMAKE_INSTALL_PREFIX in the CMake GUI and run make install in the build folder
  • To create a standalone package for binary distribution, optionally adjust OPTION_PACK_GENERATOR in the CMake GUI and run make pack-GeohazardVis in the build folder.

Build and Packaging on Windows

  • Open the GeohazardVis.sln solution file with Visual Studio, preferable directly from the command window.
  • Compile the solution, set "GeohazardVis" as startup project, and start the debugger for testing.
  • For installation, adjust CMAKE_INSTALL_PREFIX in the CMake GUI and build the INSTALL project in Visual Studio.
  • To create a standalone package for binary distribution, optionally adjust OPTION_PACK_GENERATOR in the CMake GUI. In Visual Studio, again build the whole solution, and manually trigger a build of the pack-GeohazardVis project.

Note: In the default setup, GeohazardVis packages contain all binary dependencies that are not by default present on target systems. This behavior may be adjusted in the CMake GUI.

Note for Linux: Binary distributions of the application will likely only run on Linux installations that is not much older than the environment on which you created the package. This is mostly due to standard libraries (C, C++, OpenMP), for which there is no reasonable way to distribute them with the binary package. Therefore, as a build machine, you can use an older Linux distro such as Ubuntu 14.04 LTS, install a more recent compiler from a PPA (https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test), and manually download a recent Qt build from https://www1.qt.io/download-open-source/ (similar to the setup on Windows).