Any good building tools for a C++ project, which c

2019-01-21 14:38发布

问题:

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

回答1:

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



回答2:

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.



回答3:

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.



回答4:

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



回答5:

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



回答6:

Noel Llopis has written a few articles comparing build systems. Part 1 of "The Quest for the Perfect Build System" is at http://gamesfromwithin.com/the-quest-for-the-perfect-build-system. 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.



回答7:

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/



回答8:

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!



回答9:

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