websocket
1.2 kB
36 lines
1const std = @import("std");
2
3pub fn build(b: *std.Build) !void {
4 const target = b.standardTargetOptions(.{});
5 const optimize = b.standardOptimizeOption(.{});
6
7 const websocket_module = b.addModule("websocket", .{
8 .target = target,
9 .optimize = optimize,
10 .root_source_file = b.path("src/websocket.zig"),
11 });
12
13 {
14 const options = b.addOptions();
15 options.addOption(bool, "websocket_blocking", false);
16 websocket_module.addOptions("build", options);
17 }
18
19 {
20 // run tests
21 const tests = b.addTest(.{
22 .root_module = websocket_module,
23 .test_runner = .{ .path = b.path("test_runner.zig"), .mode = .simple },
24 });
25 tests.linkLibC();
26 const force_blocking = b.option(bool, "force_blocking", "Force blocking mode") orelse false;
27 const options = b.addOptions();
28 options.addOption(bool, "websocket_blocking", force_blocking);
29 tests.root_module.addOptions("build", options);
30
31 const run_test = b.addRunArtifact(tests);
32
33 const test_step = b.step("test", "Run tests");
34 test_step.dependOn(&run_test.step);
35 }
36}