SCM

Qt

From Forge Wiki

Jump to: navigation, search


Qt is a cross-platform application and graphical user interface (GUI) framework with APIs for C++ programming.
CamiTK's user interfaces use Qt, thus you'll need to install it on your computer.


Contents

Versions supported in CamiTK

Qt Versions supported in CamiTK
CamiTK versions 3.x 4.x
Qt versions supported 4.8.x 5.x

Note: on windows Qt 5.6 is the minimal version (due to the choice of MSVC 2015 and its enhanced C++11 support as the minimal required version of the compiler).

1) Qt Version - Qt binaries for MSVC 2015 only starts with Qt5.6 - Therefore Qt5.6 is the minimal version for CamiTK on Windows

For any questions about the versions supported, check out our external libraries policy.

Windows

Binaries

Qt binaries are provided within the All in on installer.
You may check this out.

Compile Qt 5.6.x from source for VS2015

This tutorial will help you build Qt 5.6.x, get from the official git repository with Visual Studio 2015.

Prerequisites

Download the latest source code using Git

First clone the git repository from the official Qt website

git clone https://code.qt.io/qt/qt5.git

Switch to the latest 5.6 branch

cd qt5
git checkout 5.6

You have a local git repository of the Qt 5.x project branched on the 5.6 version. The files on your local repositories have not been downloaded from the distant repository. To do so, run thr following perl script:

perl ./init-repository --no-webkit

Unless you really need the Qt module QtWebkit, do not download it (this one is long to configure and compile).

Configure the source code to build with VS 2015

Open the VS2015 x86 x64 command prompt (really don't miss this with any other command prompt or you will have to compile Qt again) Usint it, go to your qt5 directory and run the following command

configure -developer-build -opensource -confirm-license -mp -nomake examples -nomake tests -debug-and-release -c++11 -no-warnings-are-errors -platform win32-msvc2015

This will configure your Qt directory for a compilation using VS2015 in debug and release.

Compile Qt

Simply run the command:

nmake

to compile Qt. Go take a coffee, it will take several hours to compile.

Download and install the library

Choose the last version of the SDK libraries corresponding to your Windows C++ compiler, either:

  • Visual Studio 20xx
  • MinGW
  • If you need CamiTK configured in 64 bits, do not download the Qt libraries but compile them yourself. For it, jump to the next section entitled "Compile Qt from source".

The following pictures shows you the link to download the 4.8.1 version of the Qt libraries.

Choose the Qt 4.8.XX library

Execute the installer and follow the instructions.

It is highly recommended to install the Qt libraries in a directory whose name does not contain any white space. We recommend: C:\dev\Qt\4.8.1 (replace actually 4.8.1 with your actual version of Qt).

Compile Qt from source

If you are willing to compile in 64bits for instance, linking against Qt libraries won't work if you did not compile then yourself, using your compiler.

  • Download the zip containing the source files.
  • Follow these instructions to configure and compile your code (but do not consider installing the Qt addin for Visual Studio, as this one only works with the professional version, i.e. not Express). Note, you will need to use the Visual Studio 2010 x64 command prompt to configure and compile Qt (not the default cmd command prompt).

At the compilation step, using nmake won't let you multi-compile Qt (and Qt takes more than 12h on a recent computer to compile !) To shorten this, you may use jom, a nmake clone that supports multi-threads compilation.

Moreover, if you are willing to 64 bits version of these DLLs, please check either the DLL have been built in 32 or 64 bits mode

Edit your system Path

The installation is almost finished, but for your compiler to find Qt during compilation or for your output program to find Qt dlls during execution, you must modify your system path. Indeed you need to add the directory where Qt has been installed to your system Path, in order for applications using it (such as CamiTK applications) to know where to find it. To do this, simply:

  1. Create a system variable QT_DIR which value is the location where you have installed the Qt libraries (such as C:\dev for instance).
  2. Add the pattern %QT_DIR% at the beginning of your system envirnment variable Path


You may use Rapid Environement Editor freeware tool in order to easily edit your Windows envirnement variables.

Mac

Follow those  instructions

Linux

Install Qt 4.x

Run in a terminal:

sudo apt-get install libqt4-dev libqtwebkit4 libqtwebkit-dev libqt4-opengl libqt4-opengl-dev

Install Qt 5.x

sudo apt-get install qtbase5-dev libqt5xmlpatterns5-dev libqt5xmlpatterns5 libqt5xmlpatterns5-private-dev
Powered By FusionForge