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
<<attachment: ctasks.zip>>
