Game Development Reference
In-Depth Information
other programmers who need to grab your code and work with it. After all, it might
be tough to find an old version of something if your source code requires it.
One thing I
d suggest is to massage the output targets of third-party libraries and
SDKs, especially the PDB files that are used for debugging. Most third-party libraries
are pretty good at having directory structures that support a vast array of compiler
versions, operating systems, and platforms. They typically do this by naming their
LIB files using the library name, platform, and configuration. Some libraries, how-
ever, do not do that and keep exactly the same name no matter what platform or
build target is being used. This can cause all manner of confusion and make it diffi-
cult to debug a project where important PDB files from different libraries all have the
same name, causing one or more of them to be overwritten. In reorganizing the
source code for the fourth edition of this topic, I had to wrestle with this very prob-
lem, and I wanted a solution that minimized any changes to the build scripts of the
third-party libraries.
Here
'
s the solution I settled on to clean up this mess. First, I made sure that I only
changed the third-party builds to create PDB files that were named exactly the same
as the LIB file in question. BulletCollision.LIB would have a companion
BulletCollision.PDB. The default PDB filename in most Visual Studio build targets is
vc100.PDB, which can
'
'
t be used if another library is doing that too! Next, I created a
small batch file inside the 3rdParty directory to run through all the build targets and
platform-specific versions to copy them into a special Lib directory. Inside the Lib
directory, I created platform and configuration specific spots where all the 3rdParty
targets could live in harmony, without stepping on one another (see Figure 4.1).
One important suggestion I can give you: Don
t bother putting all the different LIB
files into the solution settings; instead, use #pragma comment (lib, “foo.lib”)
in the source files that will be needing them and surround the #pragmas with #if
defined blocks that can include the right LIB file for your target and platform. This
is a Microsoftian thing, I know, but it is convenient because you don
'
'
t have to sweat
over setting each build target and platform
s library dependencies. Keeping the proj-
ect build settings from diverging drastically can save you a ton of headaches down
the road.
'
Setting Visual Studio Build Options
I mentioned that you have to coax Visual Studio to move its intermediate and output
files outside the directory that stores the solution file. To do this, open your solution,
right-click the solution in your solution explorer, and select Properties. Click the
 
 
Search WWH ::




Custom Search