feat: update dependency for zig v0.11.0

This commit is contained in:
Rekai Nyangadzayi Musuka 2023-12-14 21:25:12 -06:00
parent dc159b4aeb
commit e5c1d4d2b7
2 changed files with 31 additions and 7 deletions

View File

@ -1,16 +1,40 @@
const std = @import("std"); const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void { pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const net_dep = b.dependency("zig-network", .{}); // https://github.com/MasterQ32/zig-network
// Standard optimization options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
const zig_network = b.dependency("zig-network", .{}); // https://github.com/MasterQ32/zig-network
_ = b.addModule("gdbstub", .{ _ = b.addModule("gdbstub", .{
.source_file = .{ .path = "src/lib.zig" }, .source_file = .{ .path = "src/lib.zig" },
.dependencies = &.{.{ .name = "network", .module = net_dep.module("network") }}, .dependencies = &.{.{ .name = "network", .module = zig_network.module("network") }},
}); });
const lib_test = b.addTest(.{ .root_source_file = .{ .path = "src/lib.zig" }, .target = target }); // Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_tests = b.addTest(.{
.root_source_file = .{ .path = "src/lib.zig" },
.target = target,
.optimize = optimize,
});
const test_step = b.step("test", "Run Library Tests"); const run_lib_tests = b.addRunArtifact(lib_tests);
test_step.dependOn(&lib_test.step);
// This creates a build step. It will be visible in the `zig build --help` menu,
// and can be selected like this: `zig build test`
// This will evaluate the `test` step rather than the default, which is "install".
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&run_lib_tests.step);
} }

View File

@ -3,8 +3,8 @@
.version = "0.1.0", .version = "0.1.0",
.dependencies = .{ .dependencies = .{
.@"zig-network" = .{ .@"zig-network" = .{
.url = "https://github.com/MasterQ32/zig-network/archive/7b5f76ea09626b96755c027bf4bd5b7e45297027.tar.gz", .url = "https://github.com/MasterQ32/zig-network/archive/07ef40cacd7b00bc0f26e254d97d4d4c9071195a.tar.gz",
.hash = "122090e7cb4459c2224399a45c56f47462733b919aa547c96b8c14ee705bfa22976e", .hash = "12204d3d4c1184d379a78399e5ddd8a46fe19ca6c991d5c9b909c1980d14acb1dede",
}, },
}, },
} }