From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,15d78a51b0d35cec X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn?= Persson Newsgroups: comp.lang.ada Subject: Re: architecture-independent GNAT project files? Date: Mon, 27 Apr 2009 23:16:13 +0200 Message-ID: <75mlktF1979j6U1@mid.individual.net> References: <75l5ceF18samiU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit X-Trace: individual.net FZp+nNwPEQmEMtUViKPQNQfoAbE3fpHd564KFQ47Nwa7OoaPPd Cancel-Lock: sha1:FFDMmQYdPeF69IroTV8hwm2K7VI= User-Agent: KNode/0.10.9 Xref: g2news2.google.com comp.lang.ada:5573 Date: 2009-04-27T23:16:13+02:00 List-Id: 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. >> 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. Such a feature, if done right, could make it possible to write project files that would work for anything from ARM to Itanium, but I wasn't planning to do that. I'm satisfied if I can support a multilib environment so that i386 libraries will be selected if someone uses the -m32 parameter on an x86_64 platform. For true cross-compilation I guess the cross-compiler will normally have a completely separate set of libraries, including a separate project file directory. -- Bj�rn Persson PGP key A88682FD