开发者

Why does bcp calculate such a large dependency list for Boost program_options?

I'm writing a small program using boost/program_options to handle options from command line. Now I want to distribute my code to systems where in general Boost is not installe开发者_开发技巧d. So I used the bcp utility. I tried it on the example from Boost called example/first.cpp from the program_options tutorial:

bcp --scan --boost=/users2/xxx/boost_1_45_0 ~/prova/first.cpp dest

It create a directory dest with tons of .hpp and .cpp files. I suppose this is what I need and no more. Is is right? Because:

du -hs dest
37M dest

Isn't 37M too much? For example I can do the same thing using Python with test_optparse.py with only 61KB.

Am I doing something wrong? The point is that my source program is only 4MB; I can't add 37MB of third party stuff!!


The Boost.Documentation has more explanations on this topic than I can provide. Most notably :

It should be noted that in practice bcp can produce a rather "fat" list of dependencies, reasons for this include:

[...]

  • When you include a header, bcp doesn't know what compiler you're using, so it follows all possible preprocessor paths. If you're distributing a subset of Boost with you're application then that is what you want to have happen in general.

The last point above can result in a substantial increase in the number of headers found compared to most peoples expectations. For example bcp finds 274 header dependencies for boost/shared_ptr.hpp: by running bcp in report mode we can see why all these headers have been found as dependencies

I suggest you try bcp --report and check the reason for inclusion of each files to see if it really is necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜