Fun with Visual Studio 2010

March 18th, 2011

Last week the *first* service pack for Visual Studio 2010 (VC10) has been released.  This is exciting because now we can (finally) build a working x64 Qt with it!  The initial release of VC10 would create buggy x64 release binaries.

As a background task, we’re porting a large codebase from Visual Studio 2003 (VC7.1) to VC10 in order to create a x64 version.  Yes we could have used Visual Studio 2008, but we wanted to use the latest and greatest.

We’ll still build the x86 version using VC7.1, since we have customers who use Windows 2000.  Actually, the code base still supports Windows 98!

The actual VC7.1->VC10 work hasn’t been too bad.  We are using “/D_CRT_SECURE_NO_WARNINGS” to disable the warnings about the “_s” functions.  There were a handful of C++ classes that needed fixing to build, but nothing really bad so far.

The PITA for us has been getting the performance of the x86 versions to be as good as the VC7.1 x86 binaries.  To do this, we’ve needed to use profile guided optimization (PGO).  I don’t want to have multiple configurations within the project file, so we’re using a feature of MSBUILD to create the PGI binaries, run the profiling applications, then do the final build using PGO.

In our “rebuild.cmd” file we do something like this:

SET OPT_LINK=/property:OPT_LINK=/LTCG:PGI
msbuild /m /p:Configuration="Release";Platform=Win32 %OPT_LINK% Project.vc10.vcxproj
del *.pgc
del *.pgd
benchmark.exe
SET OPT_LINK=/property:OPT_LINK=/LTCG:PGO
msbuild /m /p:Configuration="Release";Platform=Win32 %OPT_LINK% Project.vc10.vcxproj

In the Project Settings: Linker->Command Line we have added: $(OPT_LINK).

So, the batch file will pass the PGI setting into MSBUILD to create the first binary.  Run the benchmark to generate the .pgc files, then do the final build.

I view this as a much better solution than having separate targets for Release/PGI/PGO.

Entry Filed under: Uncategorized

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

March 2011
M T W T F S S
« Jan   May »
 123456
78910111213
14151617181920
21222324252627
28293031  

Most Recent Posts