Is Boost.Preprocessor self-contained?

1.2k views Asked by At

I'm thinking about using Boost.Preprocessor in some project, but I don't want to make the entire Boost library a dependency.

Can I just copy it alone and get away with this? Otherwise, what are its dependencies?

2

There are 2 answers

3
KitsuneYMG On

New Answer

I just got bcp working:

./bcp --list preprocessor --boost=/usr/local/include/boost_1_45_0/ | grep -v preprocessor

no errors detected

w/o the grep I get something like:

boost/preprocessor.hpp
boost/preprocessor/arithmetic.hpp
boost/preprocessor/arithmetic/add.hpp
boost/preprocessor/arithmetic/dec.hpp
boost/preprocessor/arithmetic/detail/div_base.hpp
boost/preprocessor/arithmetic/div.hpp
boost/preprocessor/arithmetic/inc.hpp
boost/preprocessor/arithmetic/mod.hpp
boost/preprocessor/arithmetic/mul.hpp
boost/preprocessor/arithmetic/sub.hpp


Original answer

Try using the boost bcp utility to copy it

I did a quick grep -R "include" /usr/include/boost/preprocessor/* | grep -v preprocessor and didn't come up with any matches. I could have sworn that config was needed.

Edit (my grep-ful is weak =/) grep -rh "include" /usr/include/boost/preprocessor/* | grep -v preprocessor | sort |uniq

# error BOOST_PP_ERROR: no indirect file to include
# include BOOST_PP_FILENAME_1
# include BOOST_PP_FILENAME_1
# include BOOST_PP_FILENAME_2
# include BOOST_PP_FILENAME_2
# include BOOST_PP_FILENAME_3
# include BOOST_PP_FILENAME_3
# include BOOST_PP_FILENAME_4
# include BOOST_PP_FILENAME_4
# include BOOST_PP_FILENAME_5
# include BOOST_PP_FILENAME_5
# include BOOST_PP_INDIRECT_SELF

grep -rhE "define\\s+BOOST_PP_FILENAME" /usr/include/boost/preprocessor/* | sort |uniq

# define BOOST_PP_FILENAME_1 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_1)
# define BOOST_PP_FILENAME_2 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_2)
# define BOOST_PP_FILENAME_3 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_3)
# define BOOST_PP_FILENAME_4 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_4)
# define BOOST_PP_FILENAME_5 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_5)

BOOST_PP_ITERATION_PARAMS_# don't seem to be #defined anywhere. Strangely enough, they are #undefed in ./detail/iter/forward#.hpp so I'm probably missing some nested macro or other...

1
nos On

As stated at http://www.boost.org/doc/libs/1_45_0/ , Preprocessor is a header only library. No run time library needed.