@@ -4,57 +4,29 @@ pub fn build(b: *std.Build) void {
4
4
const target = b .standardTargetOptions (.{});
5
5
const optimize = b .standardOptimizeOption (.{});
6
6
7
- // Define dependencies.
8
- //const zlib = b.dependency("zlib", .{});
9
-
10
- // // Define module
11
- // const ws_module = b.addModule("ws", .{
12
- // .root_source_file = b.path("src/main.zig"),
13
- // // .dependencies = &[_]std.Build.ModuleDependency{.{ .name = "zlib", .module = zlib.module("zlib") }},
14
- // });
15
-
16
- const ws_module = b .createModule (.{
17
- // `root_source_file` is the Zig "entry point" of the module. If a module
18
- // only contains e.g. external object files, you can make this `null`.
19
- // In this case the main source file is merely a path, however, in more
20
- // complicated build scripts, this could be a generated file.
7
+ const ws_module = b .addModule ("ws" , .{
21
8
.root_source_file = b .path ("src/main.zig" ),
22
- .target = target ,
23
- .optimize = optimize ,
24
9
});
25
10
26
- // Build library.
11
+ // Build library
27
12
const ws_lib = b .addStaticLibrary (.{
28
13
.name = "ws" ,
29
- .root_module = ws_module ,
30
- //.root_source_file = .{ .path = "src/main.zig" },
31
- //.target = target,
32
- //.optimize = optimize,
14
+ .root_source_file = b .path ("src/main.zig" ),
15
+ .target = target ,
16
+ .optimize = optimize ,
33
17
});
34
- // // Link z library and zlib module.
35
- // ws_lib.linkLibrary(b.dependency("zlib", .{
36
- // .target = target,
37
- // .optimize = optimize,
38
- // }).artifact("z"));
39
- // ws_lib.addModule("zlib", zlib.module("zlib"));
40
- // b.installArtifact(ws_lib);
41
18
42
- // Build test.
19
+ // Build test
43
20
const test_compile = b .addTest (.{
44
- .root_module = ws_module ,
45
- // .root_source_file = .{ . path = "src/main.zig" } ,
46
- // .target = target,
47
- // .optimize = optimize,
21
+ // .root_module = ws_module,
22
+ .root_source_file = b . path ( "src/main.zig" ) ,
23
+ .target = target ,
24
+ .optimize = optimize ,
48
25
});
49
- // test_compile.linkLibrary(b.dependency("zlib", .{
50
- // .target = target,
51
- // .optimize = optimize,
52
- // }).artifact("z"));
53
- // test_compile.addModule("zlib", zlib.module("zlib"));
54
26
const test_step = b .step ("test" , "Run unit tests" );
55
27
test_step .dependOn (& test_compile .step );
56
28
57
- // Build examples.
29
+ // Build autobahn_client
58
30
var bin = b .addExecutable (.{
59
31
.name = "autobahn_client" ,
60
32
.root_source_file = b .path ("examples/autobahn_client.zig" ),
@@ -64,17 +36,4 @@ pub fn build(b: *std.Build) void {
64
36
bin .linkLibrary (ws_lib );
65
37
bin .root_module .addImport ("ws" , ws_module );
66
38
b .installArtifact (bin );
67
-
68
- // bin = b.addExecutable(.{
69
- // .name = "wss",
70
- // .root_source_file = b.path("examples/wss.zig"),
71
- // .target = target,
72
- // .optimize = optimize,
73
- // });
74
- // bin.linkLibrary(ws_lib);
75
- // bin.root_module.addImport("ws", ws_module);
76
- // b.installArtifact(bin);
77
39
}
78
-
79
- // to test single file
80
- // $ zig test src/main.zig --deps zlib=zlib --mod zlib::zlib/src/main.zig -l z
0 commit comments