开发者

Dealing with the huge number of Boost header files

Is there a way to drastically reduce the number of he开发者_如何学Pythonader files needed for Boost?

Ideally, I'm asking the Boost folks to find a way to make their product smaller. But in the meantime, is there a way to include Boost, but not have several thousand header files to deal with?

Is there a C++ mechanism to "bundle" thousands of header files into a single "package" and just check that single file into source control?

I guess the problem here is source control Doing a diff, svn status and svn checkout is so slow with all these files to deal with.


Boost offers a tool called BCP. BCP allows you to extract subsets of Boost.

It can also analyze your source tree and extract only the Boost components that your source tree is using.


I'd recommend putting your third-party libraries in a separate repository. Boost is template heavy, so there is a pretty good reason for them not to bundle their headers. Trying to include bundled Boost headers would move your "wasted" time from version control into your build times. That doesn't really scale. I would refuse to use Boost if you tried to do that to my Boost headers.


ccache can be a life saver for speeding up preprocessor heavy compilations.


There's no way to package all in one file (except versioning an archive, but it's not great practice nor practical at all). On a side note, Subversion is known to be slow at checking out thousands of small files such as Boost headers, so maybe you can consider switching to a higher-performance SCM like Git.

You'll be interested in BCP, a Boost tool that analyzes your source and copies the Boost headers you use into a separate directory. This helped a lot to reduce third-party files and was mostly right in my case (I just had to add a few ones to the list).


Not what you asked, but here's a way to fix you problem. As I understand it, you are adding the Boost files to your code control repository. Why? They are not part of your project per se; they are not under your control.

Here's how I structure my projects such that I don't run into that kind of problem. Everything is added to source control, except the include and lib folders, as mentioned below. (I only show the relevant parts of my directory tree.)

  • /
    • src — includes my own source files and headers
    • ext — external dependencies (such as boost)
      • boost-1-46-1
        • Download.txt — includes link where you can download the correct version from
        • include — this is not added to source control
        • lib — this neither
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜