comp.lang.ada
 help / color / mirror / Atom feed
* GPRBuild: Reuse Default_Switches from an imported project
@ 2020-05-03 17:08 Jere
  2020-05-03 17:14 ` Jere
  2020-05-03 19:58 ` Simon Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Jere @ 2020-05-03 17:08 UTC (permalink / raw)


I have an embedded library X that I want to import into 
a project Y.  In project X I have (among other things)

   for Runtime ("Ada") use Project'Project_Dir & "/runtime";

   for Target use "arm-eabi";

   package Compiler is

      case Build_Mode is

         when "debug" =>
            for Default_Switches ("ada") use ("-O0", "-gnatwa.X", "-gnatQ", "-gnat12", "-g");

         when "release" =>
            for Default_Switches ("ada") use ("-O2", "-gnatQ", "-gnatw.X", "-gnat12", "-gnatn", "-ffunction-sections", "-fdata-sections");
      end case;
      
   end Compiler;


In project Y, I with project X:

   with "path/X.gpr"

and I am able to do the following just fine:

   for Runtime ("Ada") use X'Runtime("Ada");

But when I try to use the Default_Switches in the same manner
it gives me errors

   y.gpr:23:46: wrong expression kind for attribute "default_switches"
   y.gpr:23:64: unknown variable "Default_Switches"

For reference I am trying the syntax:

   package Compiler is

      case Build_Mode is

         when "debug" =>
            for Default_Switches ("ada") use X.Compiler.Default_Switches("ada");

         when "release" =>
            for Default_Switches ("ada") use X.Compiler.Default_Switches("ada");
            
      end case;

   end Compiler;

I even tried putting them inside a set of parenthesis, but with no luck.
I am guessing I need some way to indicate which case the default switches
are from, but am unsure.  It may not even be possible.  Anyone know
how to do this or if it possible

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GPRBuild: Reuse Default_Switches from an imported project
  2020-05-03 17:08 GPRBuild: Reuse Default_Switches from an imported project Jere
@ 2020-05-03 17:14 ` Jere
  2020-05-03 19:58 ` Simon Wright
  1 sibling, 0 replies; 4+ messages in thread
From: Jere @ 2020-05-03 17:14 UTC (permalink / raw)


On Sunday, May 3, 2020 at 1:08:47 PM UTC-4, Jere wrote:
> I have an embedded library X that I want to import into 
> a project Y.  In project X I have (among other things)
> 
>
> For reference I am trying the syntax:
> 
>    package Compiler is
> 
>       case Build_Mode is
> 
>          when "debug" =>
>             for Default_Switches ("ada") use X.Compiler.Default_Switches("ada");
> 
>          when "release" =>
>             for Default_Switches ("ada") use X.Compiler.Default_Switches("ada");
>             
>       end case;
> 
>    end Compiler;
> 
> I even tried putting them inside a set of parenthesis, but with no luck.
> I am guessing I need some way to indicate which case the default switches
> are from, but am unsure.  It may not even be possible.  Anyone know
> how to do this or if it possible

Just as a note, I realize in the example, that release and debug versions
look the exact same. I'm just simplifying the example.  I'll probably add
some additional switches for debug mode, so keep that in mind.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GPRBuild: Reuse Default_Switches from an imported project
  2020-05-03 17:08 GPRBuild: Reuse Default_Switches from an imported project Jere
  2020-05-03 17:14 ` Jere
@ 2020-05-03 19:58 ` Simon Wright
  2020-05-03 21:15   ` Jere
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Wright @ 2020-05-03 19:58 UTC (permalink / raw)


Jere <jhb.chat@gmail.com> writes:

>   when "debug" =>
>      for Default_Switches ("ada") use X.Compiler.Default_Switches("ada");

I think that should be X.Compiler'Default_Switches("ada");

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GPRBuild: Reuse Default_Switches from an imported project
  2020-05-03 19:58 ` Simon Wright
@ 2020-05-03 21:15   ` Jere
  0 siblings, 0 replies; 4+ messages in thread
From: Jere @ 2020-05-03 21:15 UTC (permalink / raw)


On Sunday, May 3, 2020 at 3:58:54 PM UTC-4, Simon Wright wrote:
> Jere writes:
> 
> >   when "debug" =>
> >      for Default_Switches ("ada") use X.Compiler.Default_Switches("ada");
> 
> I think that should be X.Compiler'Default_Switches("ada");

Thanks!  That was it.  Now I feel sheepish.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-03 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03 17:08 GPRBuild: Reuse Default_Switches from an imported project Jere
2020-05-03 17:14 ` Jere
2020-05-03 19:58 ` Simon Wright
2020-05-03 21:15   ` Jere

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