views:

171

answers:

4

Nant seems very compiler-centric - which is guess is because it's considered a .NET development system. But I know it can be done! I've seen it. The platform we're building on has its own compiler and doesn't use 'cl.exe' for c++. We're building a C++ app on a different platform and would like to override with our own compiler. Can anyone point me at a way to do that or at least how to set up a target of my own that will use our target platform's compiler?

+3  A: 

You need to write your own task. This is a nice reference.

Cody Brocious
+1  A: 

Initially, use the <exec> task to run an executable, passing in any required information as parameters and/or environment variables.

For future use, you could also investigate writing your own task. I know with standard ant this is done with the <taskdef> task and a java class. I'm not sure of the Nant equivalent unfortunately.

workmad3
A: 

You could also use the <exec> task.

Romain Verdier
+4  A: 

Here is one I did for Delphi. Each 'arg' is a separate param with a value defined elsewhere. The target is called with the params set up before calling it.

<target name="build.application">
    <exec program="dcc32" basedir="${Delphi.Bin}" workingdir="${Application.Folder}" verbose="true">
        <arg value="${Application.Compiler.Directive}" />
        <arg value="-Q" />
        <arg value="/B" />
        <arg value="/E${Application.Output.Folder}" />
        <arg value="/U${Application.Lib.Folder};${Application.Search.Folder}" />
        <arg value="${Application.Folder}\${Delphi.Project}" />
    </exec>
</target>
Jeff Cuscutis
Nice answer. We did that same type of thing for our Borland/CodeGear C++ compiler. We can pretty much make nant run your dish washer with the proper exec task. :)
Scott Saad