Trick-17 / clang-build

Clang-based cross platform build system written in Python
https://clang-build.readthedocs.io
MIT License
8 stars 3 forks source link

Make dependencies "private" by default #101

Closed GPMueller closed 3 years ago

GPMueller commented 5 years ago

We may want to make dependencies "private" by default, meaning they would not forward public includes and flags. The question is how public dependencies would then be declared.

This issue depends on issue #100.

A few facts to note:

Benefits:


The complete set of inheritance rules would be:


The following cases should illustrate a little:

  1. shared libA -private-> shared libB (libB is used only internally and its headers are not exposed in the interface of libA). Public includes and flags are applied to libA, but not forwarded. Interface flags are applied to libA, but not forwarded.
  2. shared libA -public-> shared libB (the interface of libA includes headers of libB). Public includes and flags are applied to libA and forwarded. Interface flags are applied to libA, but not forwarded.
  3. static libA -private-> shared libB (libB is used only internally and its headers are not exposed in the interface of libA). Public includes and flags are applied to libA, but not forwarded. Interface flags are forwarded by libA, but not applied.
  4. static libA -public-> shared libB (the interface of libA includes headers of libB). Public includes and flags are applied to libA and forwarded. Interface flags are forwarded by libA, but not applied.
NOhs commented 4 years ago

I am working on a similar issue currently where I change the default behaviour of the public header search to not perform a search if no explicit public include locations are given.

GPMueller commented 4 years ago

Note that the documentation, in particular inheritance.rst needs to be reviewed for statements such as

interface flags are not forwarded beyond a shared library, while public flags are forwarded up until an executable

GPMueller commented 3 years ago

A first draft of the updated documentation from PR #127 can be viewed here: f61b9f3/docs/user_guide/inheritance.rst