* Two questions about gpr files
@ 2014-04-05 8:01 mockturtle
2014-04-05 11:19 ` Simon Wright
2014-04-08 8:07 ` Stephen Leake
0 siblings, 2 replies; 4+ messages in thread
From: mockturtle @ 2014-04-05 8:01 UTC (permalink / raw)
Dear all,
in my spare time I am writing a program that I would like
(a) to run on different systems (e.g., Windows, Linux, ...)
despite the fact that it needs to access to some system-specific
features that are outside the scope of the standard.
(b) to use a GTK-based interface, but falling down to a text-based
one (e.g., ncurses) if GTK is not available at compilation time
I could solve those two problems if it was possible to find within the *.gpr file the type of system and if a given project file is present. For example, with something like
case OS is
when "Linux" =>
OS_Dependent_Source_Dir := "src/linux";
when "Windows" =>
OS_Dependent_Source_Dir := "src/win";
end case;
Well, you got the idea... (to be honest, I cannot imagine how to do a "conditional with" of gtkada.gpr with the current syntax).
I looked around the gprbuild documentation, but I was not able to find anything. I know I could use external variables, such as reading environment variables or use the -X switch, but I would like a solution that works on any OS (OK, most of the commonly used OSes :-) and it requires no special intervention from the user that compiles the code.
Any ideas?
Thank you in advance for any help.
Riccardo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Two questions about gpr files
2014-04-05 8:01 Two questions about gpr files mockturtle
@ 2014-04-05 11:19 ` Simon Wright
2014-04-08 8:07 ` Stephen Leake
1 sibling, 0 replies; 4+ messages in thread
From: Simon Wright @ 2014-04-05 11:19 UTC (permalink / raw)
mockturtle <framefritti@gmail.com> writes:
> I could solve those two problems if it was possible to find within the
> *.gpr file the type of system and if a given project file is present.
> For example, with something like
>
> case OS is
> when "Linux" =>
> OS_Dependent_Source_Dir := "src/linux";
>
> when "Windows" =>
> OS_Dependent_Source_Dir := "src/win";
> end case;
You might find "aggregate projects" useful, especially the last part of
section 1.7.3.
http://docs.adacore.com/gprbuild-docs/html/gprbuild_ug.html#Define-a-build-environment
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Two questions about gpr files
2014-04-05 8:01 Two questions about gpr files mockturtle
2014-04-05 11:19 ` Simon Wright
@ 2014-04-08 8:07 ` Stephen Leake
2014-04-08 9:38 ` Dmitry A. Kazakov
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2014-04-08 8:07 UTC (permalink / raw)
mockturtle <framefritti@gmail.com> writes:
> (a) to run on different systems (e.g., Windows, Linux, ...)
> despite the fact that it needs to access to some system-specific
> features that are outside the scope of the standard.
>
> (b) to use a GTK-based interface, but falling down to a text-based
> one (e.g., ncurses) if GTK is not available at compilation time
>
> <snip>
>
> I looked around the gprbuild documentation, but I was not able to find anything. I know I could use external variables, such as reading environment variables or use the -X switch, but I would like a solution that works on any OS (OK, most of the commonly used OSes :-) and it requires no special intervention from the user that compiles the code.
>
> Any ideas?
use a Makefile, and or a configure script.
See gnatcoll for detailed ideas.
--
-- Stephe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Two questions about gpr files
2014-04-08 8:07 ` Stephen Leake
@ 2014-04-08 9:38 ` Dmitry A. Kazakov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2014-04-08 9:38 UTC (permalink / raw)
On Tue, 08 Apr 2014 03:07:30 -0500, Stephen Leake wrote:
> use a Makefile, and or a configure script.
Never ever use Makefile. If you want your project stay useful. Make a
mental experiment. Let you download any project that uses Makefile,
including Ada projects. What are chances that you will be able to compile
it? Without ./configure it is less than 10%. With ./configure it is less
than 1%. For anything complex (e.g. GtkAda) it is plain 0%.
The best way to do conditional "with" (the method suggested by Simon does
not work, I tried it before), is to include the project always but make it
empty for the targets it does not support (e.g. no source files).
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-08 9:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-05 8:01 Two questions about gpr files mockturtle
2014-04-05 11:19 ` Simon Wright
2014-04-08 8:07 ` Stephen Leake
2014-04-08 9:38 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox