Re: Custom compilers?

Mirko Raner <[email protected]> Wed, 25 Jun 2008 13:53:12 -0700
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Quoting Roman Kennke <[email protected]>:

> Hi Mirko,
>
> > it's definitely possible, but you'd have to write your own cpptasks
> compiler
> > adapter.
>
> Interesting. Do you think it is possible to write one adapter that can
> be configured (e.g. reads all necessary information like
> path-to-executable from properties, etc)?

That, too, should be possible, in my opinion. In practice, your Ant script
will still have to make accommodations for various differences between the
target platforms (library naming scheme, custom optimization options,
etc.). You can find an old article that I wrote long time ago still on-line
at DDJ: http://www.ddj.com/architect/184405433

cpptasks encapsulates things like include path, library path,
multi-threading level, warning level, and output type, but the
<compilerarg> elements will still contain literal switches that are custom
to a particular compiler. You could introduce additional abstract elements
like, for example, <optimization level="..."/> or <compliance level="posix">
to give you a higher-level view of things and have the
compiler adapter figure out what it means on command-line level. I imagine
there will still be some platform-specific odds and ends that just need to
go into their own conditional <compilerarg>.

Back when I was working on this, I actually developed an XML-based "option
description language" that provided an abstract description of a compiler's
options (for example, "-l is a boolean option and means ...", "-r can be
followed by a number between 1 and 4, where 1 means ..., 2 means ..., ...",
etc.). This was actually used for automatically creating an Eclipse GUI, but
you could come up with a similar description language for generic cpptasks
compiler adapters.

HTH,

Mirko

> Or do I need to write one
> adapter for each and every cross-compilation-chain I have here (many!)?
> Maybe I can reuse existing adapters (most are GCC derived, some VC
> derived and very few more exotic things) and make them configurable (to
> find the executable, set cross-compilation flags, etc? Or can I already
> do this with the existing adapters?
>
> Cheers, Roman
>
> >  I did exactly that a few years ago, also for an embedded device. My
> > company planned to officially open-source the code, but the project was
> > never completed. The source code is still online at
> > http://osdir.com/ml/java.ant-contrib.devel/2003-12/msg00022.html (at
> least
> > it was last time I checked).
> >
> > HTH,
> >
> > Mirko
> >
> > Quoting Roman Kennke <[email protected]>:
> >
> > > Hi there,
> > >
> > > I'm evaluating ant and ant-contrib as a replacement for the build
> > > infrastructure of a project at my workplace. One thing I'm not sure
> is,
> > > can I use the cc task with custom compilers? I.e. a compiler in a
> custom
> > > location with its own set of flags etc, stuff for some more weird
> > > embedded systems. How would I go about doing that?
> > >
> > > Cheers, Roman
> > >
> > > --
> > > http://kennke.org/blog/
> >
> --
> http://kennke.org/blog/
>


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php