migrationbuild-systemjambjam

What is Boost Jam and is Jam worth migrating to?


What is Boost Jam and is Jam worth migrating to?

I understand that jam is build system built by perforce however I am not sure how the boost jam & regular jam is different.

I'm also hoping there could be someone in the SO community who has worked with it and maybe can highlight some differences and/or benefits.


Solution

  • For my purposes, it's just the thing that builds the boost library for you, I wasn't aware you could do anything else with it so I don't understand what you could mean by migrating to it. And I'm sorry but I'm unaware what regular jam is. Since no one else has provided an answer I'll just provide my understanding of it.

    Boost is a collection of classes and functions for C++ are useful for various tasks. The classes and functions of boost are grouped into libraries. Some of the libraries have all their code in header files which you can use simply by using an #include preprocessor statement, while others (such as the filesystem or regular expressions library) have part of their implementation in .cpp files.

    Compiling these .cpp files can take ages (it's like 30 minutes depending on what you're compiling) and it would be a real pain if it took half an hour every time you wanted to recompile your program. So what they have done is only for those libraries that are partly stored in .cpp files, you can precompile them into a .lib file, and that's the purpose of boost jam. That means you only have to spend half an hour compiling them once, and from then on you never have to wait half an hour again.

    However, as you can imagine, each boost library consists of many cpp files and many header files, and there are many different flavours of each (debug versions, release versions, multi-threaded, etc) and so it is not a simple process to just compile the boost library yourself. That's where boost jam comes in. You give it the command to compile the libraries and then it issues all the commands for you to the compiler, and by the end of it, you'll have a collection of precompiled .lib files, one for each different flavour of each library. The header files somehow tell the linker which lib files to include, so if you have the correct paths setup, the correct flavour of precompiled .lib file will automatically be linked to your program, thus saving you a 30 minute compilation.

    You can see what libraries need to be compiled by boost jam and what libraries don't by looking at this page: http://www.boost.org/doc/libs/1_37_0 - if a library does not need a lib file (and therefore does not require you to mess with boost jam first), it will say "Build & Link: Header only" whereas if a library does require you to precompile a lib file, it will say "Build & Link: Automatic linking".

    Also, if you are on Windows, you can download the precompiled .lib files so you never have to use boost jam. To get that, what you should do is go to the www.boost.org page, go to the Getting Started section and follow it all the way through just to make sure you have everything setup correctly. One of the links on the windows version of that page tells you where to find the precompiled .lib files.