You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Adam Murdoch <ad...@yahoo.com> on 2001/06/19 06:12:59 UTC

[SUBMIT] C/C++ compile and link

Hi,

Attached are two tasks to compile and link C/C++.

The <cc> task compiles a set of source files, taking care of things like
header file dependencies.  It also provides a cross-platform way of
specifying things like enabling debug, setting the include search path, and
defining preprocessor macros.

The <link> task links a set of object files and libraries into an executable
file, a shared library (DLL) or a static library.  It takes care of things
like the OS-specific naming convention for executables and libraries and
such.  Again, it provides a cross-platform way of specifying things like the
library search path.

See the docs included in the attachment for more info.

These tasks are intended to provide a cross-platform way to compile and link
C/C++.  They give the build writer some control over simple but common
aspects of the build.  They are not intended to be a complete solution for
building complex C apps.  But we can work towards that, perhaps.  Let's put
the make vs. ant argument to bed for good!

Some current limitations:

* The tasks only know how to drive the GCC and Microsoft Visual C++
compilers and linkers.

* The tasks only understand the naming conventions for Windows and UNIX-like
OSes.  Appologies to those on other platforms.

* The <link> task doesn't check the last-modified time of libraries when
deciding whether to invoke the linker or not.

* They're not as extensible as I'd like.

I've used these tasks successfully on Win2K using both VC++ 6.0 and MinGW
1.0, and on Redhat 7.1.  Your mileage on other platforms may vary.  The
tasks work under the ant 1.3 release, and the 1.4 alpha.

The tasks are pretty raw.  I've got some time up my sleeve ATM to tidy them
up some.  One of the things I'd like to add is support for more
compilers/linkers.  Unfortunately I don't have access to anything other than
Win2K and various Linuxes.  So, send me the details of your favourite
compile toolset and I'll add them.

I'd also like allow the build writer to be able to add their own compiler
definitions.  Possibly by adding <ccompilerdef> and <linkerdef> data types.


Adam

Re: [SUBMIT] C/C++ compile and link

Posted by Peter Donald <do...@apache.org>.
Hi,

Your a legend! I have wanted to do this for ages but been too lazy ;) I will 
have a look at it further soon hopefully. It will probably need to zap tabs 
and change hierarchy (to org.apache.tools.ant.taskdefs.optional.cc). Any ways 
it looks like you have put a lot of work into that - thanks ;)

On Tue, 19 Jun 2001 14:12, Adam Murdoch wrote:
> Hi,
>
> Attached are two tasks to compile and link C/C++.
>
> The <cc> task compiles a set of source files, taking care of things like
> header file dependencies.  It also provides a cross-platform way of
> specifying things like enabling debug, setting the include search path, and
> defining preprocessor macros.
>
> The <link> task links a set of object files and libraries into an
> executable file, a shared library (DLL) or a static library.  It takes care
> of things like the OS-specific naming convention for executables and
> libraries and such.  Again, it provides a cross-platform way of specifying
> things like the library search path.
>
> See the docs included in the attachment for more info.
>
> These tasks are intended to provide a cross-platform way to compile and
> link C/C++.  They give the build writer some control over simple but common
> aspects of the build.  They are not intended to be a complete solution for
> building complex C apps.  But we can work towards that, perhaps.  Let's put
> the make vs. ant argument to bed for good!
>
> Some current limitations:
>
> * The tasks only know how to drive the GCC and Microsoft Visual C++
> compilers and linkers.
>
> * The tasks only understand the naming conventions for Windows and
> UNIX-like OSes.  Appologies to those on other platforms.
>
> * The <link> task doesn't check the last-modified time of libraries when
> deciding whether to invoke the linker or not.
>
> * They're not as extensible as I'd like.
>
> I've used these tasks successfully on Win2K using both VC++ 6.0 and MinGW
> 1.0, and on Redhat 7.1.  Your mileage on other platforms may vary.  The
> tasks work under the ant 1.3 release, and the 1.4 alpha.
>
> The tasks are pretty raw.  I've got some time up my sleeve ATM to tidy them
> up some.  One of the things I'd like to add is support for more
> compilers/linkers.  Unfortunately I don't have access to anything other
> than Win2K and various Linuxes.  So, send me the details of your favourite
> compile toolset and I'll add them.
>
> I'd also like allow the build writer to be able to add their own compiler
> definitions.  Possibly by adding <ccompilerdef> and <linkerdef> data types.
>
>
> Adam

----------------------------------------
Content-Type: application/x-zip-compressed; charset="iso-8859-1"; 
name="ctasks.zip"
Content-Transfer-Encoding: base64
Content-Description: 
----------------------------------------

-- 
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*