VTK/Building/Linux: Difference between revisions

From KitwarePublic
< VTK‎ | Building
Jump to navigationJump to search
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Download ==
== Download ==
Download the source code  from the [http://www.vtk.org/VTK/resources/software.html VTK Download page] or [[VTK/Git | Clone with Git]]
Download the source code  from the [https://vtk.org/download/ VTK Download page] or [[VTK/Git | Clone with Git]]
  git clone git://vtk.org/VTK.git VTK
  git clone https://gitlab.kitware.com/vtk/vtk.git VTK


== Configure ==
== Configure ==
Create a build directory which is separate from the source. 
  mkdir VTK-build
  mkdir VTK-build
  cd VTK-build
  cd VTK-build
  ccmake ../VTK
  ccmake /path/to/VTK


Set any options you would like using the curses interface.  Alternatively, set the options at the command line.
Set any options you would like using the curses interface.  Alternatively, set the options at the command line.
Line 13: Line 14:
  cd VTK-Release-build
  cd VTK-Release-build
  cmake -DCMAKE_BUILD_TYPE:STRING=Release /path/to/VTK
  cmake -DCMAKE_BUILD_TYPE:STRING=Release /path/to/VTK
=== Qt Setup ===
==== Qt5 ====
In order to build with the latest Qt5 release (Qt5.2.1), take the following steps:
* Download the [http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run Qt.5.2.1 offline installer for linux] and run it
mkdir qt5.2.1-install && cd qt5.2.1-install
wget http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run
chmod +x qt-opensource-linux-x64-5.2.1.run
./qt-opensource-linux-x64-5.2.1.run
* Install to a separate directory
* Configure VTK with the following options
cd /path/to/VTK-Release-build
cmake -DVTK_QT_VERSION:STRING=5 \
      -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt5.2.1-install/5.2.1/gcc_64/bin/qmake \
      -DVTK_Group_Qt:BOOL=ON \
      -DCMAKE_PREFIX_PATH:PATH=/path/to/qt.5.2.1-install/5.2.1/gcc_64/lib/cmake  \
      -DBUILD_SHARED_LIBS:BOOL=ON
      /path/to/VTK
==== Qt4 ====
* The latest patch release (Qt4.8.6) does not appear to have an installer for linux on the [http://qt-project.org/downloads Qt Downloads page] so the code must be built from source.
mkdir qt-4.8.6-build && cd qt-4.8.6-build
wget http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz
tar xzf qt-everywhere-opensource-src-4.8.6.tar.gz
cd qt-everywhere-opensource-src-4.8.6
./configure # go through the dialogue
make -j<# of cores>
* Then in the VTK build directory, configure VTK with the path to the Qt build
cmake -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt-4.8.6-build/qt-everywhere-opensource-src-4.8.6/bin/qmake \
      -DVTK_Group_Qt:BOOL=ON \
      -DBUILD_SHARED_LIBRARIES:BOOL=ON \
      /path/to/VTK


== Build ==
== Build ==

Revision as of 19:58, 12 December 2019

Download

Download the source code from the VTK Download page or Clone with Git

git clone https://gitlab.kitware.com/vtk/vtk.git VTK

Configure

Create a build directory which is separate from the source.

mkdir VTK-build
cd VTK-build
ccmake /path/to/VTK

Set any options you would like using the curses interface. Alternatively, set the options at the command line.

mkdir VTK-Release-build
cd VTK-Release-build
cmake -DCMAKE_BUILD_TYPE:STRING=Release /path/to/VTK

Qt Setup

Qt5

In order to build with the latest Qt5 release (Qt5.2.1), take the following steps:

mkdir qt5.2.1-install && cd qt5.2.1-install
wget http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run
chmod +x qt-opensource-linux-x64-5.2.1.run
./qt-opensource-linux-x64-5.2.1.run
  • Install to a separate directory
  • Configure VTK with the following options
cd /path/to/VTK-Release-build
cmake -DVTK_QT_VERSION:STRING=5 \
      -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt5.2.1-install/5.2.1/gcc_64/bin/qmake \
      -DVTK_Group_Qt:BOOL=ON \
      -DCMAKE_PREFIX_PATH:PATH=/path/to/qt.5.2.1-install/5.2.1/gcc_64/lib/cmake  \
      -DBUILD_SHARED_LIBS:BOOL=ON
      /path/to/VTK

Qt4

  • The latest patch release (Qt4.8.6) does not appear to have an installer for linux on the Qt Downloads page so the code must be built from source.
mkdir qt-4.8.6-build && cd qt-4.8.6-build
wget http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz
tar xzf qt-everywhere-opensource-src-4.8.6.tar.gz
cd qt-everywhere-opensource-src-4.8.6
./configure # go through the dialogue 
make -j<# of cores>
  • Then in the VTK build directory, configure VTK with the path to the Qt build
cmake -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt-4.8.6-build/qt-everywhere-opensource-src-4.8.6/bin/qmake \
      -DVTK_Group_Qt:BOOL=ON \
      -DBUILD_SHARED_LIBRARIES:BOOL=ON \
      /path/to/VTK

Build

Once cmake finishes successfully configuring, use make inside the build directory.

make -j<# of cores>