[CMake] Ada language support

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Jul 2 18:58:28 EDT 2007


On 2007-07-02 16:24-0400 Alexander Neundorf wrote:

> On Monday 02 July 2007 14:56, you wrote:
> ...
>> Specifically look for
>>
>> CMakeAdaCompiler.cmake.in
>> CMakeAdaInformation.cmake
>> CMakeDetermineAdaCompiler.cmake
>> CMakeTestAdaCompiler.cmake
>> ada.cmake
>
> Cool :-)
>
> Can you link C, C++ and Ada object files together to libraries/executables ?

Yes.  I have only tested the Ada/C combination, however, and some additional
changes may be required for Ada/C++.

> If yes, which linker is used then ? The Ada one or the one from C++ ?

It depends.  The Ada linking model is quite different from the standard C
linking model.  There is a compilation step, a binding step (which includes
a lot of checking for satisfying dependencies and perhaps other tests), and
a link step.  To compile objects to be stored in a shared library (which we
wanted to do for the PLplot Ada binding library) we simply use gcc.  For the
final executables, however, we use gnatmake to do the binding and linking.
gnatmake has some built-in assumptions that are not satisfied by the current
CMake build model.  We have worked around those issues by specifying extra
flags at the CMakelists.txt level to get everything to work. See
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/ada/CMakeLists.txt
for how we set up the Ada bindings library and
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/examples/ada/CMakeLists.txt
for how we build Ada PLplot examples using the PLplot Ada bindings library.
To avoid these workarounds, I believe that CMake will need to be changed
internally.  However, the workarounds aren't that onerous, and apparently
there are not that many people building Ada projects with CMake at the
moment so probably it is a good idea to delay the internal changes until
the Ada/CMake community becomes a bit bigger.

>
> Autotools currently use this scheme to select which linker to use, how would
> fit Ada into it ?
> http://www.cs.cmu.edu/cgi-bin/info2www?
> (automake.info)How%20the%20Linker%20is%20Chosen

We don't use that scheme at all.  Instead, we let gnatmake take care of all
the binding and linking details.

Note, our Ada/CMake building scheme (which uses gnatmake for the final
construction of executables) has so far only been tested on Linux and Mac OS
X, but it performs well for those platforms.  Our plotting results generated
with Ada are identical to those generated with C (and C++, fortran, python,
java, tcl, perl...) So far we have only made that "identity" test for Ada
implementations of 3 of our 28 standard PLplot examples, but now that our
Ada bindings are finally beginning to settle down we have plans to implement
the remaining 25 standard examples in Ada as a comprehensive check of the
Ada bindings.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list