Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Visual Studio 2012 RC Compiler for Qt instead of MinGW?

Windows 8 x86; Qt 4.8.2; Visual Studio Ultimate 2012 RC

like image 753
das_j Avatar asked Jun 02 '12 15:06

das_j


1 Answers

As far as I know Qt does not yet support Visual Studio 2012 RC. However, I managed to build Qt 4.8 with Visual Studio 2011 beta (the predecessor to Visual Studio 2012 RC - they just decided to rename it) myself. It required making some changes to Qt source code before compiling. Here are the steps I used:

  • Copy mkspecs/win32-msvc2010 to mkspecs/win32-msvc2012 and edit the qmake.conf file to specify _MSC_VER=1700.
  • Search for “msvc2010” in all files in the extracted directory and patch the ~10 places to also understand “msvc2012”
  • In a Visual Studio command shell, cd to tools/configure, run a previous version of qmake (which you need to already have), and then run nmake to update your configure.exe.
  • Search for “make_pair<” in all files and remove the template arguments.
    • This may not be required in VS 2012; in VS 2011-beta I got compile errors with make_pair when template arguments were specified.
  • In src\3rdparty\javascriptcore\JavaScriptCore\runtime\Structure.{h,cpp} change the make_pair calls to explicit JSC::StructureTransitionTableHash::Key constructor calls.
  • Edit src\3rdparty\clucene\src\CLucene\config\define_std.h to comment out _CL_HAVE_HASH_MAP and _CL_HAVE_HASH_SET
  • In a Visual Studio command shell, run the configure program that is installed with the source, e.g.: configure.exe -debug-and-release -platform win32-msvc2012 -opensource
    • [Optionally] add '-nomake demos -nomake examples' to the command line to save build time, and/or '-mp' to build in parallel
  • When the configure is complete, type nmake to start the build. This will build debug and release versions of all the libraries as well as release versions of all the tools (designer, etc.).

It took a little work but it worked for me and I now have dozens of Qt applications up and running, so I figured I'd share with anyone else who wants to build Qt 4.8.x on Visual Studio 11 (Visual Studio 2011 beta or Visual Studio 2012 RC.)

If this seems too complicated, just wait a bit; I'm sure Qt will support Visual Studio 2012 soon.

like image 163
Conrad Poelman Avatar answered Oct 10 '22 02:10

Conrad Poelman