2007-11-12

Customization: Custom Visual C++ Wizard - Part II

In the previous part of the series, I explained what I don't like about the default VC++ Project wizard. I also defined how those things should be fixed. So, by now, we have some requirements defined for our final wizard project. Let's continue planning our wizard.

So, what kind of projects we will be making with this wizard? Well, the most basic option should be there to simply create the Solution. When creating solution, it should also create directory for the source code, and add the common headers there. Now, we are facing the first problem. Visual C++ Express Edition doesn't support Solution Directories (or solution files), which means, that we either have to create a dummy project that would contain those headers, or we will not see those files in Solution Explorer window. Personally, I prefer the first option. So, our empty solution will not really be an empty solution - it will have a dummy project (I'll call it "Solution Project") and this project will contain a few header files.

What else? Well, as I mentioned in the first part - I like to have all my projects as a set of libraries, so the next obvious project type we'd want to generate is a Library. There are a three kinds of libraries I will want to generate. The only difference in those three will be the output file it generates. Now, if you remember the first part - I said I want four configurations (Debug Static, Debug Shared, Release Static and Release Shared). Basically, each configuration name describes perfectly, which C/C++ runtime the configuration will link to. I hope I don't have to explain, why linking to the same version of runtime is important across all projects in the solution... So, the three library kinds will be: Static Library, Shared Library and Mixed Library. You are probably wondering what the heck are those. Well, let me explain. In Static Library project, all four configurations will generate a static library (LIB file). In Shared Library project all configurations will generate a shared library (DLL file). In Mixed Library project, however, the both Static configurations will generate static, and the Shared configurations - shared library. In addition, when creating a Library project, I might want to create a Unit Test project for it too. Now, I know that not everyone likes to write unit tests, but I do, so I'll need this option.

Finally, the last kind of project is an Application. I can think of two application types - Console Application and Windows Application. I think those are obvious.

So what else can we plan? In the first part, I described what the directory structure should look like, but I didn't discuss naming issues. You see, when creating directories or naming files - there are a few things to be careful with. There are all kinds of special characters that you can not use in those names. Also, it is a bad idea in general to use paths with spaces in projects. So, whatever I enter as a project or solution name - it might not be possible to use them as the directory names and solution/project file names. So, the wizard could generate safe names for us. It could generate them, but it could also let us edit those names just in case we want that. Also, if I'm creating a library called "PM's Standard Library" I don't really want to include headers from that library by prefixing "pm_s_standard_library/". So, we will also need an abbreviated solution/project name.

Having discussed all that, I think it's time to start designing the pages of our wizard. However, that's the thing we will talk about in the next part of this article series. Stay tuned! ;)

No comments: