CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    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:-

    Code:
    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
    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.

    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?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    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.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured