Jon Stewart on Sun, 29 Aug 2004 16:25:38 -0500 (CDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[ALACPP] ant + cc task


I spent a couple hours yesterday playing around with ant and the cc task 
created by the ant-contrib people. The cc task has been around for a 
while, but I've always been pretty leery about it. The current version is 
1.0b3 and it still has a couple of bugs in it -- the relevant one being 
that even when you specify g++ as your compiler, gcc is invoked as the 
linker so the C++ stdlib is not linked against by default -- but, all in 
all, it seems to be working pretty well.

Here's what I've got:

<target name="build">

<cc name="g++" debug="${debug}" exceptions="true" multithreaded="false"
  outfile="${projname}" link="executable" rebuild="${compile.rebuid}">
  <sysincludepath path="${path.boost}"/>
  <fileset dir="${src}" casesensitive="yes">
    <include name="**/*.cpp"/>
  </fileset>
  <syslibset libs="stdc++" type="shared"/> -- works around bug
</cc>
</target>

The cc task does its own dependency analysis, the results of which it 
caches in a local dependencies.xml file for speedier recompiles. I have 
read that it looks at your compiler and options and such, so it seems to 
be pretty smart, although I haven't peeled away all the layers myself.

I haven't compared it against make on a big project yet. On a simple 
"Hello, world", it's slower than make, but most of this seems due to ant's 
startup time. The task has an option for precompiled headers and 
everything is backed by ccache anyway, so it seems like a scalable 
solution. Is there a way to have a background jvm running and simply have 
ant run via that on an as-needed basis? Obviously the jvm startup time is 
not a big deal as it's a constant overhead and relatively small (~1-2 
seconds) at that. It just seems wasteful.

So, yeah, success with ant. Just drop the jar into ant's lib directory and 
go to town. This makes me very happy, as ant has always given me a warm, 
xml-induced fuzzy.



Jon
-- 
Jon Stewart                                 Advanced Los Angeles C++
stew1@xxxxxxxxxxx                           http://www.alacpp.org
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp