Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build Qt 4.8.6 with Visual Studio 2015 without official support?

At this time (September 2015) there is no official Qt build for Visual Studio 2015. How to build it manually?

like image 564
trig-ger Avatar asked Sep 29 '15 16:09

trig-ger


1 Answers

It can be built manually quite easily. The example below is for Qt 4.8.6.

  1. Download Qt 4.8.6 sources: http://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.zip and unpack. Let the Qt prefix be c:\Qt-2015\4.8.6\msvc2015. Copy sources inside the downloaded source dir to {prefix dir}.

  2. Apply the patch 02-fix_build_with_msvc2015-45e8f4ee.diff https://drive.google.com/file/d/0Bz6Oefew6XZnOU9ac0hIeG41UVE/view?usp=sharing see post: https://forum.qt.io/topic/56453/compiling-qt4-head-with-msvc-2015-cstdint-errors/5 to get rid of compilation errors (I applied all changes by hand, it's not so long).

  3. Make new win32-msvc2015 spec in mkspecs directory: create win32-msvc2015 directory, copy the contents of win32-msvc2013 dir, edit qmake.conf: set _MSC_VER to 1900 and update all text from 2013 to 2015 where appropriate:

    enter image description here

  4. Edit makefile.win32 file in {prefix dir}/qmake/ directory: find all win32-msvc2013 occurences and add win32-msvc2015 similarly:

    enter image description here

    enter image description here

  5. Now from the Visual Studio 2015 command prompt

    enter image description here

    run (these are the example commands, additional commands may be different depending on the build needs):

    configure -make nmake -platform win32-msvc2015 -prefix c:\Qt-2015\4.8.6\msvc2015 -opensource -confirm-license -opengl desktop -nomake examples -nomake tests

    Option -make nmake is need because configure.exe searches max version vs 2013 of nmake by default, otherwise it uses make.

  6. Then for single core build command

    nmake

    (or jom.exe -jN, where N <= number of CPU cores).

    That's all. This example is without Webkit, examples and demos - for speed. For me it takes ~1.5 hours to build on the single core.

like image 179
trig-ger Avatar answered Sep 22 '22 18:09

trig-ger