cpptasks: Compile tasks for Apache Ant - cpptasks for Apache Ant

ant-contrib

##### Get cpptasks

- Download
- Changes
- License

##### About cpptasks

- Usage

##### Elements

- cc
- compiler
- defineset
- distributer
- libraryset
- linker
- syslibraryset
- targetplatform
- versioninfo

##### Community

- Mailing Lists
- Issue Tracking
- Project Page
- News

##### Development

- Repository
- JavaDoc
- Continuous Integration

## cpptasks for Apache Ant

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.

- Add type and task definitions in build file using either taskdef or antlib.
- Add cc element to some target in your build file.
- Set path and environment variables to be able to run compiler from command line.
- Build project.

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.