I have a single C header file that I use with conjunction b.addTranslateC to translate all header files in one step (also because of cImport removal from the language https://github.com/ziglang/zig/issues/20630).
I am trying to include freetype with the help of mach's freetype wrapper but I can't figure out how to add an include path to TranslateC .
// build.zig
pub fn build(b: *std.Build) void {
// ...
const dep_freetype = b.dependency("freetype2", .{
.optimize = .ReleaseSafe,
.enable_brotli = false,
});
const lib_freetype = dep_freetype.artifact("freetype");
const c_headers = b.addTranslateC(.{
.root_source_file = b.path("./src/c.h"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
// error: expected type '[]const u8', found 'Build.LazyPath'
c_headers.addIncludeDir(dep_freetype.path("include"));
// ...
// src/c.h
#include <SDL2/SDL.h>
#include <SDL2/SDL_vulkan.h>
#include <ft2build.h>
#include FT_FREETYPE_H