From 921dd0ace58073919a618d61c931d4797c2bcbef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ostrzo=C5=82ek?= Date: Sun, 18 Aug 2024 19:49:09 +0200 Subject: [PATCH] Update to Zig 0.13.0 (#3) * Update to zig 0.13.0 * Update readme to zig 0.13.0 --- .gitignore | 2 +- README.md | 4 ++-- build.zig | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8bc911a..dca1103 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ zig-out/ -zig-cache/ \ No newline at end of file +.zig-cache/ diff --git a/README.md b/README.md index 2392591..8c8c6e6 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ const gpio = b.dependency("gpio", .{ .target = target, .optimize = optimize, }); -exe.addModule("gpio", gpio.module("gpio")); +exe.root_module.addImport("gpio", gpio.module("gpio")); ``` -And that's it! You should now be able to use `zig-gpio` via `@import("gpio");` \ No newline at end of file +And that's it! You should now be able to use `zig-gpio` via `@import("gpio");` diff --git a/build.zig b/build.zig index 9f57029..4d10600 100644 --- a/build.zig +++ b/build.zig @@ -7,8 +7,8 @@ const Item = struct { /// List of examples const examples = [_]Item{ - .{ .name = "blinky", .src = "src/examples/blinky.zig" }, - .{ .name = "multi", .src = "src/examples/multi.zig" }, + .{ .name = "blinky", .src = "examples/blinky.zig" }, + .{ .name = "multi", .src = "examples/multi.zig" }, }; /// List of commands @@ -24,7 +24,7 @@ pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); // Add the gpio module so it can be used by the package manager - const gpio_module = b.createModule(.{ .root_source_file = .{ .path = "src/index.zig" } }); + const gpio_module = b.createModule(.{ .root_source_file = b.path("src/index.zig") }); try b.modules.put(b.dupe("gpio"), gpio_module); // Create a step to build all the examples @@ -37,7 +37,7 @@ pub fn build(b: *std.Build) !void { const exe = b.addExecutable(.{ .name = cfg.name, - .root_source_file = .{ .path = cfg.src }, + .root_source_file = b.path(cfg.src), .target = target, .optimize = optimize, }); @@ -58,7 +58,7 @@ pub fn build(b: *std.Build) !void { const exe = b.addExecutable(.{ .name = cfg.name, - .root_source_file = .{ .path = cfg.src }, + .root_source_file = b.path(cfg.src), .target = target, .optimize = optimize, });