Boost is a very large library with many inter-dependencies -- which also takes a long time to compile (which for me slows down our CruiseControl response time).
The only parts of boost I use are boost::regex and boost::format.
Is there an easy way to extract only the parts of boost necessary for a particular boost sub-library to make compilations faster?
EDIT: To answer the question about why we're re-building boost...
- Parsing the boost header files still takes a long time. I suspect if we could extract only what we need, parsing would happen faster too.
- Our CruiseControl setup builds everything from scratch. This also makes it easier if we update the version of boost we're using. But I will investigate to see if we can change our build process to see if our build machine can build boost when changes occur and commit those changes to SVN. (My company has a policy that everything that goes out the door must be built on the "build machine".)
-
Unless you are patching the boost libraries themselves, there is no reason to recompile it every time you do a build.
From postfuturist -
First, you can use the bcp tool (can be found in the tools subfolder) to extract the headers and files you are using. This won't help with compile times, though. Second, you don't have to rebuild Boost every time. Just pre-build the lib files once and at every version change, and copy the "stage" folder at build time.
From vividos -
Precompiled headers are the word of the day! Include the boost headers you need in your precompiled header - tada!
From 1800 INFORMATION -
We're using Boost, but we only include object files for those types that we actually use. I.e., we build our own static library with a bunch of home-grown utilities and include those parts of Boost that we find useful. Our
CMakeLists.txt
looks something like this (you should be able to load this in CMake, if you adjust SOURCES accordingly.)project( MyBoost ) set(SOURCES boost/regex/src/c_regex_traits.cpp boost/regex/src/cpp_regex_traits.cpp boost/regex/src/cregex.cpp boost/regex/src/fileiter.cpp boost/regex/src/icu.cpp boost/regex/src/instances.cpp boost/regex/src/posix_api.cpp boost/regex/src/regex.cpp boost/regex/src/regex_debug.cpp boost/regex/src/regex_raw_buffer.cpp boost/regex/src/regex_traits_defaults.cpp boost/regex/src/static_mutex.cpp boost/regex/src/usinstances.cpp boost/regex/src/w32_regex_traits.cpp boost/regex/src/wc_regex_traits.cpp boost/regex/src/wide_posix_api.cpp boost/regex/src/winstances.cpp ) add_library( MyBoost STATIC ${SOURCES})
From JesperE
0 comments:
Post a Comment