ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Kakunin <k...@muromoi.net>
Subject Re: CC task in ANT
Date Tue, 02 Aug 2005 08:57:17 GMT
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


Mime
View raw message