const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{ .default_target = .{
        .cpu_arch = .x86_64,
        .os_tag = .windows,
        .abi = .gnu,
    } });
    const optimize = b.standardOptimizeOption(.{});
    const strip = optimize != .Debug;

    const module = b.createModule(.{
        .root_source_file = b.path("main.zig"),
        .target = target,
        .optimize = optimize,
        .strip = strip,
        .single_threaded = true,
    });

    module.addAssemblyFile(b.path("arch/hells_gate.s"));
    module.linkSystemLibrary("kernel32", .{});
    module.linkSystemLibrary("ntdll", .{});
    module.linkSystemLibrary("advapi32", .{});

    const lib = b.addLibrary(.{
        .name = "valak",
        .root_module = module,
        .linkage = .dynamic,
    });
    lib.subsystem = .Windows;
    b.installArtifact(lib);
}
