I was under the impression that the boost bcp, with the namespace option, was meant to rename the includes and defines for any listed modules. Upon running the tool and examining the output, it doesn't seem to do that. How am I to redistribute these if they still #include <boost/*>
and expect the end-user's #include <boost/*>
not to cause a version conflict? Does it just wrap these with namespace closures?
I used the following bcp command:
.\boost_1_53_0\dist\bin\bcp.exe --boost=boost_1_53_0 --namespace=myboost --namespace-alias smart_ptr filesystem array.hpp container move ptr_container algorithm/string.hpp tokenizer.hpp thread chrono atomic foreach.hpp build myboost
A quick grep of a file yeilds:
[boost]grep -e "boost/" algorithm\string.hpp
grep -e "boost/" algorithm\string.hpp
#include <boost/algorithm/string/std_containers_traits.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/find_iterator.hpp>
I am pretty certain that this is the use case for the bcp tool with the namespace options, however, I'm clearly misunderstanding some common C++ concept/usage, right? Or, perhaps, I am using the tool incorrectly?
Thanks in advance for any insight.
bcp --namespace=myboost --namespace-alias regex config build /foo
Copies the full regex lib (in libs/regex) plus the config lib (libs/config) and the build system (tools/build) to /foo including all the dependencies. Also renames the boost namespace to myboost and changes the filenames of binary libraries to begin with the prefix "myboost" rather than "boost". The --namespace-alias option makes namespace boost an alias of the new name.
Only binaries will be renamed (libboost_regex.so
will be libmyboost_regex.so
), not header files. Also, namespace boost
will be replaced with myboost
(and boost
will be alias to myboost
).
Like the name says, it renames the namespace and the library files (i.e. .dlls and .libs), but not the directories in wich the headers reside, and therefore not the includes.
The Boost libraries normally reside in namespace boost
. With bcp you changed that namespace to myboost
. So for example this code becomes valid:
#include <boost/sharedptr.hpp> //header directories haven't changed
myboost::shared_ptr<int> pi = myboost::make_shared<int>(5); //but the namespace has
Thanks to --namespace-alias
you can continue to use namesapce boost, since boost
has become an alias for myboost
:
boost::shared_ptr<int> pi; //ok, this is in fact a myboost::shared_ptr
See the examples in the documentation: http://www.boost.org/doc/libs/1_53_0/tools/bcp/doc/html/index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With