Compile Qt 5.5.0 for Visual Studio 2015 compatibility

From Qt Wiki
Jump to navigation Jump to search

The only thing needed to compile Qt's source code for 5.5.0 as Visual Studio 2015 on Windows is the following:

-Visual Studio 2015

-Pre-existing requirements

-Qt Source

-Changing your QMAKESPEC from win32-msvc2013 to win32-msvc2015

No special steps are needed in addition to these requirements. This specific part of the article will start by showing you how to build Qt from Source using the Qt 5.5.0 installer's source. If you've already installed Qt using the Windows installer, check your 5.5 folder and see if you have an Src folder side-by-side with msvc2013 / msvc2013_64 -- If you don't, change your installation by making sure to select Qt's Source.

Now, the fun part!

Open the Visual Studio Command Prompt -- you can find the one you're looking to use pretty quickly if you're on Windows 8.1/10 by doing a WindowsKey + S search and putting in VS2015 -- several options will appear. Choose the one that best suits your needs.

Enter the following lines into your command prompt, but edit them as-needed to ensure you're using the correct directories:

set QMAKESPEC=win32-msvc2015

set QTDIR=C:\Qt\Qt5.5.0\5.5\Src

set PATH=C:\Qt\Qt5.5.0\5.5\Src\qtbase\bin;%PATH%

cd %QTDIR%

After you've done that, it's time to choose your configuration for the kind of build you want to do. You can check out all of your options by entering configure -h

For the sake of this example, here's a pretty handy configuration for general purposes (Please note, if you do not have a multicore CPU, do not use the -mp parameter):

configure -mp -debug-and-release -platform win32-msvc2015 -qmake -opensource -c++11 -make libs

After accepting the appropriate license with the configuration successfully finished, just follow the console's instructions by entering nmake