As a minimal example of what I'm asking about, suppose I have the following C project in zig 0.12.0-dev.415+5af5d87ad:
// build.zig
const std = @import("std");
const Build = std.Build;
pub fn build(b: *Build) void {
const freetype_dep = b.dependency("freetype", .{});
const freetype_lib = freetype_dep.artifact("freetype");
const exe = b.addExecutable(.{ .name = "a" });
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} });
exe.linkLibrary(freetype_lib);
b.installArtifact(exe);
}
// main.c
#include <freetype.h>
int main()
{
FT_Library library;
if(FT_Init_FreeType(&library)) { return 1; }
return 0;
}
This fails to build with a missing <freetype.h> file. This is because the actual freetype.h header file is installed under subdirectory freetype/ in the dependency install path. Obviously, I could just change the include directive to <freetype/freetype.h> (which does build), but this is only a minimal example and in the actual project there are lots of includes like this, and since it's actually an intermediate dependency I'd rather not edit the code if I don't have to.
So then my question is if there is a way in build.zig to add the subdirectory freetype/ to the include path.
I tried looking into some of the internal fields of freetype_lib (which is a *std.Build.Step.Compile) but I'm not sure how I might use those to do what I want to do:
installed_pathseems to always benullinstalled_headersseems promising but it's just a list of*Stepwhich I think are already type erased at this point?