comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to supply O/S linker arguments with gprbuild?
Date: Mon, 22 Jun 2020 22:07:43 +0200	[thread overview]
Message-ID: <rcr32c$1osc$1@gioia.aioe.org> (raw)
In-Reply-To: 98843f83-9907-4bd4-9600-4bc67e41f883o@googlegroups.com

On 22/06/2020 19:52, Warren wrote:

> The above might be useful for some projects, but I didn't want to define a package for each and every library I link with.

Actually this is the way. I have 20+ alien libraries from GTK: atk, 
glib, gobject etc, all of them have a separate project file.

The linker switches you use are the end-of-the-chain parameters. They 
are ignored everywhere else, but when you build an executable. E.g. if 
you build a library and specify some linker switches for it, you will be 
warned that they are ignored.

Thus you have to copy-paste the package linker from one project to 
another once you have more than one. It is not scalable and barely 
maintainable.

For this case people usually define empty parent projects with switches 
or strings set there and pull them into the executable projects 
combining the linker switches from various sources. It is not nice.

The library parameters for the linker that are indeed transferred from 
the library project to the executable project are specified rather using:

    Library_Options (and similar attributes)

not per switches. See

https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/gnat_project_manager.html#building-libraries

The solution based on Library_Options is almost as good as separate 
third-party library projects if all your third-party dependencies are 
always come through your libraries. Yet there is still a chance to have 
conflicting definitions along different paths from different libraries.

E.g. if you have dependencies like (tree)

    A   C
     \ /
      B
      |
      D

You are OK with Library_Options.

But if you have this (ADG)

      A
     / \
    B   C
     \ /
      D

there is a chance that B and C could have conflicting definitions 
regarding A.

If each library has a project you will never have conflicts and there 
always be only one place to change library options, the library project.

> I have a simple Makefile that drives this project, and I simply wanted a central place to configure the pathnames.

Another idea to consider would be to ditch makefiles. gprbuild does 
everything makefiles do and better and more.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2020-06-22 20:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 15:51 How to supply O/S linker arguments with gprbuild? Warren
2020-06-22 16:14 ` Mark Lorenzen
2020-06-22 16:30 ` Dennis Lee Bieber
2020-06-22 16:39 ` Dmitry A. Kazakov
2020-06-22 17:52   ` Warren
2020-06-22 20:07     ` Dmitry A. Kazakov [this message]
2020-06-22 20:43       ` Simon Wright
2020-06-22 20:59         ` Warren
2020-06-22 21:52           ` Simon Wright
2020-06-22 21:16         ` Dmitry A. Kazakov
2020-06-22 21:27           ` Warren
2020-06-22 21:47           ` Simon Wright
2020-06-22 22:08             ` Jeffrey R. Carter
2020-06-23  9:23 ` Björn Lundin
replies disabled

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