Skip to content

Commit 19dd7b8

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 44c36e1 commit 19dd7b8

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

79
const upstream = b.dependency("SDL_image", .{});
810

@@ -14,6 +16,7 @@ pub fn build(b: *std.Build) void {
1416
.target = target,
1517
.optimize = optimize,
1618
.link_libc = true,
19+
.sanitize_c = sanitize_c,
1720
}),
1821
});
1922

0 commit comments

Comments
 (0)