comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Exporting linker options from library GPR
Date: Tue, 13 Feb 2018 20:42:00 +0000
Date: 2018-02-13T20:42:00+00:00	[thread overview]
Message-ID: <lyvaf0k4fb.fsf@pushface.org> (raw)
In-Reply-To: 101626dd-bbd5-4e10-a383-3c5e29d4bc88@googlegroups.com

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Lucretia <laguest9000@googlemail.com> writes:

> On Tuesday, 13 February 2018 09:43:49 UTC, Luke A. Guest  wrote:
>
>> Just seen this. I have actually built SDLAda on Mac OS X, but I didn’t push
>> the changes required to get the thing built with the SDL2 framework.
>
> Just checked, I did it on the command line as a hack to get it
> compiling on Mac.
>
> It seems that GPR's cannot expand `sdl2-config --cflags` when passed
> via the GPR Default_Switches mechanism, if there's a way, I could
> clean up the makefile a bit more and shift more to the GPR.

There's probably a way if you use the makefile.

I hacked an sdlada_mac.gpr:


[-- Attachment #2: Mac/Framework compatible GPR --]
[-- Type: text/plain, Size: 1824 bytes --]

project SDLAda_Mac is
   Version := "2.2.0";

   type Platform_Type is ("linux", "bsd", "windows", "macosx", "ios", "android");
   type Mode_Type is ("debug", "release");
   type Build_Type is ("static", "shared");

   Platform : Platform_Type := external ("SDL_PLATFORM", "macosx");
   Mode     : Mode_Type     := external ("SDL_MODE", "debug");
   Build    : Build_Type    := external ("SDL_BUILD", "shared");

   for Languages    use ("Ada", "C");
   for Source_Dirs  use ("../../src", "../../src/" & Platform, "gen/src/");
   for Library_Name use "sdlada";
   for Object_Dir   use "gen/" & Build & "." & Mode & "/lib/.obj";
   for Library_Dir  use "gen/" & Build & "." & Mode &  "/lib";
   for Library_Version use "libsdlada.so." & Version;

   Linking_Options := ("-F", external ("HOME") & "/Library/Frameworks",
                       "-framework", "SDL2");

   case Build is
      when "static" =>
         for Library_Kind use "static";

      when "shared" =>
         for Library_Kind use "relocatable";
         for Library_Options use Linking_Options;
   end case;

   package Compiler is
      C_Switches := ("-I" & external ("HOME") & "/Library/Frameworks/SDL2.framework/Headers");
      Ada_Switches := ("-gnat2012", "-gnata", "-gnato", "-gnatE", "-gnaty", "-gnatyM120");

      case Mode is
         when "debug" =>
            C_Switches   := C_Switches & ("-O0", "-g");
            Ada_Switches := Ada_Switches & ("-O0", "-g");

         when "release" =>
            C_Switches   := C_Switches & ("-O2", "-g");
            Ada_Switches := Ada_Switches & ("-O2", "-g");
      end case;

      for Default_Switches ("C") use C_Switches;
      for Default_Switches ("Ada") use Ada_Switches;
   end Compiler;

   package Linker is
      for Linker_Options use Linking_Options;
   end Linker;

end SDLAda_Mac;

  parent reply	other threads:[~2018-02-13 20:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 14:25 Exporting linker options from library GPR Simon Wright
2018-01-19 16:10 ` Dmitry A. Kazakov
2018-01-19 17:25   ` Simon Wright
2018-01-20 18:15     ` Stephen Leake
2018-02-13  9:43 ` Luke A. Guest
2018-02-13 18:37   ` Lucretia
2018-02-13 20:30     ` Simon Wright
2018-02-13 20:37     ` Simon Wright
2018-02-14  6:29       ` Luke A. Guest
2018-02-13 20:42     ` Simon Wright [this message]
2018-02-14  7:10       ` Luke A. Guest
2018-02-14  9:33         ` Simon Wright
2018-02-14  9:59           ` Luke A. Guest
2018-02-15  1:04             ` Lucretia
2018-02-15  8:49               ` Simon Wright
2018-02-15 10:06                 ` Lucretia
2018-02-15 11:39                   ` Simon Wright
2018-02-15 15:22                     ` Lucretia
2018-02-15 15:24                     ` Lucretia
2018-02-15 18:38                       ` Lucretia
2018-02-15 18:42                         ` Lucretia
2018-02-15 20:52                           ` Simon Wright
2018-02-15 23:14                             ` Luke A. Guest
2018-02-16  8:29                               ` Simon Wright
2018-02-16 23:26                                 ` Stephen Leake
2018-02-17  7:49                                   ` Simon Wright
2018-02-17 14:51                                     ` Lucretia
2018-02-17 15:43                                       ` Simon Wright
2018-02-17 15:52                                         ` Lucretia
2018-02-16  7:29                             ` Lucretia
2018-02-13  9:50 ` Luke A. Guest
replies disabled

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