Since VS requires all C++ libraries to be compiled with the same version, this is a complicated one. To get everything out of Qt, we need to compile openssl and icu ourselves, all with the WinXP SDK. Let’s start.
For this, I have a folder C:\Qt where all I need is installed (python, perl, icu, ruby and jom). I uncompress Qt as C:\Qt\qt-5.3.2-src, I will build from C:\Qt\qt-5.3.2-build and install in C:\Qt\qt-5.3.2. Adjust all paths to your convenience, if you want both a 32 bits and 64 bits builds, you’ll need a different build and install folder (like C:\Qt\qt-5.3.2-buildx64 and C:\Qt\qt-5.3.2-x64).
First, open the VS2013 Command Promt, 32 or 64 bits depending on which you want to build.
Set SDK for WinXP (Note: there is a Bin64 and Lib64 for 64 bits builds, shown here are the paths for a 32 bits build).
> set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
> set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
> set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
> set CL=/D_USING_V110_SDK71_
Then, you need icu and you need cygwin to build icu. So from the VS2013 cmd-line, add cygwin and compile icu:
> set PATH=%PATH%;C:\cygwin64\bin;
> cd icu-src
> bash ./runConfigureICU Cygwin/MSVC --prefix=C:/Qt/icu
> make
> make install
Note: I’m installing icu in C:/Qt/icu, if you do both 32 and 64 bits build you’ll need to install in 2 different folders (like icu32 and icu64).
Now, remove cygwin from path:
> set PATH=%PATH:C:\cygwin64\bin;=%
Need perl, python and ruby, just install them. Make sure they’re in your PATH.
> set PATH=C:\Qt\Perl64\bin;%PATH%
> set PATH=C:\Qt\Python27;%PATH%
> set PATH=C:\Qt\Ruby193\bin;%PATH%
Need openssl, to compile it:
> cd openssl-src-folder
> perl Configure VC-WIN32 no-asm --prefix=C:\Qt\openssl
> ms\do_ms
> nmake -f ms\ntdll.mak
> nmake -f ms\ntdll.mak install
> set INCLUDE=C:\Qt\openssl\include;%INCLUDE%
Note: I install openssl in C:\Qt\openssl, like for icu, take care of not mixing 32 and 64 bits builds.
Need icu’s include, bin and lib (or bin64, lib64 if a 64 bit build).
> set PATH=C:\Qt\icu\bin;%PATH%
> set PATH=C:\Qt\icu\lib;%PATH%
> set INCLUDE=C:\Qt\icu\include;%INCLUDE%
> set LIB=C:\Qt\icu\lib;%LIB%
Add some qt tools:
> set PATH=C:\Qt\qt-5.3.2-src\gnuwin32\bin;%PATH%
Configure and compile:
> cd C:\Qt\qt-5.3.2-build
> ..\qt-5.3.2-src\configure.bat -icu -debug-and-release -nomake examples -prefix c:\Qt\qt-5.3.2 -platform win32-msvc2013 -force-debug-info -target xp
> jom
> jom install
> jom generate_docs
> jom qch_docs
> jom install_qch_docs
Note: -target xp will make an XP compatible build, -force-debug-info will give us .pdb files even for the release dlls.
Done!
The resulting Qt 5.3.2 can be deployed on Windows XP or better.