You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by hiren patel <hi...@yahoo.com> on 2005/08/01 21:33:05 UTC

CC task in ANT

Hi,
 I want to compile .c file using ant. I have added cpptasks.jar and 
ant-contrib.jar  from lib directory. 
 
I dont know how to use cc task in build.xml.
can anyody provide sample build.xml that compiles prog.c and header.h 
to an exe?
 
 
Thanks,
hiren patel


		
---------------------------------
 Start your day with Yahoo! - make it your home page 

Re: CC task in ANT

Posted by Alexey Kakunin <ka...@muromoi.net>.
Something like this:

<project name="CC Example" default="BuildProg">
    <!-- Compilation settings -->
    <!-- Set compiler property depending from os -->
    <condition property="compiler" value="gcc">
        <os family="unix"/>
    </condition>
    <condition property="compiler" value="msvc">
        <os family="windows"/>
    </condition>
     
    <target name="clean">
        <delete file="prog" />
    </target>
 
    <target name="init">
    </target>
     
    <target name="BuildProg" depends="init"
            description="example of source compilation">
         <cc     outfile="prog" 
                 subsystem="other"
                 name="${compiler}" 
                 exceptions="true" 
                 objdir="." 
                 debug="true" 
                 optimize="false" 
                 outtype="executable">
 
             <fileset file="prog.c" /> 
                           
             <defineset define="SOME_DEFINE_1" />
             <defineset define="SOME_DEFINE_2" />
              
             <includepath path="."/>
 
             <!-- for example link with libstdc++ -->
             <libset libs="stdc++" type="shared" />
          </cc>
    </target>
  </project>

hiren patel wrote:

>Hi,
> I want to compile .c file using ant. I have added cpptasks.jar and 
>ant-contrib.jar  from lib directory. 
> 
>I dont know how to use cc task in build.xml.
>can anyody provide sample build.xml that compiles prog.c and header.h 
>to an exe?
> 
> 
>Thanks,
>hiren patel
>
>
>		
>---------------------------------
> Start your day with Yahoo! - make it your home page 
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org