wide-midnight-78598
08/01/2022, 5:18 PMcheck
backend and ran into a mild quandry.
I have the following folder structure in most/all of my projects:
mylibrary/include/mylibrary/foo.h
mylibrary/src/foo.c
app/bar.h
app/bar.c
app/main.cpp
Inside of app/main.cpp, I have something like:
#include "mylibrary/foo.h"
#include "bar.h"
As of today's dependency inference, the mylibrary
header may or may not be picked up depending on where the BUILD files are located and how they were generated (e.g. 111, recursive globs, etc). I can design a set of build files to make this pass or fail, or I can modify my header include to make check
pass or fail. If I run tailor
on my sample repos, they'll fail - because the dependency inference can't presume the additional include
folder with no additional information, so they expect the headers to be filename only. If I put a build file with a recursive glob in the "include" folder, it works perfectly.
In CMake (or other tools), it's pretty trivial to provide a list of include directories for compilation, but that doesn't feel very pants-y and almost feels like it's circumventing dep inference and BUILD files.
I'm creating a cc_library
target which will export headers + a shared/static library, but they will still run into the issue of how to lay out BUILD files in order to ensure the namespace is what I want. I, personally, have no problem creating BUILD files to that effect, but again, not very Pants-y, or automatic.
Thoughts?bitter-ability-32190
08/01/2022, 5:24 PMbitter-ability-32190
08/01/2022, 5:24 PMwide-midnight-78598
08/01/2022, 5:28 PMwide-midnight-78598
08/01/2022, 5:29 PM-I
flag for gcc, if there was a nice, clean way to add itenough-analyst-54434
08/01/2022, 5:30 PMbitter-ability-32190
08/01/2022, 5:31 PMwide-midnight-78598
08/01/2022, 5:31 PMpants.toml
pick them up?fast-nail-55400
08/01/2022, 5:31 PMSOURCE_ROOT/include
or SOURCE_ROOT/includes
as base directories for dependency inference; no BUILD
file necessarywide-midnight-78598
08/01/2022, 5:32 PMfast-nail-55400
08/01/2022, 5:33 PMwide-midnight-78598
08/01/2022, 5:33 PMwide-midnight-78598
08/01/2022, 5:37 PMbitter-ability-32190
08/01/2022, 5:37 PMwide-midnight-78598
08/01/2022, 5:39 PMwide-midnight-78598
08/01/2022, 6:46 PMsources
- but I don't see examples specifically related to empty source roots as a directory.
Unless I would need to create some sort of AllCCSourceRoots
type of thing from AllSourceRoots
? I'm assuming there is already a better way?wide-midnight-78598
08/01/2022, 7:43 PM