@@ -4,57 +4,29 @@ pub fn build(b: *std.Build) void {
44 const target = b .standardTargetOptions (.{});
55 const optimize = b .standardOptimizeOption (.{});
66
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" , .{
218 .root_source_file = b .path ("src/main.zig" ),
22- .target = target ,
23- .optimize = optimize ,
249 });
2510
26- // Build library.
11+ // Build library
2712 const ws_lib = b .addStaticLibrary (.{
2813 .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 ,
3317 });
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);
4118
42- // Build test.
19+ // Build test
4320 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 ,
4825 });
49- // test_compile.linkLibrary(b.dependency("zlib", .{
50- // .target = target,
51- // .optimize = optimize,
52- // }).artifact("z"));
53- // test_compile.addModule("zlib", zlib.module("zlib"));
5426 const test_step = b .step ("test" , "Run unit tests" );
5527 test_step .dependOn (& test_compile .step );
5628
57- // Build examples.
29+ // Build autobahn_client
5830 var bin = b .addExecutable (.{
5931 .name = "autobahn_client" ,
6032 .root_source_file = b .path ("examples/autobahn_client.zig" ),
@@ -64,17 +36,4 @@ pub fn build(b: *std.Build) void {
6436 bin .linkLibrary (ws_lib );
6537 bin .root_module .addImport ("ws" , ws_module );
6638 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);
7739}
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