<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>cpptasks: Compile tasks for Apache Ant - cpptasks for Apache Ant</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                  <a href="http://ant-contrib.sourceforge.net/" id="bannerLeft">
    
            ant-contrib
    
            </a>
                        <a href="http://www.sourceforge.net/" id="bannerRight">
    
                                    <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=36177&type=5" alt="" />
    
            </a>
            <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2008-04-02
                          |   
                <a href="http://ant-contrib.sourceforge.net/" class="externalLink">ant-contrib</a>
                &gt;
      
          cpptasks
                        </div>
            <div class="xright">      
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                   <h5>Get cpptasks</h5>
            <ul>
              
    <li class="none">
                    <a href="http://sourceforge.net/project/showfiles.php?group_id=36177" class="externalLink">Download</a>
          </li>
              
    <li class="none">
                    <a href="changes-report.html">Changes</a>
          </li>
              
    <li class="none">
                    <a href="license.html">License</a>
          </li>
          </ul>
              <h5>About cpptasks</h5>
            <ul>
              
    <li class="none">
              <strong>Usage</strong>
        </li>
          </ul>
              <h5>Elements</h5>
            <ul>
              
    <li class="none">
                    <a href="antdocs/CCTask.html">cc</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/CompilerDef.html">compiler</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/DefineSet.html">defineset</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/DistributerDef.html">distributer</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/LibrarySet.html">libraryset</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/LinkerDef.html">linker</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/SystemLibrarySet.html">syslibraryset</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/TargetDef.html">targetplatform</a>
          </li>
              
    <li class="none">
                    <a href="antdocs/VersionInfo.html">versioninfo</a>
          </li>
          </ul>
              <h5>Community</h5>
            <ul>
              
    <li class="none">
                    <a href="mail-lists.html">Mailing Lists</a>
          </li>
              
    <li class="none">
                    <a href="issue-tracking.html">Issue Tracking</a>
          </li>
              
    <li class="none">
                    <a href="http://sourceforge.net/projects/ant-contrib/" class="externalLink">Project Page</a>
          </li>
              
    <li class="none">
                    <a href="http://sourceforge.net/news/?group_id=36177" class="externalLink">News</a>
          </li>
          </ul>
              <h5>Development</h5>
            <ul>
              
    <li class="none">
                    <a href="source-repository.html">Repository</a>
          </li>
              
    <li class="none">
                    <a href="apidocs/index.html">JavaDoc</a>
          </li>
              
    <li class="none">
                    <a href="integration.html">Continuous Integration</a>
          </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>cpptasks for Apache Ant</h2>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<ul><li>Add type and task definitions in build file using either taskdef or antlib.</li>
<li>Add <a href="antdocs/CCTask.html">cc</a>
 element to some target in your build file.</li>
<li>Set path and environment variables to be able to run compiler from command line.</li>
<li>Build project.</li>
</ul>
<p>Trivial Sample using taskdef (compatible with Ant 1.5 or later):</p>
<div class="source"><pre>&lt;project name=&quot;hello&quot; default=&quot;compile&quot;&gt;
    &lt;taskdef resource=&quot;cpptasks.tasks&quot;/&gt;
    &lt;target name=&quot;compile&quot;&gt;
        &lt;mkdir dir=&quot;target/main/obj&quot;/&gt;
        &lt;cc outtype=&quot;executable&quot; subsystem=&quot;console&quot; outfile=&quot;target/hello&quot; objdir=&quot;target/main/obj&quot;&gt;
           &lt;fileset dir=&quot;src/main/c&quot; includes=&quot;*.c&quot;/&gt;
        &lt;/cc&gt;
    &lt;/target&gt;
&lt;/project&gt;</pre>
</div>
<p>Trivial Sample using antlib (compatible with Ant 1.6 or later):</p>
<div class="source"><pre>&lt;project name=&quot;hello&quot; default=&quot;compile&quot; xmlns:cpptasks=&quot;antlib:net.sf.antcontrib.cpptasks&quot;&gt;
    &lt;target name=&quot;compile&quot;&gt;
        &lt;mkdir dir=&quot;target/main/obj&quot;/&gt;
        &lt;cpptasks:cc outtype=&quot;executable&quot; subsystem=&quot;console&quot; outfile=&quot;target/hello&quot; objdir=&quot;target/main/obj&quot;&gt;
           &lt;fileset dir=&quot;src/main/c&quot; includes=&quot;*.c&quot;/&gt;
        &lt;/cpptasks:cc&gt;
    &lt;/target&gt;
&lt;/project&gt;</pre>
</div>
<p>More complex samples appear in src/samples.</p>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2001-2008
    
          Ant-Contrib Project
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>