Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make specification of 'cc_library' header dependencies platform-independent. #2172

Closed
Helcaraxan opened this issue Dec 2, 2016 · 2 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@Helcaraxan
Copy link

( This was initially being discussed as a random follow-up to #1944 )

Problem / Feature request

Currently the way to specify header dependencies (i.e includes) for a cc_library target can be done in the following (non-exhaustive but most easy and frequently used) methods:

  1. For public "interface" headers that should also be included by any library linking to this cc_library target: use the includes field to specify the path to the directories to be included.
  2. For private headers that are only necessary to require the internal code of this cc_library target: use the copts field to add a manual include flag to the compiler options.

Method 1 is platform agnostic as you only need to specify the path to the directories to the root of the headers to include and paths are already handled in a platform-independent manner.
Method 2 however does not work well for multi-platform projects as GCC and MSVC require different flags (-I vs. \I). A new method should be provided beyond copts to include whole directories and not only single files as private headers for a cc_library target.

For the moment a work-around exists by using select inside copts and switching on the platform but this induces a lot of code duplication.

Scope, use-cases & discussion

In general, private headers are member of the project and should as such be easy to obtain via a glob and specified to the cc_library through hdrs. However this does not cover all "normal" use-cases. An example of a non-supported case:

  • The headers are generated during the build via custom Skylark rules that do not provide dependency tracking nicely with the notion of public "interface" headers. The headers are generated into a know directory which needs to be included by depending rules.
@abergmeier
Copy link
Contributor

abergmeier commented Dec 3, 2016

I do agree this would be nice to have but quite frankly given that there is a obvious workaround for our workspace, this is P3 at best.

@hlopko hlopko self-assigned this Dec 5, 2016
@hlopko hlopko added category: rules > C++ P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request labels Dec 5, 2016
@hlopko hlopko added team-Rules-CPP Issues for C++ rules and removed category: rules > C++ labels Oct 11, 2018
@hlopko hlopko removed their assignment Dec 6, 2019
@c-mita c-mita added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Nov 24, 2020
@sgowroji
Copy link
Member

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants