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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to