Wednesday, February 15, 2012

Configuring Visual Studio 10 for building Boost and Qt

Let's say you work for a company that tapes your fingers together with duct tape before you can write any code. How do you build Boost or Qt without being able to configure a command prompt with the correct Visual Studio environment variables when you can't run that silly commandline registry query tool "reg query ..."?

Answer: You must create the environment variables yourself in your own batch file.

Here is an example:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\Kevin\Perl\perl\bin;c:\Kevin\Qt\4.8.0.bin
set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 10.0\
set VC100COMNTOOLS=%VSINSTALLDIR%Common7\Tools\
set WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v7.0A\
set VCINSTALLDIR=%VSINSTALLDIR%VC\
set INCLUDE=%VCINSTALLDIR%Include;%WindowsSdkDir%Include
set LIB=%VCINSTALLDIR%Lib;%WindowsSdkDir%Lib
set PATH=%VCINSTALLDIR%bin;%VSINSTALLDIR%Common7\IDE;%WindowsSdkDir%bin;%PATH%


Note: Perl is necessary to build Qt and was downloaded as a .zip file from Strawberry Perl and unpacked into the folder as shown (unpacking the zip file and running perl.exe doesn't require admin-level install privileges).

Now you can build Boost via 'bootstrap.bat' and Qt via 'configure.exe'