aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/libfuzzer/build.zig
blob: 54cc977abe8626da4ae3be31eceb481102bb7af2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const std = @import("std");
const builtin = @import("builtin");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    if (builtin.os.tag == .windows) return; // TODO: libfuzzer support for windows

    const run_step = b.step("run", "Run executables");
    const exe = b.addExecutable(.{
        .name = "main",
        .root_module = b.createModule(.{
            .root_source_file = b.path("main.zig"),
            .target = target,
            .optimize = optimize,
            .fuzz = true,
        }),
        .use_llvm = true, // #23423
    });

    b.installArtifact(exe);
    b.default_step = run_step;

    const run_artifact = b.addRunArtifact(exe);
    run_artifact.addArg(b.cache_root.path orelse "");
    run_step.dependOn(&run_artifact.step);
}