freetype: add option to build using separate zlib (#621)

This commit is contained in:
David Vanderson 2022-11-22 12:22:10 -05:00 committed by GitHub
parent 9b9852b56e
commit 305fa7fa35
Failed to generate hash of commit
2 changed files with 7 additions and 0 deletions

View file

@ -30,6 +30,9 @@ pub fn build(b: *Builder) void {
...
exe.addPackage(freetype.pkg);
freetype.link(b, exe, .{});
// use this option if you are including zlib separately
//freetype.link(b, exe, .{ .freetype = .{ .use_system_zlib = true } });
}
```

View file

@ -30,6 +30,7 @@ pub const FreetypeOptions = struct {
config_path: ?[]const u8 = null,
install_libs: bool = false,
brotli: bool = false,
use_system_zlib: bool = false,
};
pub const HarfbuzzOptions = struct {
@ -131,6 +132,9 @@ pub fn buildFreetype(b: *Builder, mode: std.builtin.Mode, target: std.zig.CrossT
const lib = b.addStaticLibrary("freetype", null);
lib.defineCMacro("FT2_BUILD_LIBRARY", "1");
if (options.use_system_zlib) {
lib.defineCMacro("FT_CONFIG_OPTION_SYSTEM_ZLIB", "1");
}
lib.setBuildMode(mode);
lib.setTarget(target);
lib.linkLibC();