CMake for D2 ready for testers

Jens Mueller jens.k.mueller at gmx.de
Mon Feb 21 12:22:54 PST 2011


Russel Winder wrote:
> On Mon, 2011-02-21 at 12:40 +0100, Jens Mueller wrote:
> [ . . . ]
> > I don't know about upstreaming it. Certainly it would be nice. But for
> > doing so I need polish it further.
> 
> Can the code comprising the D support for CMake be "packaged" up so that
> it can be offerred to everyone direct from a DVCS repository?  SCons and
> Waf have the tool concept to allow for this.  CMake must have something
> analogous.  People can then make use of the D support with their CMake
> without the necessity of it heading upstream -- though it would be good
> for that to happen eventually.

Don't know how packaging is done in SCons/Waf.
With CMakeD, you clone the repository, i.e.
$ hg clone http://cmaked2.googlecode.com/hg/ cmaked2
and
$ cd cmaked2/cmaked
$ mkdir build
$ cd build
$ cmake ..
$ make install

to install it. That will copy the necessary files into your CMake
installation.
I'll guess SCons/Waf offers something more than that.

> > It seems that not many people are using CMakeD and there seems to be
> > less interest in it. But I used it for a word cloud I programed for a
> > course (see here http://gitorious.org/wordcloud). The nice thing is that
> > you can rely on CMake's modules. E.g. in the above example it was
> > straightforward to let CMake make sure that the GD library it installed.
> > That makes it very useful for integrating a C/C++ library.
> > If you do not know already, the getting started guide is here
> > http://code.google.com/p/cmaked2/wiki/GettingStarted
> > According to http://code.google.com/p/cmaked2/wiki/TestedPlatforms it
> > was used on recent versions of Debian, ArchLinux, Gentoo, and Ubuntu
> > with CMake at least 2.8.2 and dmd at least 2.049. It should work on
> > Windows as well. Some people have used it.
> > Recently I added gdc support which works for me. But so far I haven't
> > got any feedback from other users.
> 
> Personally I prefer SCons and Waf over CMake, but would be happy to
> trial CMake and its D support.  In fact the SCons tool I am trying to
> force myself to work on and the CMake D support may help each other by
> collaborating.   

Yeah. I try to help, if I can. Don't hesitate asking. Though I have to
admit I have almost no Python skills. I like Ruby more. It pleases my
eyes and there seems to be only enough space for one scripting language
in my head.

> > > What about 64bit support in dmd2?
> > 
> > You mean support for building 64bit code with dmd2 using CMakeD? That
> > should be fairly straightforward given that you just need to pass -m64
> > to dmd. I think by default it builds 32-bit even on a 64-bit machine.
> > But I assume this is going to change once 64-bit is stable.
> > If I find some time I will build the above word cloud example for
> > 64-bit and report here, if that helps you.
> 
> In one sense it is as easy as passing -m64 but there is also the issue
> of the list of libraries needed at link time -- or does the CMake stuff
> already pull in that information from dmd.conf?

CMakeD just relies on dmd. But you're right it's a bit more complicated.
It seems that on Linux CMake has no proper way of cross building a 32
bit/64 bit version. That kind of cross compiling does not seems to work.
I would need to investigate further to find out whether it's a dmd
problem. Usually I think for building a 32 bit C binary you just pass
-m32 then the linker should search in ...lib32/. If you build a 64 bit
binary it should search in ...lib64/. If you don't specify anything it's
up to the compiler. CMake's task is just to check whether the dependent
library is installed. I think at the moment it does not look in
lib32/lib64 separately. In that sense it's support for cross compiling
is weak. I may be wrong here.

> > Recently I've been a bit distracted from CMakeD development since I
> > stumbled over
> > Gyp
> > http://code.google.com/p/gyp/
> > and
> > Premake
> > http://industriousone.com/premake
> > Both address similar needs like CMake but do not support D yet.
> 
> Are these good enough to get traction compared to SCons, Waf, CMake,
> Autotools, Make, Ant, Maven, Gradle, Gant?  This is a serious question
> not a troll.  There is always space for a new, better build framework to
> take the community by storm, but on the other hand if they are just side
> shows then it dilutes effort and progress. 

I do not know yet. I think both of them are pretty weak regarding
already available modules, i.e. files to find a specific dependency. Gyp
is developed for building Chromium. They had a problem with SCons while
migrating to it.
They also wrote in what regard CMake didn't work out for them
http://code.google.com/p/gyp/wiki/GypVsCMake
I like premake for it's readability see
http://industriousone.com/sample-script
and it's all Lua. Though I'm not sure whether I can keep two scripting
languages in my head. But Lua seems to be very simple.

Jens


More information about the Digitalmars-d mailing list