Alex Rivera | Logout

ant+cpptasks vs. scons vs. make

Asked 2009-06-23T17:58:18.777
20

I'm looking into scons and I just want to make sure I know what the alternatives are, before I invest a chunk of brain cells into something completely different. I've been using GNU make in the past but have never been particularly happy with it.

Particularly: why isn't Ant used more often with C / C++ projects? (given that there's ant cpptasks) I read a few posts that say that Ant is more oriented around Java (obviously), but what's the drawback to doing so? And why is scons so much better than make?

I am working with a cross-compiler for TI DSPs, typically there are 20-50 cpp files in a project. It would seem like the hard part in build management is automatic dependency checking. Everything else is just mapping lists of files together with sets of compiler options.

edit: and why does cross-compilation change anything? it's a compiler that runs the same way gcc runs, just that it produces object files / executables that won't run on my PC.

Edit
Report

1 Answer

2

I've been working on a project the past five years that does x86 and arm builds using ant. We tweaked cpptasks for our purposes to produce a generic compiler that we just pass in a prefix to...such as arm-gum-linux-gnueabi- and then that gets prepended to the actual tool such as g++ or ar or whatever. No prefix means you get the development platforms build tools. The toolchains for the cross compiling have those prefixes on their build tool binaries. Almost the entire reason for going with Ant rather than anything make based was cpptasks ability to do inremental builds and the uttter tangle of stuff that has to happen to keep autoconf happy. We are able to support the paradigm that almost any source file, particularly those in a folder tree structure for a library set, can be created/renamed/deleted and no edits need to happen to the build files. One little drawback is that linking files updates properties in a way that will cause an unnecessary rebuild.

<target name="lib.cvp">
<fetch.and.log.version 
    svnvers.target="common/cvp" 
    svnvers.property="libcvp.version"/>
    <cc objdir="${obj.dir}/common/cvp" 
        commandPrefix="${command.prefix}" 
        compilerName="${compiler.name}"
        outfile="${lib.dir}/cvp" outtype="static">
        <compiler extends="base.compiler"/>
        <compilerarg 
            value="-D__CVP_LIB_BUILD_VERSION__=&quot;${libcvp.version}&quot;"/>
        <compilerarg 
            value="-D__BUILD_NOTES__=&quot;${libcvp.toolversion}&quot;"/>
        <compilerarg if="is.x86" value="-DARCH_X86"/>
        <linker extends="base.linker"/>
        <includepath refid="common.inc"/>
        <fileset dir="${project.home}/common/cvp">
            <include name="*.c"/>
            <include name="*.cpp"/>
        </fileset>
    </cc>
</target>
answered 2011-09-23T06:04:17.823

Your Answer