Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 549
cbrulak Avatar asked Feb 04 '09 16:02

cbrulak


4 Answers

I use Boost Jam for my cross-platform C++ development. I chose it because

  • I want my code to build everywhere Boost builds,
  • it uses a relatively simple declarative language to specify how to build targets, and
  • it can build all the different flavors of your binaries (e.g. debug vs. release, 32-bit vs. 64-bit, msvc vs. gcc) in a single invocation with an absolute minimum of flavor-related exceptions in the build declarations.

You can refine generic rules with flavor-specific settings, rather than writing separate rules for each flavor permutation. The syntax isn't exactly what I would have chosen, but it's not too hard to get used to.

This paper compares Boost Jam to CMake, SCons, and Eclipse CDT: http://syrcose.ispras.ru/2009/files/04_paper.pdf

My understanding is that Boost Jam is an offshoot of Perforce Jam maintained by the Boost community, and that Perforce Jam isn't actively maintained anymore (the release notes have the last update in April 2003).

Of course, if you don't care about cross-platform development, there are easier ways to go, as others have mentioned here. Personally, I keep meaning to revisit Eclipse CDT; it didn't seem usable 5 years ago, but I hear it has come a long way.

like image 79
Trevor Robinson Avatar answered Jan 01 '23 05:01

Trevor Robinson


As you state, Boost Jam is a build system, and can be used independently of any other boost libraries. I don't know anything about Perforce Jam, but to my understanding, Boost jam is very similar, and mostly compatible.

The main difference is that Boost Jam often comes with Boost Build, a collection of jam rules designed for common tasks, e.g. compiling libraries, running unit tests, creating doxygen documentation, etc.

Compared to other build systems, Boost Jam/Boost Build is designed for easily compilation of different variants. So if you want to change compilation settings from debug to release, or single- to multi-threaded, it determines a lot of the changes automatically.

The drawback is that the syntax is very finicky, and outside the boost website, there's no good documentation. But I imagine Perforce Jam is just as bad in that regard.

like image 44
AFoglia Avatar answered Jan 01 '23 06:01

AFoglia


Given the choice of build tools I would not migrate to jam. There are better build systems out there - CMake / SCons for C/C++, qmake for Qt, Ant for Java, NAnt and MSBuild for .NET, and so on. They might not be technically superior but they will be less painful to use simply because far more people are familiar with them (on the other hand, they might be technically superior, of course :D).

like image 39
Mihai Limbășan Avatar answered Jan 01 '23 06:01

Mihai Limbășan


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.

like image 38
Ray Hidayat Avatar answered Jan 01 '23 05:01

Ray Hidayat