如何在没有官方支持的情况下使用 Visual Studio 2015 构建 Qt 4.8.6? [英] How to build Qt 4.8.6 with Visual Studio 2015 without official support?

查看:27
本文介绍了如何在没有官方支持的情况下使用 Visual Studio 2015 构建 Qt 4.8.6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前(2015 年 9 月)没有针对 Visual Studio 2015 的官方 Qt 构建.如何手动构建?

解决方案

它可以很容易地手动构建.以下示例适用于 Qt 4.8.6.

  1. 下载 Qt 4.8.6 源代码:

  2. 编辑{prefix dir}/qmake/目录下的makefile.win32文件:找到所有出现的 win32-msvc2013 并类似地添加 win32-msvc2015:

  3. 现在从 Visual Studio 2015 命令提示符

    运行(这些是示例命令,附加命令可能会根据构建需要而有所不同):

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

    选项 -make nmake需要,因为configure.exe默认搜索nmake的最大版本vs 2013,否则使用make.

  4. 然后是单核构建命令

    nmake

    (或 jom.exe -jN,其中 N <= CPU 内核数).

    仅此而已.这个示例没有 Webkit、示例和演示 - 为了速度.对我来说,在单核上构建需要大约 1.5 个小时.

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

解决方案

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-20154.8.6msvc2015. 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-20154.8.6msvc2015 -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.

这篇关于如何在没有官方支持的情况下使用 Visual Studio 2015 构建 Qt 4.8.6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆