From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: architecture-independent GNAT project files?
Date: Tue, 28 Apr 2009 09:24:03 +0200
Date: 2009-04-28T09:24:02+02:00 [thread overview]
Message-ID: <1xrnblwdskgjg$.1v3turpillxav$.dlg@40tude.net> (raw)
In-Reply-To: 75mlktF1979j6U1@mid.individual.net
On Mon, 27 Apr 2009 23:16:13 +0200, Bj�rn Persson wrote:
> Dmitry A. Kazakov wrote:
>
>> On Mon, 27 Apr 2009 09:32:29 +0200, Bj�rn Persson wrote:
>>
>>> When I write GNAT project files for shared libraries I find that I have
>>> to hardcode the paths to some architecture-specific directories. 32-bit
>>> libraries are in /usr/lib/ while 64-bit libraries are in /usr/lib64/, and
>>> I would like to have a single project file that works for both cases.
>>
>> The way I am using is to have a platform variable in the project file:
>>
>> type Platform_Type is ("x86_Windows", "x86_VxWorks");
>> Platform : Platform_Type := external ("Platform", "x86_Windows");
>>
>> and then somewhere later
>>
>> case Platform is
>> when "x86_Windows" =>
>> for Source_Dirs use "os/Windows/i586" & ...;
>> when "x86_VxWorks" =>
>> for Source_Dirs use "os/vxworks/i586" & ...;
>> end case;
>>
>> then same for library things etc.
>
> The analog for my case would be:
>
> type Architecture is ("i386", "x86_64");
> Target : Architecture := external ("Target", "i386");
>
> The problem with that is of course that on x86_64 systems the default will
> almost always be wrong, and if I set the default to x86_64 it will be wrong
> on i386 systems.
New GPS remembers the last choices of the project variables (well almost
always (:-)). So it should not be a great problem. Of course object and
executable files have to land into disparate directories (switched by the
same variable).
>>> The way to find out the architecture of a Unix-like system appears to be
>>> to invoke uname, but GNAT project files don't seem to have a shell-out
>>> feature. As far as I can see in the manual the only ways they can get
>>> input is by environment variables and command line parameters. I don't
>>> suppose Gnatmake provides some variable to project files that shows what
>>> the architecture is?
>>
>> I don't know if it has, but if any, how that is supposed to work for cross
>> platform developing?
>
> The cross-compiler would know its target platform and would assign that
> value to the hypothetical variable. The project file would then select the
> right library directories for that platform.
Hmm, I see no obvious way to do it. In my case there are several GNAT
compilers installed. The project variable Platform chooses the compiler as
well. For example, I have:
package Ide is
case Platform is
when "x86_Windows" =>
for Gnatlist use "gnatls";
for Gnat use "gnat";
for Compiler_Command ("ada") use "gnatmake";
for Debugger_Command use "gdb";
when "x86_VxWorks" =>
for Gnatlist use "i586-wrs-vxworks-gnatls";
for Gnat use "i586-wrs-vxworks-gnat";
for Compiler_Command ("ada") use "i586-wrs-vxworks-gnatmake";
for Debugger_Command use "i586-wrs-vxworks6-gdb";
end case;
end Ide;
This changes gnatlist, gnat, gnatmake, everything...
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2009-04-28 7:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 7:32 architecture-independent GNAT project files? Björn Persson
2009-04-27 8:02 ` Dmitry A. Kazakov
2009-04-27 21:16 ` Björn Persson
2009-04-27 21:55 ` Ludovic Brenta
2009-04-28 21:41 ` Björn Persson
2009-04-28 7:24 ` Dmitry A. Kazakov [this message]
2009-04-28 20:56 ` sjw
2009-04-30 12:17 ` Björn Persson
2009-04-30 12:31 ` Ludovic Brenta
2009-04-27 12:06 ` anon
2009-04-27 19:10 ` sjw
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox