I am thinking of using cpptasks to implement a custom compiler and linker in Ant for an embedded toolchain. I essentially have a toolchain driver similar to gcc that sits on top of all of the command line tools and allows me to only compile, only preprocess, or preprocess, compile, and link (or any combination thereof) with the same command line executable, spawning the appropriate tools based on the command line flags you give it, and the source file extensions it sees. Can I do this with cpptasks? Here is what I thought I would do:
1) Create a compiler adapter - say myCompiler - with a command of "myCC" and appropriate command line args to compile.
2) Create a linker adapter - say myLinker - also with a command of "myCC" but with appropriate command line args for linking.
3) Define my own task, extending CCTask, but providing my own default compiler and linker adapters to be the two classes defined above.
Now - in my build.xml I assume if I do not specify any <compiler/> or <linker/> entries, it will by default compile and link using myCC in both cases. However - is it possible to only run a compile step? Can I re-define the <linker/> to be nothing? If I leave it undefined it will simply use the default and link anyways, correct?
Is the solution to not specify a default in my custom task based on CCTask? If so - that means I will have to *always* specify <compiler/> and <linker/> entries for normal compile and link builds - which is verbose and a pain...
I'm new to cpptasks so if I am missing something obvious please feel free to enlighten me or whack me with something large and blunt.
Cpptasks only links if you specify an outfile attribute, if you omit it, it only compiles.
You can use the name or classname attribute on the cc element to specify the default compiler (and the default linker by inference).
There had not been a request to be able to override the default compiler, but if it is important enough to you that you'd be willing to create a derivative CCTask, I might be able to work it in.
OK, cool. I guess I'll dig in and play with it. I'll work on it - but our tools are pretty specific (and not useful to many people). I may not even need a derivative CCTask - I'm not entirely sure yet. The big thing was being able to compile, but not link - which I didn't see anywhere in the docs.
Thanks for the reply. I look forward to hacking around with cpptasks!
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.