forked from libsdl-org/SDL_ttf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
57 lines (48 loc) · 1.58 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const harfbuzz_enabled = b.option(bool, "enable-harfbuzz", "Use HarfBuzz to improve text shaping") orelse true;
const upstream = b.dependency("sdl_ttf", .{});
const lib = b.addStaticLibrary(.{
.name = "SDL3_ttf",
.target = target,
.optimize = optimize,
});
lib.addIncludePath(upstream.path("include"));
lib.addIncludePath(upstream.path("src"));
lib.addCSourceFiles(.{
.root = upstream.path("src"),
.files = srcs,
});
lib.linkLibC();
if (harfbuzz_enabled) {
const harfbuzz_dep = b.dependency("harfbuzz", .{
.target = target,
.optimize = optimize,
});
lib.linkLibrary(harfbuzz_dep.artifact("harfbuzz"));
lib.root_module.addCMacro("TTF_USE_HARFBUZZ", "1");
}
const freetype_dep = b.dependency("freetype", .{
.target = target,
.optimize = optimize,
});
lib.linkLibrary(freetype_dep.artifact("freetype"));
const sdl_dep = b.dependency("sdl", .{
.target = target,
.optimize = optimize,
});
const sdl_lib = sdl_dep.artifact("SDL3");
lib.linkLibrary(sdl_lib);
lib.installHeadersDirectory(upstream.path("include"), "", .{});
b.installArtifact(lib);
}
const srcs: []const []const u8 = &.{
"SDL_gpu_textengine.c",
"SDL_hashtable.c",
"SDL_hashtable_ttf.c",
"SDL_renderer_textengine.c",
"SDL_surface_textengine.c",
"SDL_ttf.c",
};