views:

281

answers:

2

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!

+2  A: 

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
It certainly gives the minimum amount of files to be included. I started by adding 1 file, <boost/shared_ptr.hpp>, 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
+7  A: 

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).

280Z28
First time I hear about bcp. +1.
BennyG
nice. perhaps I can use bcp first, then reduce it again manually. no 2, then no 1.
afriza