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

前端 未结 1 2005
耶瑟儿~
耶瑟儿~ 2020-12-09 04:11

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

相关标签:
1条回答
  • 2020-12-09 04:24

    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:

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

    5. Now from the Visual Studio 2015 command prompt

      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.

    0 讨论(0)
提交回复
热议问题