Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Qt 4.8.x for Visual Studio 2012

What steps should I take to compile Qt (version 4.8.x) for Visual Studio 2012?

I already carefully followed the instructions in the accepted answer of this question (which is for VS 2010), but WebKit module failed to compile (I'm not sure if the error message was logged anywhere during compilation).

I also saw this question which asks the same, but for VS 2012 RC (which is why I thought this wouldn't be a duplicate question). Furthermore, the answerer says he has compiled Qt for VS 2011 Beta, so there's a chance it may not work for VS 2012 (RTM). The compilation takes a lot of time, which is why I have not tried it yet.

At least one problem I realized is that there's no win32-msvc2012 directory in Qt\mkspecs. Should I just create that directory and copy the files from win32-msvc2010, possibly with some modifications?

Another sub-question is whether I should make some modifications to Qt sources before starting compilation.

like image 235
Smi Avatar asked Aug 24 '12 16:08

Smi


2 Answers

Qt 4.8.3 with Visual Studio 2012 x64 (should also work with 4.8.2)

  1. Install Strawberry Perl

  2. Download Qt 4.8.3 source code from http://qt-project.org/downloads

  3. Go to mkspecs\win32-msvc2010. Open qmake.conf and change:

    QMAKE_COMPILER_DEFINES  += _MSC_VER=1600 WIN32 

    to:

    QMAKE_COMPILER_DEFINES  += _MSC_VER=1700 WIN32 
  4. Replace qt-everywhere-opensource-src-4.8.3-x64\src\3rdparty\webkit\Source\JavaScriptCore\wtf\HashSet.h by this HashSet.h.

  5. Start "VS2012 x64 Native Tools Command Prompt"

  6. Switch to Qt 4.8.3 source directory (the directory that contains configure.exe)

  7. Run:

    configure -mp -opensource -nomake demos -nomake examples -platform win32-msvc2010 
  8. Followed by:

    nmake 

I programmed a tool called BlueGo which automatically downloads Qt 4.8.3 and builds it with VS2012 x64: http://bluego.vertexwahn.de (also works with VS2010 x64) (it just does what I described above automatically)

like image 182
Vertexwahn Avatar answered Oct 02 '22 00:10

Vertexwahn


Qt 4.8.4 needs less tweaking than described by Vertexwahn above.

  • The HashSet still has to be fixed (see fix of Vertexwahn) after Qt has been extracted from archive.
  • Platform win32-msvc2012 is supported out-of-the-box though (also works for 64bit in the 64bit environment, don't ask why they name it Win32).

So simply replace the HashSet.h and compile.

like image 26
cbielow Avatar answered Oct 01 '22 23:10

cbielow