Add include paths to freetype module

This commit is contained in:
Krzysztof Wolicki
2024-01-07 18:45:07 +01:00
parent 9e14a7ea62
commit 6c7c5eecce

View File

@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const libpng_enabled = b.option(bool, "enable-libpng", "Build libpng") orelse false; const libpng_enabled = b.option(bool, "enable-libpng", "Build libpng") orelse false;
_ = b.addModule("freetype", .{ .root_source_file = .{ .path = "main.zig" } }); const module = b.addModule("freetype", .{ .root_source_file = .{ .path = "main.zig" } });
const upstream = b.dependency("freetype", .{}); const upstream = b.dependency("freetype", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addStaticLibrary(.{
@ -15,6 +15,8 @@ pub fn build(b: *std.Build) !void {
}); });
lib.linkLibC(); lib.linkLibC();
lib.addIncludePath(upstream.path("include")); lib.addIncludePath(upstream.path("include"));
module.addIncludePath(upstream.path("include"));
module.addIncludePath(.{ .path = "" });
// Dependencies // Dependencies
const zlib_dep = b.dependency("zlib", .{ .target = target, .optimize = optimize }); const zlib_dep = b.dependency("zlib", .{ .target = target, .optimize = optimize });
@ -38,12 +40,11 @@ pub fn build(b: *std.Build) !void {
}); });
if (libpng_enabled) try flags.append("-DFT_CONFIG_OPTION_USE_PNG=1"); if (libpng_enabled) try flags.append("-DFT_CONFIG_OPTION_USE_PNG=1");
for (srcs) |src| { lib.addCSourceFiles(.{
lib.addCSourceFile(.{ .dependency = upstream,
.file = upstream.path(src), .files = srcs,
.flags = flags.items, .flags = flags.items,
}); });
}
switch (target.result.os.tag) { switch (target.result.os.tag) {
.linux => lib.addCSourceFile(.{ .linux => lib.addCSourceFile(.{