Static building of QTScrobbler using MSVC.


Prerequisites:

If you don't already have a version of Visual Studio installed, the free Express version can be downloaded from: http://www.microsoft.com/express/vc/
Also required (for QT and libcurl) is the Platform SDK.


Building QT

The first stage is to download and compile Trolltechs QT framework.  Download the Windows Open Source edition (src zip file) from:
http://trolltech.com/developer/downloads/qt/windows
and extract this out, i.e. "C:\QT\4.4.0-static".  This location will become the final installation place for QT.

Next, edit the QT mkspec for your version of Visual Studio, i.e. mkspecs\win32-msvc2008\qmake.conf
Change the following lines from:

QMAKE_CFLAGS_RELEASE	= -O2 -MD
QMAKE_CFLAGS_DEBUG	= -Zi -MDd

to:

QMAKE_CFLAGS_RELEASE	= -O2 -MT
QMAKE_CFLAGS_DEBUG	= -Zi -MTd

This statically compiles the MSVC runtime library into QT, removing the need for it to be installed when QT is distributed to end users.

Launch the "Visual Studio Command Prompt" and cd to the extracted QT source folder.  Run configure for your version of MSVC, i.e.:

configure -static -debug-and-release -platform win32-msvc2008

Once the configure stage has finished, complete the QT build process by running "nmake sub-src" (the sub-src option skips the building of the examples and demos, which can take several hours).

Create a new batch file within the QT bin folder (normally called qtvars.bat - adjust paths as needed)

###########
@echo off

@set QTDIR=C:\QT\4.4.0-static
@set PATH=C:\QT\4.4.0-static\bin;%PATH%
@set QMAKESPEC=win32-msvc2008

"C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
###########

and create a command prompt shortcut link, i.e. "%COMSPEC% /k "C:\QT\4.4.0-static\bin\qtvars.bat"


Building libcurl

Download the cURL sourcecode from http://curl.haxx.se/download.html, launch the lib\curllib.vcproj file with MSVC, and change the active configuration to Release.  Under the project Property Pages, change the C/C++ -> Code Generation -> Runtime Library from DLL to static (i.e. MD to MT or MDd to MTd).
Under C/C++ -> Preprocessor -> Preprocessor Definitions add "HTTP_ONLY" and "USE_WINDOWS_SSPI".  NTLM proxy authenticaion requires that libcurl is built either with SSPI or SSL support.
Then build the library.


Building QTScrobbler

Create a folder named libcurl within the src\qt folder.  Into this copy curllib.lib from curls lib\release folder, and the entire include folder.
Use the command prompt shortcut created at the end of the QT stage, and navigate to the src\qt folder (where this file is located).  Run "qmake -t vcapp", and launch the MSVC qtscrob.vcproj file and compile (or run plain qmake followed by nmake).

