views:

778

answers:

2

I can find tons of general purpose documentation on Boost.Build, but surprisingly nothing on how to use it to build simple Boost applications.

I compiled Boost for mingw with bjam, got all the libraries and includes in C:\Boost. Now what would a basic Jamroot file look like to use all this ?

The libs all have complicated names like 'libboost_filesystem-mgw34-mt-s.lib', I'm sure there is some kind of magic switch somewhere to just say 'link against libboost_filesystem' !

+1  A: 

It's not necessary in any way to use bjam in order to build code that works with boost.

Thus, use gmake, or batch scripts, or an IDE, or whatever you like. bjam is one of the harder choices as like you've found, the documentation is poor.

There is a very basic tutorial at:

http://www.boost.org/doc/libs/1_39_0/more/getting_started/unix-variants.html

or

http://www.boost.org/doc/libs/1_39_0/more/getting_started/windows.html

Macker
Yes I ended up using a makefile, I just thought bjam had some kind of shortcuts for boost, but apparently it hasn't.
Luper Rouch
+1  A: 

Of course there are shortcuts! An example project could look like:

#jamfile - an example Boost.Build project
exe my_exe : [ glob *.cpp ] /boost//filesystem ;

Making an executable from all .cpp files in the project's directory and using Boost.Filesystem. Then you don't need to build any of boost libraries manually, bjam will take care of that itself as necessary. That will also ensure your app always links with the boost libraries compiled with the right options. There is some initial configuration effort to be done to prepare an environment for using Boost.Build, such as creating a user-config.jam, a boost-build.jam and a jamroot for convenience (having e.g. use-project /boost : /path/to/boost statement). But that's a one-time effort and after that things are much easier than before. http://www.boost.org/boost-build2/doc/html/index.html

usta