3

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?

Brian Tompsett - 汤莱恩
  • 5,195
  • 62
  • 50
  • 120
uj2
  • 2,095
  • 2
  • 20
  • 30

2 Answers2

4

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

KitsuneYMG
  • 12,247
  • 3
  • 35
  • 57
  • Whew, at least compilers agree on preprocessor implementation. – Anycorn Jan 25 '11 at 19:14
  • Your test is flawed. In front of each match it prints, grep will print the name of the file it found the match in. That will include "preprocessor" from the file-name prefix. Use the `-h` option to omit that. – Rob Kennedy Jan 25 '11 at 20:36
  • On ubuntu this worked for me `mkdir pp; bcp preprocessor --boost=/usr/include/ pp/` – benathon Sep 23 '14 at 23:13
0

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

nos
  • 207,058
  • 53
  • 381
  • 474
  • 7
    This still doesn't mean it doesn't have dependencies on other (header-only) parts of boost. – uj2 Jan 25 '11 at 19:15