Files
zig/test/standalone/mix_o_files/build.zig
T
Andrew Kelley 80625990d5 std: different mechanism for disabling network dependency
On Windows, it is sometimes problematic to depend on ws2_32.dll. Before,
users of std.Io.Threaded would have to call ioBasic() rather than io()
in order to avoid unnecessary dependencies on ws2_32.dll. Now, the
application can disable networking with std.Options.

This change is necessary due to moving networking functionality to
be based on Io.Operation, which is a tagged union.
2026-03-08 19:20:34 -07:00

42 lines
1.1 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Test it");
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.graph.host;
const obj = b.addObject(.{
.name = "base64",
.root_module = b.createModule(.{
.root_source_file = b.path("base64.zig"),
.optimize = optimize,
.target = target,
}),
});
if (target.result.os.tag == .windows)
obj.root_module.linkSystemLibrary("ws2_32", .{});
const exe = b.addExecutable(.{
.name = "test",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = optimize,
.target = target,
.link_libc = true,
}),
});
exe.root_module.addCSourceFile(.{
.file = b.path("test.c"),
.flags = &[_][]const u8{"-std=c99"},
});
exe.root_module.addObject(obj);
b.default_step.dependOn(&exe.step);
const run_cmd = b.addRunArtifact(exe);
test_step.dependOn(&run_cmd.step);
}