Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
strategy:
fail-fast: false
matrix:
zig-version: [0.15.1]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -27,8 +26,6 @@ jobs:

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: ${{ matrix.zig-version }}

- name: Check Formatting
run: zig fmt --ast-check --check .
Expand Down
33 changes: 17 additions & 16 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ pub fn build(b: *std.Build) void {
const sanitize_c_type = @typeInfo(@FieldType(std.Build.Module.CreateOptions, "sanitize_c")).optional.child;
const sanitize_c = b.option(sanitize_c_type, "sanitize-c", "Detect undefined behavior in C");
const harfbuzz_enabled = b.option(bool, "enable-harfbuzz", "Use HarfBuzz to improve text shaping") orelse true;

const upstream = b.dependency("SDL_ttf", .{});

const preferred_linkage = b.option(
std.builtin.LinkMode,
"preferred_linkage",
"Prefer building statically or dynamically linked libraries (default: static)",
) orelse .static;

const upstream = b.dependency("SDL_ttf", .{});

const mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
.sanitize_c = sanitize_c,
});

const lib = b.addLibrary(.{
.name = "SDL3_ttf",
.version = .{ .major = 3, .minor = 2, .patch = 2 },
.linkage = preferred_linkage,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
.sanitize_c = sanitize_c,
}),
.root_module = mod,
});
lib.addIncludePath(upstream.path("include"));
lib.addIncludePath(upstream.path("src"));
lib.addCSourceFiles(.{
mod.addIncludePath(upstream.path("include"));
mod.addIncludePath(upstream.path("src"));
mod.addCSourceFiles(.{
.root = upstream.path("src"),
.files = srcs,
});
Expand All @@ -38,22 +39,22 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
lib.linkLibrary(harfbuzz_dep.artifact("harfbuzz"));
lib.root_module.addCMacro("TTF_USE_HARFBUZZ", "1");
mod.linkLibrary(harfbuzz_dep.artifact("harfbuzz"));
mod.addCMacro("TTF_USE_HARFBUZZ", "1");
}

const freetype_dep = b.dependency("freetype", .{
.target = target,
.optimize = optimize,
});
lib.linkLibrary(freetype_dep.artifact("freetype"));
mod.linkLibrary(freetype_dep.artifact("freetype"));

const sdl = b.dependency("SDL", .{
.target = target,
.optimize = optimize,
.preferred_linkage = preferred_linkage,
}).artifact("SDL3");
lib.linkLibrary(sdl);
mod.linkLibrary(sdl);

lib.installHeadersDirectory(upstream.path("include"), "", .{});

Expand Down
10 changes: 5 additions & 5 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
.name = .SDL_ttf,
.version = "3.2.2",
.fingerprint = 0xa98f7681c4b9d53c,
.minimum_zig_version = "0.15.1",
.minimum_zig_version = "0.15.2",
.dependencies = .{
.harfbuzz = .{
.url = "git+https://github.com/allyourcodebase/harfbuzz#6bb522d22cee0ce1d1446bd59fa5b0417f25303e",
.hash = "harfbuzz-8.5.0-Ip1VAqCZAADRh-K2AVujG0N3VAal-AKwkZrvlYOaloyB",
.url = "git+https://github.com/allyourcodebase/harfbuzz#da947143173370b8123ef93f21353d58ce6e6d65",
.hash = "harfbuzz-12.2.0-Ip1VAuGZAAD2dBKDBtAW50eyC9VhSmXFlupI1vCNTFL4",
},
.freetype = .{
.url = "git+https://github.com/allyourcodebase/freetype#9d847affbd224cf6a7303ad6d98715e3675ef78c",
.hash = "freetype-2.13.3-C3-WdeyJAAD9z8BeYYQ8N3gNlPI9NvHRxg5039S5vhz7",
.url = "git+https://github.com/allyourcodebase/freetype#f2f3f662cfc6cf7be2d39d8373c6e6b91297ced8",
.hash = "freetype-2.14.1-C3-WdWqKAADgPV0BhYffbFweY71Qns18mICAEtclm1a6",
},
.SDL = .{
.url = "git+https://github.com/castholm/SDL?ref=v0.3.3+3.2.28#2cde21ea89c7b67d6e16f7f1e2faaa6f44618ecb",
Expand Down