views:

1450

answers:

10

Hi, i'm wondering if there is any nice and neat tool to replace the GNU Autotools or Make to build a very large C++ project, which are such a complicated thing to use.

It is simple to generate all the files that de Autotools require if the project is small, but if the source code is divided in many directories, with multiple third party libraries and many dependencies, you fall into the "Autotools Hell"..

thanks for any recommendations

+13  A: 

CMake? (generates makefiles, so technically not a replacement as such).

I've also seen "SCons" pop up in a few places recently. Haven't created anything with it myself though.

Nick
It doesn't replace make, but CMake does replace Autotools very well
total
+1  A: 

Cook is another tool that can be used to replace make. I've seen several large companies using it. So, it is enterprise ready even though the website looks rather dated.

http://miller.emu.id.au/pmiller/software/cook/

hoyhoy
I use Cook all the time for my little personal projects. What I love about it is that I can make a list of filenames a.o, b.o, c.o, from an existing list like a.c, b.c, c.c. Even do funny things like from a1.c, b1.c, c1.c generate a2.c, b2.c, etc. Makefiles don't seem to be able to do this. Main drawback: Cook has its own language, so you can't leverage existing skill in Python, Ruby etc.
DarenW
+13  A: 

The Google V8 JavaScript Engine is written in C++ and uses SCons, so I guess that's one vote for it.

amrox
We've found that SCons is unusably slow for large Visual Studio solutions. It works very well on UNIX-ish systems.
Kristopher Johnson
@Kristopher: Can you elaborate? I have not found this to be the case in my experience. Where you generating scons files from the devstudio files?
grieve
I second this: SCons is very very slow when it gets to larger builds.
jkp
I wonder how can the builder script slow down a *C++* build. Wouldn't most of the time be spent on compiling all these templates?
quant_dev
+5  A: 

We use Jam for a complex C++ project - one benefit is that it is nicely cross platform. Rather than me spout off the benefits, just have a quick look at this link: http://www.perforce.com/jam/jam.html

Greg Whitfield
We moved jam from makefiles six or seven years ago. It took a little while to get things up and going, but once the initial work was done, it's been seamless ever since. Setting up new projects is almost trivial.
Graeme Perrow
^moved jam^moved to jam
Graeme Perrow
+1  A: 

See this existing StackOverflow question.

Adam Mitz
+11  A: 

Take a look at waf.

I think you can consider it as a complete replacement for make and autotools. It is based on python. One thing I like about waf is that the waf script itself is ~100kb standalone that you place in your project root directory. This is in contrast to make or rake and friends, where the build system must be installed first. You do have to have python >=2.3 installed though.

~$ ./waf configure && ./waf && ./waf install

Waf's equivalent to Makefiles is the wscript file. It is a python script waf reads, and it defines at least 3 functions: set_options(), configure(conf) and build(bld). You can guess what each of them does.

To jumpstart, I recommend looking in the demos/cpp/* files in the source distribution. Also take a look at the doc/waf.pdf file; it's a 12-page document that will quickly get you up and running.

wilhelmtell
Scons also supplies a "no install" version... weighing in at 5.5KB...
ceretullis
5.5KB? Try 2.1 *MB*!!
rq
SCons is also dog-slow. I've been using it for a year or more now and want to move to Waf ASAP.
jkp
+4  A: 

Noel Llopis has written a few articles comparing build systems. Part 1 of "The Quest for the Perfect Build System" is at http://www.gamesfromwithin.com/articles/0506/000092.html. Part 2 follows on the same site. A retry of Scons is reported at http://gamesfromwithin.com/?p=104.

Conclusions: SCons is too slow ... Jam is the winner.

Anthony Cramp
That article is from 2005, so it is pretty dated.
JesperE
True. There is the newer test of SCons though, which is from late last year. Just updated the broken link.
Anthony Cramp
+6  A: 

For a comparison of the speed of various C++ build tools, you can have a look at this benchmark: http://retropaganda.info/~bohan/work/sf/psycle/branches/bohan/wonderbuild/benchmarks/time.xml

bohan
great link to amazing RECENT benchmark ... +1
neuro
+1  A: 

I have using SCons on a big c++ project (on both Linux and Windows), and it works really well.

scons all -j8 (which compiles object files in parallel) is very cool!

Kristian
+1  A: 

I use bakefile for my build process and I became a big fan!

I never have to write a Makefile myself anymore, let alone horrible GNU autotools scripts. All I have to do is provide an XML file that describes the build targets. Bakefile can convert this into a Makefile that gets all the (header file) dependencies right etc, where different Makefile formats may be chosen (pasting the list from the documentation):

available formats are:
    autoconf      GNU autoconf Makefile.in files
    borland       Borland C/C++ makefiles
    dmars         Digital Mars makefiles
    dmars_smake   Digital Mars makefiles for SMAKE
    gnu           GNU toolchain makefiles (Unix)
    mingw         MinGW makefiles (mingw32-make)
    msevc4prj     MS eMbedded Visual C++ 4 project files
    msvc          MS Visual C++ nmake makefiles
    msvc6prj      MS Visual C++ 6.0 project files
    msvs2003prj   MS Visual Studio 2003 project files
    msvs2005prj   MS Visual Studio 2005 project files
    symbian       Symbian development files
    watcom        OpenWatcom makefiles
    xcode2        Xcode 2.4 project files

I usually use the autoconf option, and it writes the annoying GNU autotools scripts for me. I did have to adapt the configure.ac script, so that configure finds a certain library on any system. But it wasn't too bad. Getting the autoconf scripts in this way is nice, because I don't have to write them all by myself, and when I distribute my project it will look as if I had written them, and users can still build my project in the god-given way, with

./configure && make && make install