Skip to content

Commit 4ff609b

Browse files
committed
Fix compatibility issues for zig 0.15.0-dev.
1 parent 9724f89 commit 4ff609b

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
```zig
3333
const cham = b.dependency("chameleon", .{});
34-
exe.root_module.addImport("chameleon", cham.module("chameleon"));
34+
exe_mod.addImport("chameleon", cham.module("chameleon"));
3535
```
3636

3737
- Import it in your project.

build.zig

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ pub fn build(b: *std.Build) void {
44
const target = b.standardTargetOptions(.{});
55
const optimize = b.standardOptimizeOption(.{});
66

7-
const cham_mod = b.addModule("chameleon", .{
7+
const cham_mod = b.createModule(.{
88
.root_source_file = b.path("src/chameleon.zig"),
9+
.target = target,
10+
.optimize = optimize,
911
});
1012

11-
const exe = b.addExecutable(.{
12-
.name = "chameleon",
13+
const exe_mod = b.createModule(.{
1314
.root_source_file = b.path("src/main.zig"),
1415
.target = target,
1516
.optimize = optimize,
1617
});
17-
exe.linkLibC();
18-
exe.root_module.addImport("chameleon", cham_mod);
18+
exe_mod.addImport("chameleon", cham_mod);
19+
20+
const exe = b.addExecutable(.{
21+
.name = "chameleon",
22+
.root_module = exe_mod,
23+
});
1924
b.installArtifact(exe);
2025

2126
const run_cmd = b.addRunArtifact(exe);
@@ -25,7 +30,7 @@ pub fn build(b: *std.Build) void {
2530
run_cmd.addArgs(args);
2631
}
2732

28-
const run_step = b.step("run", "Run the app");
33+
const run_step = b.step("run", "Run the example");
2934
run_step.dependOn(&run_cmd.step);
3035

3136
const tests = b.addTest(.{ .root_source_file = b.path("src/chameleon.zig") });

build.zig.zon

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
.{
2-
.name = "chameleon",
3-
.version = "2.0.0",
2+
.name = .chameleon,
3+
.version = "2.0.1",
4+
.fingerprint = 0x3f13cb6e8d5aec64, // Changing this has security and trust implications.
5+
.minimum_zig_version = "0.15.0-dev.97+677b2d62e",
46
.paths = .{
5-
"src/api/",
6-
"src/chameleon.zig",
7-
"src/colors.zig",
8-
"src/styles.zig",
9-
"src/utils.zig",
107
"build.zig",
118
"build.zig.zon",
9+
"src",
1210
"LICENSE",
1311
},
1412
}

src/main.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const Chameleon = @import("chameleon");
44
pub fn main() !void {
55
comptime var c = Chameleon.initComptime();
66
comptime var header = c.underline().bold().italic().blink().createPreset();
7-
8-
std.debug.print("\t\t {s}{s}{s}{s}{s}{s}{s}{s}{s}\n\n", .{
7+
std.debug.print("\n\t\t {s}{s}{s}{s}{s}{s}{s}{s}{s}\n\n", .{
98
header.green().fmt("C"),
109
header.red().fmt("H"),
1110
header.blue().fmt("A"),

src/utils.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ pub inline fn rgbFromHex(hex_code: []const u8) [3]u32 {
2525
};
2626
}
2727

28+
test toString {
29+
try std.testing.expectEqual("123", toString(123));
30+
}
31+
2832
test rgbFromHex {
2933
try std.testing.expectEqual([_]u32{ 0xFF, 0xAA, 0x00 }, rgbFromHex("FFAA00"));
3034
}

0 commit comments

Comments
 (0)