Open
Description
The CBuilder lists the C sources, but not the header files.
This means the headers are not added to the dependencies. Which means that any changes to the header files do not cause cache invalidation.
Thanks for the feedback @SaltySpaghetti!
Possible solutions:
- Pass in the
.h
files to sources, which will add them to the compiler invocation (which is fine for clang-like compiler).- Pro: Clanglike compilers can optimize if we pass the .h files to the compilation step. https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
- Not every compiler might like this. We can work around this by filtering
.h
files out. - Pro: Similar design to GN/ninja, which also have the c and h files in a flat list.
- Add the header directory to the
includes
(ty @blaugold!) - Add a
List<String> headers
parameter/field. Which would only resolve the list of paths and add it to theBuildOutput
dependencies.- Pro: most to the point.
- Con: if there's other dependencies which are not header files this parameter can be used to shoe-horn these deps in.
- Add a
List<String> dependencies
parameter/field.
- Con: Is not as discoverable as
headers
.
I'm leaning towards option 1.
A PR would contain:
- Updating all example/test projects to include the header files in
sources:
- Adding some documentation to
sources
that it should include header files. - If needed for some compilers, filtering out
.h
files in the compiler invocation.