comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Checking for OS in gnatstudio project file(.gpr)
Date: Fri, 19 Jun 2020 17:43:43 +0100	[thread overview]
Message-ID: <lyeeqbgg5c.fsf@pushface.org> (raw)
In-Reply-To: 5eeb50d9$0$1208$e4fe514c@news.kpn.nl

ldries46 <bertus.dries@planet.nl> writes:

> I em in neede for a possibility to check within a .gpr file which
> operating system is runnung. Is there a way to do that? So I can use
> the same project file without changing  the .gpr file when compiling a
> program on different OS'ses.

Alire settled on this[1] in an aggregate project after some
heartsearching:

   Host_OS := external ("OS", "default");
   --  On Windows an OS environment variable is defined, we can use it to
   --  determine if we are compiling on Windows.
   --
   --  On macOS, the nearest equivalent is OSTYPE; however this is
   --  e.g. "darwin18", so not useful here. Set "macOS" by hand.

   --  ALIRE_OS is used in alire_common.gpr.
   --  GNATCOLL_OS is used in gnatcoll.gpr.
   case Host_OS is
      when "Windows_NT" =>
         for External ("ALIRE_OS") use "windows";
         for External ("GNATCOLL_OS") use "windows";
      when "macOS"      =>
         for External ("ALIRE_OS") use "osx";
         for External ("GNATCOLL_OS") use "osx";
      when others       =>
         for External ("ALIRE_OS") use "unix";
         for External ("GNATCOLL_OS") use "unix";
   end case;

but I've had a lot of trouble with aggregate projects (I don't think
I've grasped what the use cases are). As I remember, it was package
Builder that was the issue.

[1] https://github.com/alire-project/alire/blob/master/alr_env.gpr#L22

      parent reply	other threads:[~2020-06-19 16:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 11:32 Checking for OS in gnatstudio project file(.gpr) ldries46
2020-06-18 11:41 ` Mark Lorenzen
2020-06-18 12:13 ` Dmitry A. Kazakov
2020-06-18 16:44 ` Björn Lundin
2020-06-19  8:01 ` ldries46
2020-06-19  9:11   ` ldries46
2020-06-19  9:11   ` Mark Lorenzen
2020-06-19 16:29     ` Simon Wright
2020-06-20  9:02       ` ldries46
2020-06-19 16:43 ` Simon Wright [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox