comp.lang.ada
 help / color / mirror / Atom feed
* [GNAT 2006] Project file and conditional withing/linking
@ 2006-06-08  2:37 Alex R. Mosteo
  2006-06-08 12:19 ` mor3b
  2006-06-08 19:50 ` Simon Wright
  0 siblings, 2 replies; 5+ messages in thread
From: Alex R. Mosteo @ 2006-06-08  2:37 UTC (permalink / raw)


Hello,

I'm using a project file and, depending on some external variables, I want
to include some library for linking or not. The library is defined in its
own project file.

The problem is that withing the library project causes its linker options to
be added no matter what I try, and I'd like to remove these linker options
(otherwise the library is always linked).

Conditionally withing seems out of the question: the "with"s are to be at
the top. I've tried overriding with

for Gtkada.Linker'Default_Switches ("ada") use ();
for Gtkada.Linker.Linker_Options use ();

but both give syntax errors when trying to load the project file.

Another try has been to completely override my project linker options with

package Linker
   case Include_Gtk is
      when No => 
         for Default_Switches ("ada") use (); 
         for Linker_Options use ();

but it seems the composition of options is done at a later stage so this
doesn't affect previously withed projects.

I could remove the withing and copy the switches to my project file, but I'd
strongly prefer to keep using the stock installed library project file.

For now I think I'll have to resort to have separate project files. Unless
of course someone can enlighten me.

Thanks in advance,

A. Mosteo.



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

* Re: [GNAT 2006] Project file and conditional withing/linking
  2006-06-08  2:37 [GNAT 2006] Project file and conditional withing/linking Alex R. Mosteo
@ 2006-06-08 12:19 ` mor3b
  2006-06-08 19:50 ` Simon Wright
  1 sibling, 0 replies; 5+ messages in thread
From: mor3b @ 2006-06-08 12:19 UTC (permalink / raw)


i want to make afreen fourm can you help me
my e-mail:
meeedooo_2005@hotmail.com




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

* Re: [GNAT 2006] Project file and conditional withing/linking
  2006-06-08  2:37 [GNAT 2006] Project file and conditional withing/linking Alex R. Mosteo
  2006-06-08 12:19 ` mor3b
@ 2006-06-08 19:50 ` Simon Wright
  2006-06-09  7:45   ` Alex R. Mosteo
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Wright @ 2006-06-08 19:50 UTC (permalink / raw)


"Alex R. Mosteo" <devnull@mailinator.com> writes:

> I'm using a project file and, depending on some external variables,
> I want to include some library for linking or not. The library is
> defined in its own project file.
>
> The problem is that withing the library project causes its linker
> options to be added no matter what I try, and I'd like to remove
> these linker options (otherwise the library is always linked).

I don't see why you use Linker_Options? I would have thought you could
do everything with Default_Switches ("ada").

> Conditionally withing seems out of the question: the "with"s are to be at
> the top. I've tried overriding with
>
> for Gtkada.Linker'Default_Switches ("ada") use ();
> for Gtkada.Linker.Linker_Options use ();

No, you can define your own switches, not theirs.

> I could remove the withing and copy the switches to my project file,
> but I'd strongly prefer to keep using the stock installed library
> project file.

We have defined environment-dependent symbols in non-source Projects
and then used the symbols to create the appropriate switches in the
user project. Something like

   package Linker is
     case Use_Other_Package is
       when Yes =>
         for Default_Switches ("ada") 
           use ("-foo") & Other_Package.Linker_Switches;
       when No =>
         for Default_Switches ("ada") use ("-bar");
     end case;
   end Linker;



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

* Re: [GNAT 2006] Project file and conditional withing/linking
  2006-06-08 19:50 ` Simon Wright
@ 2006-06-09  7:45   ` Alex R. Mosteo
  2006-06-09  8:08     ` Alex R. Mosteo
  0 siblings, 1 reply; 5+ messages in thread
From: Alex R. Mosteo @ 2006-06-09  7:45 UTC (permalink / raw)


Simon Wright wrote:

> "Alex R. Mosteo" <devnull@mailinator.com> writes:
> 
>> I'm using a project file and, depending on some external variables,
>> I want to include some library for linking or not. The library is
>> defined in its own project file.
>>
>> The problem is that withing the library project causes its linker
>> options to be added no matter what I try, and I'd like to remove
>> these linker options (otherwise the library is always linked).
> 
> I don't see why you use Linker_Options? I would have thought you could
> do everything with Default_Switches ("ada").

Actually, the previous GtkAda version used Default_Switches and current one
uses Linker_Options. I don't know the reason nor the implications. In any
case, I'm just using the installed GtkAda project files.

>> Conditionally withing seems out of the question: the "with"s are to be at
>> the top. I've tried overriding with
>>
>> for Gtkada.Linker'Default_Switches ("ada") use ();
>> for Gtkada.Linker.Linker_Options use ();
> 
> No, you can define your own switches, not theirs.
> 
>> I could remove the withing and copy the switches to my project file,
>> but I'd strongly prefer to keep using the stock installed library
>> project file.
> 
> We have defined environment-dependent symbols in non-source Projects
> and then used the symbols to create the appropriate switches in the
> user project. Something like
> 
>    package Linker is
>      case Use_Other_Package is
>        when Yes =>
>          for Default_Switches ("ada")
>            use ("-foo") & Other_Package.Linker_Switches;
>        when No =>
>          for Default_Switches ("ada") use ("-bar");
>      end case;
>    end Linker;

I used to do this with the GAP 2005 release, but it seems the GAP/GPL 2006
release will pass the linker options to gnatlink no matter what, once you
with the project. Maybe this is the difference between Default_Switches and
Linker_Options. Going to set up a test case.

Certainly, there are several solutions when you have control over all the
project files. I'm attempting to find a solution without modifying the
GtkAda stock project file.



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

* Re: [GNAT 2006] Project file and conditional withing/linking
  2006-06-09  7:45   ` Alex R. Mosteo
@ 2006-06-09  8:08     ` Alex R. Mosteo
  0 siblings, 0 replies; 5+ messages in thread
From: Alex R. Mosteo @ 2006-06-09  8:08 UTC (permalink / raw)


Alex R. Mosteo wrote:

> Simon Wright wrote:

>> We have defined environment-dependent symbols in non-source Projects
>> and then used the symbols to create the appropriate switches in the
>> user project. Something like
>> 
>>    package Linker is
>>      case Use_Other_Package is
>>        when Yes =>
>>          for Default_Switches ("ada")
>>            use ("-foo") & Other_Package.Linker_Switches;
>>        when No =>
>>          for Default_Switches ("ada") use ("-bar");
>>      end case;
>>    end Linker;
> 
> I used to do this with the GAP 2005 release, but it seems the GAP/GPL 2006
> release will pass the linker options to gnatlink no matter what, once you
> with the project. Maybe this is the difference between Default_Switches
> and Linker_Options. Going to set up a test case.

For the record, I've just tested it: Using Default_Switches will not
propagate through projects unless you do the appending as in your example,
whereas using Linker_Options will pass these arguments to the linker just
by withing the project.



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

end of thread, other threads:[~2006-06-09  8:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08  2:37 [GNAT 2006] Project file and conditional withing/linking Alex R. Mosteo
2006-06-08 12:19 ` mor3b
2006-06-08 19:50 ` Simon Wright
2006-06-09  7:45   ` Alex R. Mosteo
2006-06-09  8:08     ` Alex R. Mosteo

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