I usually avoid writing articles about building a specific version of a software project but this time I need to archive I T for later use and I believe it's useful to my fellow programmers.
Despite it ' s been released for a while already, it seems the Qt project won ' t release binaries prebuilt with Visual Studio Until Qt 5.6 is out. That's to say, somewhere between today and say January, (blind guess). At work, we ' re transitioning from Visual Studio to Visual Studio and some projects depend on Qt. That's why I decided to bite the bullet.
I have to say that I found Qt's official building from source instructions rather vague. Let the treasure hunt begin.
I first stumbled upon the QT for windows-building from Source page which itself links to the QT for Windows-requiremen TS page. The requirements page mentions the ICU and ANGLE libraries. ICU is needed when building qtwekbit and ANGLE are what Qt uses by default for its official Windows builds. To build ANGLE, the requirements page implies you has to install the Direct X SDK. Don ' t panic if you don't find the download for that Sdk:it's been a long time since that SDK ships as part of the Windows SDK itself, which you install along with Visual Studio 2015.
At the point, I felt alone but that didn ' t the last long. I joined on #qt
Freenode and asked around. Someone mentioned thebuilding QT 5 from Git page on Qt's wiki which indirectly points to the compiling ICU with MSVC page.
I decided to go with icu4c version 54.1 as instructed in the wiki page. However, this version needs to being patched in order-to-build with Visual Studio 2015:i opened on line and source/io/ufile.c
66
REPL aced:
#if U_PLATFORM_USES_ONLY_WIN32_API
By
#if U_PLATFORM_USES_ONLY_WIN32_API && _MSC_VER < 1900
Then, I proceeded with building ICU as explained in Qt ' s wiki.
As for ANGLE, it turns out Qt bundles its own version and there's nothing to do. Qt ' s configure
script would just detect and use it.
Qtwebkit now. The Building Qt 5 from Git page tricks to visiting the official build instructions for the Qtwebkit build on Windows Page on Webkit ' s wiki. Just don ' t go there. It ' s just adding more confusion. You don ' t has to build qtwebkit yourself, it's going to being built as part of Qt's build provided you installed the proper Prerequisites.
Before proceeding with building Qt (with Qtwebkit), all you need are to do are installing the following tools (listed on the Building Qt 5 from Git page):
- Active Python 2.7 or later
- Perl
- Ruby
Those tools %PATH%
has the to is in your environment variable as well as Qt ' s gnuwin32\bin
directory which provides bison
, and flex
c5/>.
I decided to install Active Python 2.7, Strawberry Perl 5.22.0.1 (a) and Rubyinstaller 2.2.3 (x64).
Finally, Qt 5.5.1 ' s source drop shipped with a bug that despite have been opened against RC1 was resolved as "works on O ur machines, ship it! ":D Hopefully, resolution is quite easy, I just patched src/3rdparty/assimp/assimp.pri
.
After all those steps, I successfully built Qt 5.5.1 with Qtwebkit with Visual Studio 2015. To help you out, I prepared Windows batch files: and build-x64.bat
build-x86.bat
. Create a directory somewhere on your computer and make sure your come up with the following directory structure:
.├── build-x64.bat├── build-x86.bat├── icu│ └── source│ ├── ...│ └── configure└── qt-everywhere-opensource-src-5.5.1 ├── ... └── configure
Finally, open a CMD.exe
prompt, to the cd
directory containing the .bat
files and launch either build-x64.bat
orbuild-x86.bat
Hope that helps!
Http://files.cnblogs.com/files/findumars/qt5.51_webkit_build.rar
http://pempek.net/articles/2015/10/18/compiling-qt-5-5-1-with-visual-studio-2015/
Compiling Qt 5.5.1 (with Qtwebkit) with Visual Studio 2015