5

What are best practices to include boost smart pointer library only without adding all boost libraries into the project?

I only want boost smart pointer library in my project and I don't want to check in/commit 200 MB source codes (boost 1.42.0) into my project repository just for that. What more, my windows mobile project itself doesn't even reach 10% of that size!

Afriza N. Arief
  • 7,696
  • 5
  • 47
  • 74
  • 1
    Do you need Boost to be under source control at all? – jalf Mar 25 '10 at 03:54
  • I am the first in the team to use boost and everyone are not that familiar yet with boost. If I commit something that doesn't compile out of the box (lack of dependencies), that would be troublesome for them. – Afriza N. Arief Mar 25 '10 at 04:48
  • 1
    I think usually, you would have people setup Boost on their boxes. That is, treat it like the standard library. Then there's no need to commit, plus now it's always around. – GManNickG Mar 25 '10 at 08:05
  • @GMan: That would be great once everyone in the team get used to boost. – Afriza N. Arief Mar 25 '10 at 09:40

2 Answers2

16

For just the smart pointer library, you have two options.

  1. Copy the headers you include in your source files (shared_ptr.hpp, etc.). Then copy over additional files until the project builds (make sure to maintain the directory structure).
  2. Use the boost bcp utility. For larger subsets, this tool saves a ton of time.

The former will make sure the fewest number of files possible gets added your project. The latter is much faster for any substantial subset of boost, but it will likely include many files you don't need (compatibility headers for platforms your program doesn't support).

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
2

Just check in the folder containing the code you want? Try deleting/moving/renaming "everything else" and see what external dependencies the smart pointer library has, probably not many. I'm almost positive it doesn't require any built code (i.e. libraries), so just checking in all of the headers that get included seems like the way to go.

dash-tom-bang
  • 17,383
  • 5
  • 46
  • 62
  • It certainly gives the minimum amount of files to be included. I started by adding 1 file, , and I keep adding all dependency files one by one until 36 files were added (139 KB). For comparison, bcp shared_ptr gives me 152 files (481 KB). – Afriza N. Arief Mar 25 '10 at 08:09