The cc task can compile various source languages and produce executables, shared libraries (aka DLL's) and static libraries. Compiler adaptors are currently available for C/C++, FORTRAN, MIDL and Windows Resource compilers.
The task can be used with Apache Ant 1.5 and later. This software is not a product of the Apache Software Foundation (ASF) and no endorsement by the ASF is implied.
To use: * Place cpptasks.jar into Ant's classpath by placing in Ant's lib directory, adding to CLASSPATH environment variable or using the -lib command line option.
Trivial Sample using taskdef (compatible with Ant 1.5 or later):
<project name="hello" default="compile"> <taskdef resource="cpptasks.tasks"/> <target name="compile"> <mkdir dir="target/main/obj"/> <cc outtype="executable" subsystem="console" outfile="target/hello" objdir="target/main/obj"> <fileset dir="src/main/c" includes="*.c"/> </cc> </target> </project>
Trivial Sample using antlib (compatible with Ant 1.6 or later):
<project name="hello" default="compile" xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks"> <target name="compile"> <mkdir dir="target/main/obj"/> <cpptasks:cc outtype="executable" subsystem="console" outfile="target/hello" objdir="target/main/obj"> <fileset dir="src/main/c" includes="*.c"/> </cpptasks:cc> </target> </project>
More complex samples appear in src/samples.