Opticks Developer Guide/Getting Started/Building Qt From Source

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Instructions on building Qt from source

Please note that there are only 32-bit binary builds of Qt available from TrollTech. Because of this, in order to run Qt in 64-bit, Qt must be manually built on windows in both 32-bit and 64-bit binary builds.

Things to do before building Qt[edit | edit source]

  1. First extract the Qt zip file to a directory on your system.
  2. If you plan on building a 64-bit version of Qt, make a copy of the extracted Qt directory to another one, but add 64-bit to end of the new directory name. This new directory will be used to make the Qt 64-bit binary build. (For example if the name of the extracted Qt directory is Qt-win-src, then the name would be Qt-win-src-64-bit).

Building the 32-bit version[edit | edit source]

To make the 32-bit build of Qt, go to Visual Studio 2005->Visual Studio tools in the start menu and click on Visual Studio 2005 Command Prompt.

In the Command Prompt, go to the 32-bit Qt directory you just extracted.

Once you are in the directory, type:

 configure.exe -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg

This will generate a Makefile.

Now to start the compilation, run nmake by typing:

 nmake

Once the compilation is complete, then type:

 nmake install

The reason for doing this is so you will only need the include directory from Qt, not the src one.

The 32-bit binary build of Qt is now done.

Building the 64-bit version[edit | edit source]

To make the 64-bit build of Qt, go to Visual Studio 2005->Visual Studio tools in the start menu and click on Visual Studio 2005 x64 Win64 Command Prompt.

In the Command Prompt, go to the 64-bit Qt directory you just extracted.

Once you are in the directory, type:

 configure.exe -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg

This will generate a Makefile.

Now to start the compilation, run nmake by typing:

 nmake

Once the compilation is complete, then type:

 nmake install

The reason for doing this is so you will only need the include directory from Qt, not the src one.

The 64-bit binary build of Qt is now done.

Setting up the folders[edit | edit source]

Once Qt is done building, don't move it to the dependencies folder just yet. You will still need to do some work on the files......(LOCO)

  • Create a new directory named Qt in the dependencies folder.
  • Inside the new Qt directory, Create the following 4 folders: bin, include, lib, and plugins.
  • Inside each of these folders, Make a win32 folder if you are using the 32-bit version or a x64 folder if you are using the 64-bit version.

Copy all of the folders in the old Qt directory include folder and paste them in the new directory

  include -> win32/x64 folder.

Next go to the old Qt directory bin folder and copy all of the .dll files as well as the moc.exe, qmake.exe, rcc.exe, and uic.exe. Paste these files in the new Qt directory

  bin -> win32/x64 folder.

Also copy the .pdb files located in the old Qt directory lib folder and paste them in the new directory

  bin -> win32/x64 folder.

Now Move all of the .lib files in the old directory lib folder and put them in the new Qt directory

  lib -> win32/x64 folder.

Go to the plugins win32/x64 folder in the new Qt directory and create a new folder named imageformats.

In the plugin -> imageformats folder in the old directory, copy all files expect the .exp and .ilk files. Paste these in the plugins -> win32/x64 -> imageformats located in the new Qt directory.

Qt is now ready to run with Visual Studio.