-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.zig
85 lines (78 loc) · 2.41 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const use_system_zlib = b.option(bool, "use_system_zlib", "Use system zlib") orelse false;
const enable_brotli = b.option(bool, "enable_brotli", "Build Brotli") orelse true;
const lib = b.addStaticLibrary(.{
.name = "freetype",
.target = target,
.optimize = optimize,
});
lib.linkLibC();
lib.addIncludePath(b.path("include"));
lib.defineCMacro("FT2_BUILD_LIBRARY", "1");
if (use_system_zlib) {
lib.defineCMacro("FT_CONFIG_OPTION_SYSTEM_ZLIB", "1");
}
if (enable_brotli) {
lib.defineCMacro("FT_CONFIG_OPTION_USE_BROTLI", "1");
if (b.lazyDependency("brotli", .{
.target = target,
.optimize = optimize,
})) |dep| lib.linkLibrary(dep.artifact("brotli"));
}
lib.defineCMacro("HAVE_UNISTD_H", "1");
lib.addCSourceFiles(.{ .files = &sources, .flags = &.{} });
if (target.result.os.tag == .macos) lib.addCSourceFile(.{
.file = b.path("src/base/ftmac.c"),
.flags = &.{},
});
lib.installHeadersDirectory(b.path("include/freetype"), "freetype", .{});
lib.installHeader(b.path("include/ft2build.h"), "ft2build.h");
b.installArtifact(lib);
}
const sources = [_][]const u8{
"src/autofit/autofit.c",
"src/base/ftbase.c",
"src/base/ftsystem.c",
"src/base/ftdebug.c",
"src/base/ftbbox.c",
"src/base/ftbdf.c",
"src/base/ftbitmap.c",
"src/base/ftcid.c",
"src/base/ftfstype.c",
"src/base/ftgasp.c",
"src/base/ftglyph.c",
"src/base/ftgxval.c",
"src/base/ftinit.c",
"src/base/ftmm.c",
"src/base/ftotval.c",
"src/base/ftpatent.c",
"src/base/ftpfr.c",
"src/base/ftstroke.c",
"src/base/ftsynth.c",
"src/base/fttype1.c",
"src/base/ftwinfnt.c",
"src/bdf/bdf.c",
"src/bzip2/ftbzip2.c",
"src/cache/ftcache.c",
"src/cff/cff.c",
"src/cid/type1cid.c",
"src/gzip/ftgzip.c",
"src/lzw/ftlzw.c",
"src/pcf/pcf.c",
"src/pfr/pfr.c",
"src/psaux/psaux.c",
"src/pshinter/pshinter.c",
"src/psnames/psnames.c",
"src/raster/raster.c",
"src/sdf/sdf.c",
"src/sfnt/sfnt.c",
"src/smooth/smooth.c",
"src/svg/svg.c",
"src/truetype/truetype.c",
"src/type1/type1.c",
"src/type42/type42.c",
"src/winfonts/winfnt.c",
};