Skip to content

Commit 09cb98c

Browse files
committed
Add sanitize-c build option
Upstream may have code that triggers the sanitizer. This option allows users to disable it.
1 parent f6adf07 commit 09cb98c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

build.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const std = @import("std");
33
pub fn build(b: *std.Build) void {
44
const target = b.standardTargetOptions(.{});
55
const optimize = b.standardOptimizeOption(.{});
6+
const sanitize_c_type = @typeInfo(@FieldType(std.Build.Module.CreateOptions, "sanitize_c")).optional.child;
7+
const sanitize_c = b.option(sanitize_c_type, "sanitize-c", "Detect undefined behavior in C");
68
const harfbuzz_enabled = b.option(bool, "enable-harfbuzz", "Use HarfBuzz to improve text shaping") orelse false;
79

810
const upstream = b.dependency("SDL_ttf", .{});
@@ -15,6 +17,7 @@ pub fn build(b: *std.Build) void {
1517
.target = target,
1618
.optimize = optimize,
1719
.link_libc = true,
20+
.sanitize_c = sanitize_c,
1821
}),
1922
});
2023
lib.addCSourceFile(.{ .file = upstream.path("SDL_ttf.c") });

0 commit comments

Comments
 (0)