IDE Project capacity problem
I'm building a library called gtkmm (using MSVC). For anyone who doesn't know gtkmm, along with its counterparts (such as glibmm) it's a bit like a cross-platform version of MFC.
Anyone who does know gtkmm will know that most of its source files get auto-generated at compile time. I don't quite understand the reasoning behind this but it's a common practice when building cross-platform libraries. Maybe it permits each source file to be customized, according to the target OS. I don't know. The key thing is that a LOT of files get auto-generated. A typical line for auto-generating one specific file set might look something like this:-
Currently I add that line to MSVC's 'Pre-build Events' and it results in two files getting generated:- accelgroup.cc and accelgroup.h. So far, so good.
perl -I$(GlibmmBuildRootFolder)/tools/pm $(GlibmmBuildRootFolder)/tools/gmmproc -I ../../tools/m4 -I $(GlibmmBuildRootFolder)/tools/m4 -I $(AtkmmBuildRootFolder)/codegen/m4 -I $(PangommBuildRootFolder)/tools/m4 --defs . accelgroup . ../gtkmm
The problem is that there are literally hundreds of such lines for the whole project. Each line gets executed as an individual command but I can only add around 80 of them to my Pre-build Events. After that, the dialog window simply won't accept any more. Presumably another case of somebody at Microsoft deciding that 80 commands should be enough for anybody... :(
Can anyone suggest a way to increase the capacity? I thought of two things:- (1) move everything into an external file and simply run the external file. (2) Create some sub-projects that need to get built as dependencies of my main project (i.e. the sub-projects would each handle 80 commands of their own). Option 2 might be the best approach because as things stand, MSVC's output window gives me some feedback so I can see if any of the commands fails. I'm not sure if that would still happen if I delegated building to a separate file.
I just wondered if anyone's got any further suggestions? For example would a custom build step help here? I'm not sure if custom build steps are similarly restricted. Nor do I know where they get executed. I'd need the step to get executed before any compilation begins. Any ideas anyone?
Re: IDE Project capacity problem
One idea that's been suggested to me is a Custom Build Rule (as distinct from a Custom Build Step). Has anyone here used Custom Build Rules? That article specifically mentions using them for auto-generating source files (which is exactly what I need) and for associating rules with specific file types (which is also what I need). But although it shows the initial steps for creating a Custom Build Rule it doesn't seem to give much advice about how to make one that actually does something. :cry:
Re: IDE Project capacity problem
Ideally you would want to have a custom build step for the inputfiles that serve as a base for the generated .h and .cc files.
I assume there will be some sort of templatefile, script, database or something that holds the code for the accelgroup files.
So you'd add that file to the project, add the custom build steps, and define the .h and .cpp as ooutputs.
That way, when the inputfile changes, the compiler knows it needs to regenerate the headers and source. And it doesn't need to regenerate the sources nor do those generated sources need to be recompiled.
Custom build rules are an extention to the above, it's a generic way to take a file with a certain extention, and build it into some other files. You wouldn't normally go down this road unless this is a type of build step you have a lot in your projects, there's quite a bit of work involved behind creating custom build rules.
If that's unfeasible for some reason. The next best thing would be to add everything in a single prebuild step. If you're limited to 80 lines... Store everything in a batchfile/commandfile/scriptfile/makefile. and call that. I'm not sure there is an actual limit, I have projects with build steps that have 200ish lines.