Commit 1d07bbbef2

Andrew Kelley <andrew@ziglang.org>
2019-07-19 02:03:38
zig build: add valgrind cli options
1 parent e5d0329
Changed files (1)
std/build.zig
@@ -1255,6 +1255,8 @@ pub const LibExeObjStep = struct {
     libc_file: ?[]const u8 = null,
     target_glibc: ?Version = null,
 
+    valgrind_support: ?bool = null,
+
     const LinkObject = union(enum) {
         StaticPath: []const u8,
         OtherStep: *LibExeObjStep,
@@ -1882,6 +1884,14 @@ pub const LibExeObjStep = struct {
             try zig_args.append("--system-linker-hack");
         }
 
+        if (self.valgrind_support) |valgrind_support| {
+            if (valgrind_support) {
+                try zig_args.append("--enable-valgrind");
+            } else {
+                try zig_args.append("--disable-valgrind");
+            }
+        }
+
         if (self.override_std_dir) |dir| {
             try zig_args.append("--override-std-dir");
             try zig_args.append(builder.pathFromRoot(dir));