Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dealing with the huge number of Boost header files

Is there a way to drastically reduce the number of header 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.

like image 684
101010 Avatar asked Jul 26 '11 16:07

101010


People also ask

Why is Boost so large?

Since Boost is a bunch of templates, it causes a bunch of member functions to be compiled per type used. If you use boost with n types, the member functions are defined (by C++ templates) n times, one for each type.

Where are Boost header files?

5.1 Easy Build and Install will leave Boost binaries in the lib/ subdirectory of your installation prefix. You will also find a copy of the Boost headers in the include/ subdirectory of the installation prefix, so you can henceforth use that directory as an #include path in place of the Boost root directory.

Is Boost header-only library?

Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking. The only Boost libraries that must be built separately are: Boost.

Is Boost backwards compatible?

Many of the Boost libraries are actively maintained and improved, so backward compatibility with prior version isn't always possible.


3 Answers

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.

like image 70
ppl Avatar answered Oct 23 '22 22:10

ppl


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.

like image 2
Tom Kerr Avatar answered Oct 23 '22 22:10

Tom Kerr


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

like image 1
Sam Miller Avatar answered Oct 23 '22 23:10

Sam Miller