Skip to content

Commit 87a0b41

Browse files
committed
Add sanitize-c build option
Upstream may have code that triggers the sanitizer. This option allows users to disable it. (cherry picked from commit 09cb98c)
1 parent ae9d172 commit 87a0b41

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 true;
79

810
const upstream = b.dependency("SDL_ttf", .{});
@@ -21,6 +23,7 @@ pub fn build(b: *std.Build) void {
2123
.target = target,
2224
.optimize = optimize,
2325
.link_libc = true,
26+
.sanitize_c = sanitize_c,
2427
}),
2528
});
2629
lib.addIncludePath(upstream.path("include"));

0 commit comments

Comments
 (0)