问题
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!
回答1:
For just the smart pointer library, you have two options.
- 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). - 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).
回答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.
来源:https://stackoverflow.com/questions/2512823/how-to-include-only-boost-smart-pointer-codes-into-a-project