CMake for D2 ready for testers

Jens Mueller jens.k.mueller at gmx.de
Sat Oct 9 03:06:46 PDT 2010


Gour D. wrote:
> On Fri, 8 Oct 2010 21:41:55 +0200
> >>>>>> "Jens" == Jens Mueller <jens.k.mueller at gmx.de> wrote:
> 
> Jens> Coming back to the original question. I can recommend CMake
> Jens> especially if one plans to do C and C++ programming. For D we
> Jens> (Steve, Dean and I) are trying to improve the support. Fixing Mac
> Jens> OSX is next on my list.
> 
> My primary interest is D and developing on Linux, although we want our
> app to run on Mac & Windows as well (hopefully using QtD).

With CMake you can check whether Qt is installed on the system. There is
a FindQt.cmake.

> Jens> I have to admit I neither know Scons nor Waf. Maybe these are
> Jens> superior. They're Python-based, right? I'll guess that makes them
> Jens> favorable for Python programmers.
> 
> Waf really looks good and, afaics, it's more extensible than Scons.
> 
> Here is the table with some comparisons:
> 
> http://code.google.com/p/waf/wiki/WafAndOtherBuildSystems

They have very good documentation. Something that's not the case for
CMake. With CMake you have to google a lot. Thankfully that's mainly
needed if you dive into into the internals. Writing a simple
CMakeLists.txt is a matter of minutes. I hope I'm not too biased here
because I've been using it for almost 2 years.

> Jens> On top of my head some things I find nice in CMake. Just curious
> Jens> whether Scons/Waf have similar features.
> 
> I'm not at all familiar with waf, just read a bit about it and here is
> the feature list:
> 
> http://code.google.com/p/waf/
> 
> and here is the 'book':
> 
> http://freehackers.org/~tnagy/wafbook160p3/

Wow. They have excellent documentation.

> Jens> * Find Google Test/other libraries (if supported) in one line:
> Jens>   find_package(GTest REQUIRED)
> 
> I see something like:
> 
> ctx.find_program('touch', var='TOUCH')

Only finds a program, right? I'd like to find a library. I.e. I need the
path to the header files and the library files. I'll guess there is
something like find_file.

> Jens> * Tight integration for testing and packaging (ctest, cpack)
> 
> Only dist for tarballs, afaict.

I do not know how important this whole Windows integration is, but with
CMake you can generate a Windows installer.
Together with Visual Studio support it's a good choice if Windows is
your main client. Could be the reason why CMake is used so often.

> Jens> * No dependencies besides a C++ compiler for installation.
> 
> This is one advantage of waf that it only requires ~80K python script
> which is, usually, distributed with the sources.

You need to have python installed. I have no feeling how many system
have python installed. But probably more than CMake.

> Jens> * Valgrind/Purify integration
> 
> Considering Samba uses Waf, Google returned:
> 
> http://wiki.samba.org/index.php/Debugging_individual_tests

Interesting.

> Moreover, since the system uses full-featured programming language,
> probably there are no restriction what can be done...
> 
> In any case, it's interesting and we'll put it on our evaluation-list.

Can you keep me informed about the result? Just curious which features
influenced your final decision.

Jens


More information about the Digitalmars-d mailing list