Tuesday, November 11, 2008

MS VC++6.0 Custom Build anyone?

Have you ever been fiddling around with custom build steps in Microsoft Visual Studio?
Lots of people find them totally usefull. Others think they are merely another lock-in for Microsoft customers.

Custom build rules are THE solution for integrating compiling of legacy source codes such as assemblers, image generators, scripting engines and legacy tools (for example for md5 computing) and so on in one single project (Microsoft's dev env, that is). They are fast, but not straightforward. Well, they ARE actually in VS2005, but not in VC++ 6.0..Don't ask.

Custom build rules are expressed with batch script. Or so it seems. So far, so good you say, if it wouldnt be for only one problem, and that is : it uses obscure macros in practically all configurations. Well, the names of the macros help you alot with understanding the meaning of each of them of course (for an example $(InputDir)), but still relying on your immagination isn't always a correct thing to do.
Echoing them out with a plain batch "echo" doesnt seem to be working as it shows up nothing (at least not by compiling the file in the environment itself), and I am too lazy to try it on the stdout / stderr.

Got an idea since they are project-dependent they probably are stored in the project configuration files. If you open the .dsp file with an editor, you will find them defined there - well, most of them.
But where / how are they defined? And when? How can we change them?

A quick google on them shows up no satisfactory result. It's probably a too old topic, or I am just blind and don't see it.

This article from MS shows a complete list of the macros. Took some time to find it ;).

Here is a brief list of them :

Label Macro Description
Intermediate $(IntDir) Path to the directory specified for intermediate files, relative to the project directory.
Output $(OutDir) Path to the directory specified for output files, relative to the project directory.
Target $(TargetDir) Fully qualified path to the directory specified to output files.
Input $(InputDir) Relative path to the project directory.
Project $(ProjDir) Fully qualified path to the project directory.
Workspace $(WkspDir) Fully qualified path to the project directory.
Microsoft Developer $(MSDevDir) Fully qualified path to the installation directory for Microsoft Visual C++.
Remote Target $(RemoteDir) Fully qualified path to the remote output file.
Target Path $(TargetPath) Fully qualified name for the project output file.
Target Name $(TargetName) Base name for the output file.
Input Path $(InputPath) Fully qualified name for the input file.
Input Name $(InputName) Base name for the input file.
Workspace Name $(WkspName) Name of the project workspace.
Remote Target Path $(RemoteTargetPath) Fully qualified name for the remote output file.

No comments: